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
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/commons/asBaseComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

)
);
}
Expand Down