Skip to content

Do not pass flex to RN views (new flex shadow prop) #2527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

M-i-k-e-l
Copy link
Collaborator

@M-i-k-e-l M-i-k-e-l commented Mar 13, 2023

Description

Do not pass flex to RN views (new flex shadow prop)
This currently breaks at least one screen (NumberInputScreen).

Changelog

⚠️ Do not pass flex to RN views (new flex shadow prop)

@@ -66,7 +66,7 @@ function asBaseComponent<PROPS, STATICS = {}>(WrappedComponent: React.ComponentT
const {forwardedRef, ...others} = themeProps;
return (
(this.state.error && UIComponent.defaultProps?.renderError) || (
<WrappedComponent {...others} modifiers={modifiers} ref={forwardedRef}/>
<WrappedComponent {...others} modifiers={modifiers} ref={forwardedRef} flex={undefined}/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone wraps not a RN component with flex modifier the layout will break. What about passing the flex modifier's value to the 'flex' prop or undefined if there is none?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do something like the following:

// @ts-ignore
const flex = typeof themeProps.flex === 'boolean' ? themeProps.flex ? 1 : undefined : themeProps.flex;
return (
  (this.state.error && UIComponent.defaultProps?.renderError) || (
    <WrappedComponent {...others} modifiers={modifiers} ref={forwardedRef} flex={flex}/>
  )
);

@ethanshar @Inbal-Tish @lidord-wix @adids1221
Please vote with thumbs \ reply with your opinion.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modifier flex can be a value other than 1

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this should be fixed.
Do you generally like this better?
I think both solutions have a risk to them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 ⚠️

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could block all of our flex and flex={false} (only flex and not flex-2 etc) and send undefined for false and flex-1 instead of flex.

I think we should talk about this in the dev sync before we merge.

@M-i-k-e-l
Copy link
Collaborator Author

Opened #2536 instead

@M-i-k-e-l M-i-k-e-l closed this Mar 15, 2023
@M-i-k-e-l M-i-k-e-l deleted the infra/handle-new-rn71-flex-shadow-prop branch March 15, 2023 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants