-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix full-screen bottom sheet animations #34425
Conversation
Focus of the URL text input caused animation stutter while the iOS keyboard visibility toggled from hide to show to hide. To address this, the Android-specific keyboard dismiss logic is now applied to iOS as well.
The `layout` conditional was removed in https://git.io/JEDdk, as it is no longer utilized. However, its prior presence was universally disabling the block it guarded. Removing the always falsey conditional caused the block to always run and break the Android animation. Specifically, when navigating from a full-screen bottom sheet to a non-full-screen bottom sheet, the `currentHeight` is always `1`. This results in setting the height without layout animations prior to this change.
Size Change: 0 B Total Size: 1.04 MB ℹ️ View Unchanged
|
if ( currentHeight === 1 ) { | ||
setCurrentHeight( height ); | ||
} else if ( animate ) { | ||
if ( animate ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My interpretation of the original intent of this code is to avoid animating setting the height during the initial layout. However, it was erroneously applied when navigating away from full-screen bottom sheets. Removing it resolves this issue.
From my testing, the non-animation setting was used when a block settings is first opened, but I am unable to perceive a difference with or without its presence.
<View onLayout={ onLayout }>{ children }</View> | ||
<View | ||
onLayout={ onLayout } | ||
testID={ `navigation-screen-${ name }` } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is an element with no user-facing identifier, a testID
was required to query the element.
if ( Platform.OS === 'android' ) { | ||
Keyboard.dismiss(); | ||
delay( () => { | ||
navigation.navigate( linkSettingsScreens.settings, { | ||
inputValue: url, | ||
text: title, | ||
} ); | ||
}, 100 ); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My presumption is that this conditional logic was placed to improve animations on Android at some point. It would appear similar logic is now beneficial for iOS as well.
...mponents/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js
Outdated
Show resolved
Hide resolved
Closing this PR as most of the changes in this PR were included in #36328 to resolve similar issues, e.g. 2a8d738, 134470f. We should likely retest at some point and further address wordpress-mobile/gutenberg-mobile#3883. |
Related PRs
Description
Fixes wordpress-mobile/gutenberg-mobile#3883.
For iOS, the Link Picker now dismisses iOS keyboard to ensure smooth animation. Focus of the URL text input caused animation stutter while the iOS keyboard visibility toggled from hide to show to hide. To address this, the Android-specific keyboard dismiss logic is now applied to iOS as well.
For Android, animations have been reintroduced for full-screen bottom sheets. The
layout
conditional was removed in #28632, as it is no longer utilized. However, its prior presence was universally disabling the block it guarded. Removing the always falsey conditional caused the block to always run and break the Android animation.Specifically, when navigating from a full-screen bottom sheet to a non-full-screen bottom sheet, the
currentHeight
is always1
. This results in setting the height without layout animations prior to this change.How has this been tested?
Link Picker
Button Background
Screenshots
iOS Before
ios-before.MP4
iOS After
ios-after.MP4
Android Before
android-before.mp4
Android After
android-after.mp4
Types of changes
Bug fix
Checklist:
*.native.js
files for terms that need renaming or removal).