@momo-kits/foundation 0.161.2-beta.17 → 0.161.2-beta.18
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.
- package/Application/NavigationContainer.tsx +18 -15
- package/Layout/Screen.tsx +7 -52
- package/package.json +2 -1
|
@@ -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
|
-
<
|
|
60
|
-
<
|
|
61
|
-
<
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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,38 +201,12 @@ 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
|
|
|
234
|
-
|
|
235
|
-
let keyboardOffset = heightHeader - bottomInset;
|
|
207
|
+
let keyboardOffset = heightHeader - Math.min(insets.bottom, 21);
|
|
236
208
|
if (headerType === 'extended' || animatedHeader || inputSearchProps) {
|
|
237
|
-
keyboardOffset = -
|
|
209
|
+
keyboardOffset = -Math.min(insets.bottom, 21);
|
|
238
210
|
}
|
|
239
211
|
|
|
240
212
|
/**
|
|
@@ -614,25 +586,13 @@ const Screen = forwardRef(
|
|
|
614
586
|
/>
|
|
615
587
|
|
|
616
588
|
<KeyboardAvoidingView
|
|
617
|
-
|
|
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
|
-
]}
|
|
589
|
+
style={Styles.flex}
|
|
629
590
|
enabled={enableKeyboardAvoidingView}
|
|
630
591
|
keyboardVerticalOffset={keyboardVerticalOffset ?? keyboardOffset}
|
|
631
592
|
behavior={Platform.select({
|
|
632
593
|
ios: 'padding',
|
|
633
|
-
android:
|
|
594
|
+
android: 'padding',
|
|
634
595
|
})}
|
|
635
|
-
// AI-GENERATED END: Android tự đẩy bằng keyboardHeight
|
|
636
596
|
>
|
|
637
597
|
{Header}
|
|
638
598
|
|
|
@@ -656,7 +616,7 @@ const Screen = forwardRef(
|
|
|
656
616
|
{...floatingButtonProps}
|
|
657
617
|
animatedValue={animatedValue.current}
|
|
658
618
|
bottom={
|
|
659
|
-
Footer || isTab ? 12 :
|
|
619
|
+
Footer || isTab ? 12 : Math.min(insets.bottom, 21) + Spacing.S
|
|
660
620
|
}
|
|
661
621
|
/>
|
|
662
622
|
</View>
|
|
@@ -667,12 +627,7 @@ const Screen = forwardRef(
|
|
|
667
627
|
style={[
|
|
668
628
|
styles.shadow,
|
|
669
629
|
{
|
|
670
|
-
|
|
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
|
|
630
|
+
paddingBottom: Math.min(insets.bottom, 21) + Spacing.S,
|
|
676
631
|
backgroundColor: theme.colors.background.surface,
|
|
677
632
|
},
|
|
678
633
|
]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.161.2-beta.
|
|
3
|
+
"version": "0.161.2-beta.18",
|
|
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",
|