@momo-kits/foundation 0.161.2-beta.17 → 0.161.2-beta.19

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.
@@ -26,6 +26,7 @@ import { HeaderLeft } from './Components/HeaderLeft';
26
26
  import { HeaderRight } from './Components/HeaderRight';
27
27
  import { HeaderTitle } from './Components/HeaderTitle';
28
28
  import { HeaderBackground } from './Components/HeaderBackground';
29
+ import { KeyboardProvider } from 'react-native-keyboard-controller';
29
30
 
30
31
  const Stack = createStackNavigator();
31
32
 
@@ -56,21 +57,23 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
56
57
  };
57
58
 
58
59
  return (
59
- <SafeAreaProvider>
60
- <MiniAppContext.Provider value={mergedContext}>
61
- <ScaleSizeProvider scaleSizeMaxRate={mergedContext?.scaleSizeMaxRate}>
62
- <Navigation
63
- screen={screen}
64
- theme={theme}
65
- options={options}
66
- maxApi={maxApi}
67
- setCurrentContext={setCurrentContext}
68
- initialParams={initialParams}
69
- localize={localize}
70
- />
71
- </ScaleSizeProvider>
72
- </MiniAppContext.Provider>
73
- </SafeAreaProvider>
60
+ <KeyboardProvider>
61
+ <SafeAreaProvider>
62
+ <MiniAppContext.Provider value={mergedContext}>
63
+ <ScaleSizeProvider scaleSizeMaxRate={mergedContext?.scaleSizeMaxRate}>
64
+ <Navigation
65
+ screen={screen}
66
+ theme={theme}
67
+ options={options}
68
+ maxApi={maxApi}
69
+ setCurrentContext={setCurrentContext}
70
+ initialParams={initialParams}
71
+ localize={localize}
72
+ />
73
+ </ScaleSizeProvider>
74
+ </MiniAppContext.Provider>
75
+ </SafeAreaProvider>
76
+ </KeyboardProvider>
74
77
  );
75
78
  };
76
79
 
package/Layout/Screen.tsx CHANGED
@@ -10,12 +10,9 @@ import React, {
10
10
  useEffect,
11
11
  useImperativeHandle,
12
12
  useRef,
13
- useState,
14
13
  } from 'react';
15
14
  import {
16
15
  Animated,
17
- Keyboard,
18
- KeyboardAvoidingView,
19
16
  NativeScrollEvent,
20
17
  NativeSyntheticEvent,
21
18
  Platform,
@@ -27,6 +24,7 @@ import {
27
24
  View,
28
25
  ViewProps,
29
26
  } from 'react-native';
27
+ import { KeyboardAvoidingView } from "react-native-keyboard-controller";
30
28
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
31
29
  import { ApplicationContext, ScreenContext } from '../Context';
32
30
  import Navigation from '../Application/Navigation';
@@ -203,31 +201,6 @@ const Screen = forwardRef(
203
201
  const currentTint = useRef<string | undefined>(undefined);
204
202
  const isTab = navigation?.instance?.getState?.()?.type === 'tab';
205
203
 
206
- // AI-GENERATED START: track keyboard height (Android tự đẩy; footer bỏ safe-area khi hiện)
207
- const [keyboardHeight, setKeyboardHeight] = useState(0);
208
- const isKeyboardVisible = keyboardHeight > 0;
209
- // Chỉ can thiệp trên Android 16+ (API 36): edge-to-edge -> window KHÔNG resize cho bàn phím.
210
- // Android <16 (window tự resize) và iOS giữ NGUYÊN behavior cũ -> không impact.
211
- const useManualKeyboardAvoid =
212
- Platform.OS === 'android' &&
213
- Number(Platform.Version) >= 36 &&
214
- enableKeyboardAvoidingView;
215
- useEffect(() => {
216
- const showEvent =
217
- Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
218
- const hideEvent =
219
- Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';
220
- const showSub = Keyboard.addListener(showEvent, e =>
221
- setKeyboardHeight(e.endCoordinates?.height ?? 0),
222
- );
223
- const hideSub = Keyboard.addListener(hideEvent, () => setKeyboardHeight(0));
224
- return () => {
225
- showSub.remove();
226
- hideSub.remove();
227
- };
228
- }, []);
229
- // AI-GENERATED END: track keyboard height
230
-
231
204
  let handleScroll;
232
205
  let Component: any = View;
233
206
 
@@ -614,25 +587,13 @@ const Screen = forwardRef(
614
587
  />
615
588
 
616
589
  <KeyboardAvoidingView
617
- // AI-GENERATED START: Android tự đẩy bằng keyboardHeight (KAV behavior để lại padding dư)
618
- style={[
619
- Styles.flex,
620
- // height (Android) chưa gồm nav bar -> cộng insets.bottom để đẩy đủ qua bàn phím
621
- useManualKeyboardAvoid
622
- ? {
623
- paddingBottom: isKeyboardVisible
624
- ? keyboardHeight + insets.bottom
625
- : 0,
626
- }
627
- : null,
628
- ]}
590
+ style={Styles.flex}
629
591
  enabled={enableKeyboardAvoidingView}
630
592
  keyboardVerticalOffset={keyboardVerticalOffset ?? keyboardOffset}
631
593
  behavior={Platform.select({
632
594
  ios: 'padding',
633
- android: undefined,
595
+ android: 'padding',
634
596
  })}
635
- // AI-GENERATED END: Android tự đẩy bằng keyboardHeight
636
597
  >
637
598
  {Header}
638
599
 
@@ -667,12 +628,7 @@ const Screen = forwardRef(
667
628
  style={[
668
629
  styles.shadow,
669
630
  {
670
- // AI-GENERATED START: bàn phím hiện -> bỏ safe-area, chỉ chừa Spacing.S (như StackScreen)
671
- paddingBottom:
672
- (isKeyboardVisible && useManualKeyboardAvoid
673
- ? 0
674
- : bottomInset) + Spacing.S,
675
- // AI-GENERATED END: bàn phím hiện -> bỏ safe-area, chỉ chừa Spacing.S
631
+ paddingBottom: bottomInset + Spacing.S,
676
632
  backgroundColor: theme.colors.background.surface,
677
633
  },
678
634
  ]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.161.2-beta.17",
3
+ "version": "0.161.2-beta.19",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},
@@ -16,6 +16,7 @@
16
16
  "@react-navigation/routers": "7.4.1",
17
17
  "@react-navigation/stack": "7.4.2",
18
18
  "react-native-gesture-handler": "2.27.1",
19
+ "react-native-keyboard-controller": "1.21.11",
19
20
  "react-native-linear-gradient": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-linear-gradient#v3.0.0",
20
21
  "react-native-reanimated": "4.2.2",
21
22
  "react-native-safe-area-context": "5.5.2",