-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
feat: flex gap bindings #34974
feat: flex gap bindings #34974
Conversation
Base commit: 08dafd8 |
Base commit: 45db65b |
Thank you for putting this together. It looks solid to me on first glance, but I want to take a closer look early next week. On the last PR I mentioned a concern over how this change intersects with the way React Native passes style properties to native components. They are flattened, so Shadow Nodes are given "gap" instead of "style.gap". So these properties are in a top level namespace shared with any native component a project or library might have added. I really want to see this change merged, and have been thinking about how we might be able to handle the issue. I have two trains of thought on how we might be able to do that.
|
@NickGerleman You're completely correct that this will impact poorly written existing code. I had a look at GH search, FluentUI, near-mobile-wallet, and topotal/js-sdk were responsible for most results - and their implementations will work. I did find three places (1, 2 & 3) where these properties are set on RN components directly, so do hit the case you mentioned. The last two actually won't have an impact due to scrollviews having a single container child - but that's just by chance. I worry that if we look into adding namespacing, this PR will never get merged. Maybe we could add some checks on Let me know what you think of that solution! |
For the breaks you pointed out are where Just to clarify, for the first paragraph, were these hits the case where a native component allows |
@NickGerleman makes sense. Should it be fine as long as these libraries are able to migrate maybe by not using One more suggestion could be to write a script that checks if a native view is using
We can do this, although libraries like styled-components pass it in style prop so it won't cover if it's leaked from there. But I feel this case is more like a refactor on the user end. Something that was not working now works (but I could be wrong! 😅) |
@NickGerleman No - they were JS-only components. They'd just do For the native components where they wish to take a top-level @intergalacticspacehighway just to clarify - I was proposing adding the checks in View.js |
I am going to try to test the behavior of having conflicting props in the inheritance chain today, and if it results in either build errors, runtime errors, or if there is a given precedence. Build errors are fine, and I think it would also be effectively fine (but smelly) if props are set for both the native component and yoga node, since After this change I do really want to take a closer look at name-spacing. Ideally we wouldn't have to reason about all of these edge cases. |
@NickGerleman I had a look on GitHub and couldn't find any instances of a native component having a |
Ah sorry, I think I misinterpreted your earlier message. I think we're probably fine to go on that front then. For the scenario where folks are passing a bunch of extra props to I looked through the PR and everything looks good. So, we should be ready to import after:
|
@NickGerleman I was proposing we add something like this. There were a few examples of people over-setting properties. But to be honest, it might be easier to just ping them and let them know - rather than go through all the rigmarole of adding these checks, then deleting them later |
@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
It looks like this change is causing a test to fail internally, but is otherwise approved. Root causing that, then we should be able to merge. |
This pull request was successfully merged by @intergalacticspacehighway in 9f3a3e1. When will my fix make it into a release? | Upcoming Releases |
Soooo close. Please release 0.71.0 with |
Summary: Missed while reviewing #34974 that flex gap props in Flow typings were added to ShadowStyle instead of LayoutStyle (directly above). The same issue is not present in the TS typings. Changelog: [General][Fixed] - Move flex gap props to the correct type Reviewed By: yungsters Differential Revision: D41736652 fbshipit-source-id: de0db1676464fbd962b2c7e7e9ef62b795332f1b
Summary: This PR adds React native binding for facebook/yoga#1116 ## Changelog [General] [Added] - Flex gap yoga bindings <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> Pull Request resolved: facebook#34974 Test Plan: Run rn tester app and go to view example. You'll find a flex gap example. Example location - `packages/rn-tester/js/examples/View/ViewExample.js` ### Tested on - [x] iOS Fabric - [x] iOS non-fabric - [x] Android Fabric - [x] Android non-fabric To test on non-fabric Android, I just switched these booleans. Let me know if there's anything else I might have missed. <img width="674" alt="Screenshot 2022-10-14 at 3 30 48 AM" src="https://user-images.githubusercontent.com/23293248/195718971-7aee4e7e-dbf0-4452-9d47-7925919c61dc.png"> Reviewed By: mdvacca Differential Revision: D40527474 Pulled By: NickGerleman fbshipit-source-id: 81c2c97c76f58fad3bb40fb378aaf8b6ebd30d63
Summary: Missed while reviewing facebook#34974 that flex gap props in Flow typings were added to ShadowStyle instead of LayoutStyle (directly above). The same issue is not present in the TS typings. Changelog: [General][Fixed] - Move flex gap props to the correct type Reviewed By: yungsters Differential Revision: D41736652 fbshipit-source-id: de0db1676464fbd962b2c7e7e9ef62b795332f1b
Summary
This PR adds React native binding for facebook/yoga#1116
Changelog
[General] [Added] - Flex gap yoga bindings
Test Plan
Run rn tester app and go to view example. You'll find a flex gap example. Example location -
packages/rn-tester/js/examples/View/ViewExample.js
Tested on
To test on non-fabric Android, I just switched these booleans. Let me know if there's anything else I might have missed.