fix(ios/fabric): stop overriding JS width in Yoga layout#1036
Open
Scr3nt wants to merge 2 commits intoreact-native-datetimepicker:masterfrom
Open
fix(ios/fabric): stop overriding JS width in Yoga layout#1036Scr3nt wants to merge 2 commits intoreact-native-datetimepicker:masterfrom
Scr3nt wants to merge 2 commits intoreact-native-datetimepicker:masterfrom
Conversation
The `adopt` method in `ComponentDescriptors.h` called `setSize()` with both width and height from `sizeThatFits:UILayoutFittingCompressedSize`. Because `UIDatePicker` has a native minimum width of 280pt, this forced a fixed width on the Yoga node, overriding any JS style such as `width: "100%"`. Only set the **height** from the native measurement and let the JS side control the width through regular Yoga styles. Adds `setMeasuredHeight()` to `RNDateTimePickerShadowNode` which sets only `yoga::Dimension::Height` on the Yoga node style, leaving the width dimension untouched. Fixes react-native-datetimepicker#1014
Author
|
I made the fix and tested all modes. |
|
Thank you fix!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
The
adoptmethod inComponentDescriptors.hcallssetSize()with both width and height fromsizeThatFits:UILayoutFittingCompressedSize. BecauseUIDatePickerhas a native minimum width of 280pt, this forces a fixed width on the Yoga node, overriding any JS style such aswidth: "100%".This PR changes the native layout code to only set the height from the native measurement, letting the JS side control the width through regular Yoga styles.
Changes
ShadowNodes.h: AddsetMeasuredHeight(float)method that only setsyoga::Dimension::Heighton the Yoga node style, leaving the width untouchedComponentDescriptors.h: ReplacesetSize()call withsetMeasuredHeight()in theadoptmethodBefore / After
Fixes #1014