Skip to content
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

Ui behaves inconsistently across platforms. Some are against RN spec. #2498

Closed
1 task done
aliveornot opened this issue Mar 20, 2023 · 5 comments
Closed
1 task done
Labels

Comments

@aliveornot
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the issue

Hi, thanks a lot for this great project! I found some inconsistency across platforms. It would be so much better if the basic UI components behave exactly the same across platforms.

  1. <Text/> element default prop issue: The <Text/> element has position: 'static' as a default prop, which is against React Native specification.

  2. flexDirection and position properties inconsistency: If a parent element has flexDirection: 'row-reverse' or flexDirection: 'column-reverse', the left, right, top, bottom, start, and end properties behave differently(opposite way) on Android/iOS compared to web.

  3. <Text/> component style inheritance: The <Text/> component should not inherit styles from its parent elements, but it does on web platform.

Expected behavior

  1. <Text /> should have position: 'relative' as default
  2. If a component is a child component of a component with flexDirection: 'something-reverse', then 'left', 'right', 'top', 'bottom', 'start', 'end' should behave the opposit way.
  3. An outermost <Text /> should not inherit styles from its parents

Steps to reproduce

I created a github repo to demonstrate these:
https://github.com/aliveornot/rn-ui-consistency

Test case

https://codesandbox.io/s/quizzical-hill-x6hgi7?file=/src/App.js

Additional comments

No response

@aliveornot aliveornot added the bug label Mar 20, 2023
@necolas
Copy link
Owner

necolas commented Mar 20, 2023

2 is a bug in React Native not web.

3 is only true for text-align, not all text style inheritance.

And 1 is easy to change. But you're incorrect in saying static is not supported in RN because it is.

@aliveornot
Copy link
Author

Thanks for your fast response.

But I'm afraid your response to 1 is not true, the official doc says position is enum('absolute', 'relative')
https://reactnative.dev/docs/layout-props#position

And about 2, yeah it kinda sounds right. I expected the RNW behaviour and got surprised when I realized ios/aos behaved the other way.

@necolas
Copy link
Owner

necolas commented Mar 20, 2023

The docs are out of date / missing info https://snack.expo.dev/5Lpci2KAd

@necolas necolas added this to the 0.19: React 18 milestone Mar 20, 2023
necolas added a commit that referenced this issue Mar 20, 2023
Match default Text rendering in React Native.

Fix #2498
necolas added a commit that referenced this issue Mar 20, 2023
Set textAlign on the default Text element. Prevents inheritance of
textAlign set on a parent View.

Fix #2498
@necolas
Copy link
Owner

necolas commented Mar 20, 2023

Thanks for the clear issue and your attention to detail in finding these issues.

1 & 3 should be fixed by the latest canary release: https://codesandbox.io/s/muddy-frog-o4pkid

Please let me know if you encounter any more issues

@aliveornot
Copy link
Author

Wow that was fast, THANKS A LOT!!!

Yes I surely will, and have been always admiring your work. Thanks again!

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

No branches or pull requests

2 participants