Fix Android removeClippedSubviews in horizontal ScrollView in RTL#45356
Closed
NickGerleman wants to merge 1 commit into
Closed
Fix Android removeClippedSubviews in horizontal ScrollView in RTL#45356NickGerleman wants to merge 1 commit into
NickGerleman wants to merge 1 commit into
Conversation
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D59566611 |
…cebook#45356) Summary: Pull Request resolved: facebook#45356 Subview clipping was disabled for RTL on Android due to a bug where TextInputs automatically blur when selected. This bug is reintroduced when `set_android_layout_direction` is set. When `set_android_layout_direction` is enabled, and we use View `getLayoutDirection()` instead of `I18nManager.isRTL()`, the layout direction is not known until mounting time. This defeats the check a `setRemoveClippedSubviews()` prop setter to ignore the prop if the view is RTL (since it doesn't invalidate when a new layout direction is set). The root cause of the underlying RTL bug is due to updating clipping status triggered by `onSizeChanged()`, which is called before `onLayout()`, where `ReactHorizontalScrollContainerView` offsets content in RTL. This also seems potentially erroneous, as we do not update the clipping rect on position change (unless that is handled elsewhere). I moved the check to `onLayout()`, called after ReactHorizontalScrollView will change metrics, which seems to fix the issue. I then removed the exclusion in `removeClippedSubviews` prop setter. Changelog: [Android][Fixed] - Fix Android removeClippedSubviews in RTL Differential Revision: D59566611
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D59566611 |
05c1406 to
b3525ff
Compare
Contributor
|
This pull request has been merged in ea6928f. |
|
This pull request was successfully merged by @NickGerleman in ea6928f. When will my fix make it into a release? | How to file a pick request? |
Contributor
|
This pull request has been reverted by d68a177. |
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:
Subview clipping was disabled for RTL on Android due to a bug where TextInputs automatically blur when selected. This bug is reintroduced when
set_android_layout_directionis set.When
set_android_layout_directionis enabled, and we use ViewgetLayoutDirection()instead ofI18nManager.isRTL(), the layout direction is not known until mounting time. This defeats the check asetRemoveClippedSubviews()prop setter to ignore the prop if the view is RTL (since it doesn't invalidate when a new layout direction is set).The root cause of the underlying RTL bug is due to updating clipping status triggered by
onSizeChanged(), which is called beforeonLayout(), whereReactHorizontalScrollContainerViewoffsets content in RTL. This also seems potentially erroneous, as we do not update the clipping rect on position change (unless that is handled elsewhere).I moved the check to
onLayout(), called after ReactHorizontalScrollView will change metrics, which seems to fix the issue. I then removed the exclusion inremoveClippedSubviewsprop setter.Changelog:
[Android][Fixed] - Fix Android removeClippedSubviews in RTL
Differential Revision: D59566611