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

Fix LinkPicker freeze when virtual keyboard is hidden #37782

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/components/src/mobile/bottom-sheet/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,10 @@ class BottomSheet extends Component {
const { height } = nativeEvent.layout;
// The layout animation should only be triggered if the header
// height has changed after being mounted.
if ( this.headerHeight !== 0 && height !== this.headerHeight ) {
if (
this.headerHeight !== 0 &&
Math.round( height ) !== Math.round( this.headerHeight )
) {
this.performRegularLayoutAnimation( {
useLastLayoutAnimation: true,
} );
Expand Down Expand Up @@ -551,6 +554,7 @@ class BottomSheet extends Component {
<View
style={ styles.header }
onLayout={ this.onHeaderLayout }
testID={ `${ rest.testID || 'bottom-sheet' }-header` }
>
{ showDragIndicator() && (
<View style={ styles.dragIndicator } />
Expand Down
24 changes: 24 additions & 0 deletions packages/components/src/mobile/bottom-sheet/test/index.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* External dependencies
*/
import { fireEvent, render } from 'test/helpers';
import { LayoutAnimation } from 'react-native';

/**
* Internal dependencies
*/
import BottomSheet from '../';

it( 'does not animate transitions between header heights differing less than 1 pixel', () => {
const screen = render( <BottomSheet isVisible /> );

const bottomSheetHeader = screen.getByTestId( 'bottom-sheet-header' );
fireEvent( bottomSheetHeader, 'layout', {
nativeEvent: { layout: { height: 123 } },
} );
fireEvent( bottomSheetHeader, 'layout', {
nativeEvent: { layout: { height: 123.001 } },
} );

expect( LayoutAnimation.configureNext ).not.toHaveBeenCalled();
} );