Skip to content

Commit

Permalink
Merge pull request #42127 from bernhardoj/fix/41855-footer-button-mov…
Browse files Browse the repository at this point in the history
…es-up-down

Fix footer moves down and up a bit when keyboard show/close
  • Loading branch information
yuwenmemon committed May 14, 2024
2 parents ce4939c + eff393a commit 1344b08
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/components/FixedFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type {ReactNode} from 'react';
import React from 'react';
import type {StyleProp, ViewStyle} from 'react-native';
import {View} from 'react-native';
import useKeyboardState from '@hooks/useKeyboardState';
import useSafeAreaInsets from '@hooks/useSafeAreaInsets';
import useThemeStyles from '@hooks/useThemeStyles';

Expand All @@ -15,15 +14,14 @@ type FixedFooterProps = {
};

function FixedFooter({style, children}: FixedFooterProps) {
const {isKeyboardShown} = useKeyboardState();
const insets = useSafeAreaInsets();
const styles = useThemeStyles();

if (!children) {
return null;
}

const shouldAddBottomPadding = isKeyboardShown || !insets.bottom;
const shouldAddBottomPadding = !insets.bottom;

return <View style={[styles.ph5, shouldAddBottomPadding && styles.pb5, styles.flexShrink0, style]}>{children}</View>;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ function BaseSelectionList<TItem extends ListItem>(
return (
<SafeAreaConsumer>
{({safeAreaPaddingBottomStyle}) => (
<View style={[styles.flex1, !isKeyboardShown && safeAreaPaddingBottomStyle, containerStyle]}>
<View style={[styles.flex1, (!isKeyboardShown || !!footerContent || showConfirmButton) && safeAreaPaddingBottomStyle, containerStyle]}>
{shouldShowTextInput && (
<View style={[styles.ph4, styles.pb3]}>
<TextInput
Expand Down

0 comments on commit 1344b08

Please sign in to comment.