Skip to content

Fix FlexShrink default value #2451

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

Merged
merged 2 commits into from
Feb 1, 2021
Merged

Fix FlexShrink default value #2451

merged 2 commits into from
Feb 1, 2021

Conversation

Titozzz
Copy link
Contributor

@Titozzz Titozzz commented Jan 21, 2021

On react-native flexShrink default value is not 1 but 0. 1 is the default value for the web and this can be confusing.

On react-native flexShrink default value is not 1 but 0. 1 is the default value for the web and this can be confusing.
@netlify
Copy link

netlify bot commented Jan 21, 2021

Deploy preview for react-native ready!

Built with commit ce522f4

https://deploy-preview-2451--react-native.netlify.app

@Simek
Copy link
Collaborator

Simek commented Feb 1, 2021

@Titozzz Hmm, according to the Yoga Layout docs, the default value is 1 no matter of platform - https://yogalayout.com/docs/flex/.

Also I was not able to find the code altering this value in Yoga (https://github.com/facebook/yoga/search?p=1&q=flexshrink), nor React Native (https://github.com/facebook/react-native/search?p=1&q=flexshrink) source.

Can you provide the link to the source or place where this discrepancy can bee seen?

@Titozzz
Copy link
Contributor Author

Titozzz commented Feb 1, 2021

https://github.com/facebook/react-native/blob/6e6443afd04a847ef23fb6254a84e48c70b45896/ReactCommon/yoga/yoga/Yoga-internal.h#L143

you can see that even react native web uses this default: https://snack.expo.io/EsBsku4O0

@Titozzz
Copy link
Contributor Author

Titozzz commented Feb 1, 2021

But I do agree that all the docs say it's 1 which is why it's confusing

Copy link
Collaborator

@Simek Simek left a comment

Choose a reason for hiding this comment

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

Thank you so much for investigating this, providing a fix and linking the source code! 👍

@jzxchiang1
Copy link
Contributor

This is not complete...

Forgot to update https://reactnative.dev/docs/layout-props#flexshrink

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants