Skip to content

Commit

Permalink
chore: fix safe area on keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagobrez committed Jul 5, 2023
1 parent 05da119 commit 35602db
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
13 changes: 10 additions & 3 deletions src/components/SelectionListRadio/BaseSelectionListRadio.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ import {propTypes as selectionListRadioPropTypes, defaultProps as selectionListR
import RadioListItem from './RadioListItem';
import useKeyboardShortcut from '../../hooks/useKeyboardShortcut';
import SafeAreaConsumer from '../SafeAreaConsumer';
import withKeyboardState, {keyboardStatePropTypes} from '../withKeyboardState';

const propTypes = {
...keyboardStatePropTypes,
...selectionListRadioPropTypes,
};

function BaseSelectionListRadio(props) {
const listRef = useRef(null);
Expand Down Expand Up @@ -209,7 +215,7 @@ function BaseSelectionListRadio(props) {
>
<SafeAreaConsumer>
{({safeAreaPaddingBottomStyle}) => (
<View style={[styles.flex1, props.hasSafeArea && !Keyboard.isVisible() && safeAreaPaddingBottomStyle]}>
<View style={[styles.flex1, !props.isKeyboardShown && safeAreaPaddingBottomStyle]}>
{shouldShowTextInput && (
<View style={[styles.ph5, styles.pv5]}>
<TextInput
Expand Down Expand Up @@ -241,6 +247,7 @@ function BaseSelectionListRadio(props) {
indicatorStyle="white"
keyboardShouldPersistTaps="always"
showsVerticalScrollIndicator={false}
OP
initialNumToRender={12}
maxToRenderPerBatch={5}
windowSize={5}
Expand All @@ -255,7 +262,7 @@ function BaseSelectionListRadio(props) {
}

BaseSelectionListRadio.displayName = 'BaseSelectionListRadio';
BaseSelectionListRadio.propTypes = selectionListRadioPropTypes;
BaseSelectionListRadio.propTypes = propTypes;
BaseSelectionListRadio.defaultProps = selectionListRadioDefaultProps;

export default BaseSelectionListRadio;
export default withKeyboardState(BaseSelectionListRadio);
1 change: 0 additions & 1 deletion src/components/SelectionListRadio/index.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const SelectionListRadio = forwardRef((props, ref) => (
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
ref={ref}
hasSafeArea
shouldDelayFocus
onScrollBeginDrag={() => Keyboard.dismiss()}
/>
Expand Down
1 change: 0 additions & 1 deletion src/components/SelectionListRadio/index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const SelectionListRadio = forwardRef((props, ref) => (
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
ref={ref}
hasSafeArea
onScrollBeginDrag={() => Keyboard.dismiss()}
/>
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ const propTypes = {

/** Message to display at the top of the list */
headerMessage: PropTypes.string,

/** Whether the list needs safe area padding. True on native */
hasSafeArea: PropTypes.bool,
};

const defaultProps = {
Expand All @@ -86,7 +83,6 @@ const defaultProps = {
onScroll: () => {},
onScrollBeginDrag: () => {},
headerMessage: '',
hasSafeArea: false,
};

export {propTypes, radioListItemPropTypes, defaultProps};

0 comments on commit 35602db

Please sign in to comment.