Skip to content

Commit 4a4b2a3

Browse files
authored
KeyboardAwareInsetsView - add 'offset' prop (#3022)
* KeyboardAwareInsetsView - add 'offset' prop to control the offset of the pushed content * set offset default * missing semicolon * connectionStatusBar - fails on optional dep * remove change * change interface to type
1 parent ca63fa1 commit 4a4b2a3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/components/Keyboard/KeyboardTracking/KeyboardAwareInsetsView.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@ import React from 'react';
22
import {StyleSheet, Dimensions} from 'react-native';
33
import KeyboardTrackingView, {KeyboardTrackingViewProps} from './KeyboardTrackingView';
44

5+
type Props = KeyboardTrackingViewProps & {
6+
offset?: number;
7+
}
58
/**
69
* @description: Used to add an inset when a keyboard is used and might hide part of the screen.
710
*
811
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/TextFieldScreen/InputsScreen.js
912
* @notes: This view is useful only for iOS.
1013
*/
11-
const KeyboardAwareInsetsView = (props: KeyboardTrackingViewProps) => (
12-
<KeyboardTrackingView {...props} pointerEvents={'none'} style={styles.insetsView} scrollToFocusedInput/>
13-
);
14+
const KeyboardAwareInsetsView = (props: Props) => {
15+
const {offset = 0.5, ...others} = props;
16+
return <KeyboardTrackingView {...others} pointerEvents={'none'} style={[styles.insetsView, {height: offset}]} scrollToFocusedInput/>;
17+
};
1418

1519
const ScreenSize = Dimensions.get('window');
1620
const styles = StyleSheet.create({

0 commit comments

Comments
 (0)