@momo-kits/foundation 0.115.2-beta.10 → 0.115.2-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,9 @@ import {Text} from '../Text';
18
18
  import {Icon} from '../Icon';
19
19
  import {useHeaderHeight} from '@react-navigation/stack';
20
20
  import Animated, {Easing, Extrapolate} from 'react-native-reanimated';
21
+ import {Keyboard, LayoutAnimation} from 'react-native';
22
+ import {useState} from 'react';
23
+ import {ScrollView} from 'react-native-gesture-handler';
21
24
 
22
25
  const BottomSheet: React.FC<BottomSheetParams> = props => {
23
26
  const {theme, navigator} = useContext(ApplicationContext);
@@ -26,6 +29,26 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
26
29
  const insets = useSafeAreaInsets();
27
30
  const heightHeader = useHeaderHeight();
28
31
  const keyboardOffset = heightHeader - Math.min(insets.bottom, 21);
32
+ const [keyboardHeight, setKeyboardHeight] = useState(0);
33
+
34
+ useEffect(() => {
35
+ const onKeyboardShow = (e: any) => {
36
+ LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
37
+ setKeyboardHeight(e.endCoordinates.height);
38
+ };
39
+ const onKeyboardHide = () => {
40
+ LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
41
+ setKeyboardHeight(0);
42
+ };
43
+
44
+ const showSub = Keyboard.addListener('keyboardDidShow', onKeyboardShow);
45
+ const hideSub = Keyboard.addListener('keyboardDidHide', onKeyboardHide);
46
+
47
+ return () => {
48
+ showSub.remove();
49
+ hideSub.remove();
50
+ };
51
+ }, []);
29
52
 
30
53
  const {
31
54
  screen: Screen,
@@ -216,9 +239,14 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
216
239
  <Animated.View
217
240
  style={{
218
241
  transform: [{translateY}],
242
+ maxHeight: keyboardHeight > 0 ? heightDevice / 2 : undefined,
219
243
  }}>
220
244
  {renderHeader()}
221
- <View style={{backgroundColor: backgroundColor}}>
245
+ <ScrollView
246
+ scrollEnabled={keyboardHeight > 0 ? true : false}
247
+ keyboardShouldPersistTaps="handled"
248
+ contentContainerStyle={{flexGrow: 1}}
249
+ style={{backgroundColor: backgroundColor}}>
222
250
  <Screen
223
251
  {...props}
224
252
  {...props.route.params}
@@ -227,7 +255,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
227
255
  {useBottomInset && (
228
256
  <View style={{height: Math.min(insets.bottom, 21)}} />
229
257
  )}
230
- </View>
258
+ </ScrollView>
231
259
  </Animated.View>
232
260
  </KeyboardAvoidingView>
233
261
  </Container>
@@ -50,7 +50,6 @@ const HeaderRight: React.FC<any> = props => {
50
50
  const HeaderToolkitAction: React.FC<any> = ({
51
51
  tintColor,
52
52
  preventClose,
53
- useSystemTools = true,
54
53
  useShortcut = false,
55
54
  useMore = false,
56
55
  tools = [],
@@ -199,7 +198,6 @@ const HeaderToolkitAction: React.FC<any> = ({
199
198
  navigator?.maxApi?.dispatchFunction?.(
200
199
  'showTools',
201
200
  {
202
- useSystemTools,
203
201
  tools,
204
202
  context,
205
203
  },
@@ -98,7 +98,6 @@ export type Tool = {
98
98
  name: {vi: string; en: string};
99
99
  key: string;
100
100
  showBadge?: boolean;
101
- showRightIcon?: boolean;
102
101
  onPress: () => void;
103
102
  };
104
103
 
@@ -97,10 +97,10 @@ const InputMoney = forwardRef(
97
97
  };
98
98
 
99
99
  const onClearText = () => {
100
+ inputRef?.current?.clear();
100
101
  setDisplayValue('');
101
102
  setNumericValue('');
102
103
  onChangeText?.('');
103
- inputRef?.current?.focus();
104
104
  };
105
105
 
106
106
  const _onChangeText = (text: string) => {
@@ -113,7 +113,8 @@ const InputMoney = forwardRef(
113
113
 
114
114
  if (text.length < lastDisplayValue.length) {
115
115
  const lastChar = lastDisplayValue.charAt(lastDisplayValue.length - 1);
116
- const isRemovingCurrency = lastDisplayValue.endsWith(currency) || lastChar === ' ';
116
+ const isRemovingCurrency =
117
+ lastDisplayValue.endsWith(currency) || lastChar === ' ';
117
118
  const isRemovingDot = lastChar === '.';
118
119
 
119
120
  if (isRemovingCurrency || isRemovingDot) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.115.2-beta.10",
3
+ "version": "0.115.2-beta.12",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},