@momo-kits/foundation 0.164.1-beta.10 → 0.164.1-beta.11
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/BottomTab/index.tsx +2 -2
- package/Application/utils.tsx +22 -47
- package/package.json +1 -1
|
@@ -153,7 +153,7 @@ const TabScreen: React.FC<any> = ({ route, navigation }) => {
|
|
|
153
153
|
initialParams,
|
|
154
154
|
bottomTab: 'nested',
|
|
155
155
|
}}
|
|
156
|
-
options={{ ...getStackOptions({
|
|
156
|
+
options={{ ...getStackOptions({ gestureEnabled: false }) }}
|
|
157
157
|
/>
|
|
158
158
|
</Stack.Navigator>
|
|
159
159
|
</Animated.View>
|
|
@@ -188,7 +188,7 @@ const TabScreen: React.FC<any> = ({ route, navigation }) => {
|
|
|
188
188
|
initialParams,
|
|
189
189
|
bottomTab: 'default',
|
|
190
190
|
}}
|
|
191
|
-
options={{ ...getStackOptions({
|
|
191
|
+
options={{ ...getStackOptions({ gestureEnabled: false }), ...options }}
|
|
192
192
|
/>
|
|
193
193
|
</Stack.Navigator>
|
|
194
194
|
</NavigationContainer>
|
package/Application/utils.tsx
CHANGED
|
@@ -59,9 +59,9 @@ const forStackTransitionWithOverlay = (
|
|
|
59
59
|
/**
|
|
60
60
|
* default options for stack screen
|
|
61
61
|
*/
|
|
62
|
-
const getStackOptions = (
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
const getStackOptions = (
|
|
63
|
+
options: StackNavigationOptions,
|
|
64
|
+
): StackNavigationOptions => {
|
|
65
65
|
const base: StackNavigationOptions = {
|
|
66
66
|
headerTitleAlign: 'left',
|
|
67
67
|
headerTitle: props => <HeaderTitle {...props} />,
|
|
@@ -80,24 +80,9 @@ const getStackOptions = ({
|
|
|
80
80
|
headerTintColor: Colors.black_17,
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
/**
|
|
84
|
-
* A bottom tab stack holds a single route, so the card transition never runs and
|
|
85
|
-
* `CardContainer` pins `gestureEnabled` to false at index 0 regardless. What does bite is
|
|
86
|
-
* `cardOverlayEnabled`: `current.progress` rests at 1, so the overlay would sit at its full
|
|
87
|
-
* 0.6 forever instead of only during a push, tinting any tab screen that paints no
|
|
88
|
-
* background of its own. This branch is the option set from before swipe back, unchanged.
|
|
89
|
-
*/
|
|
90
|
-
if (!swipeBack) {
|
|
91
|
-
return {
|
|
92
|
-
...base,
|
|
93
|
-
gestureEnabled: false,
|
|
94
|
-
...TransitionPresets.SlideFromRightIOS,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
83
|
return {
|
|
99
84
|
...base,
|
|
100
|
-
|
|
85
|
+
...options,
|
|
101
86
|
...TransitionPresets.SlideFromRightIOS,
|
|
102
87
|
cardStyleInterpolator: forStackTransitionWithOverlay,
|
|
103
88
|
cardOverlayEnabled: true,
|
|
@@ -332,36 +317,26 @@ const getStackDepth = (
|
|
|
332
317
|
const useNativeCanGoBack = () => {
|
|
333
318
|
const lastValue = useRef<boolean | undefined>(undefined);
|
|
334
319
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
if (typeof setCanGoBack !== 'function') {
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
lastValue.current = canDismiss;
|
|
346
|
-
try {
|
|
347
|
-
setCanGoBack(canDismiss);
|
|
348
|
-
} catch (error) {
|
|
349
|
-
console.warn('[NavigationContainer] setCanGoBack failed:', error);
|
|
350
|
-
}
|
|
351
|
-
}, []);
|
|
320
|
+
return useCallback(
|
|
321
|
+
(state?: NavigationState | PartialState<NavigationState>) => {
|
|
322
|
+
const canDismiss = getStackDepth(state) === 0;
|
|
323
|
+
if (lastValue.current === canDismiss) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
352
326
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
* Hand ownership back on the way out.
|
|
358
|
-
*/
|
|
359
|
-
useEffect(() => () => report(true), [report]);
|
|
327
|
+
const setCanGoBack = NativeModules?.MiniAppModule?.setCanGoBack;
|
|
328
|
+
if (typeof setCanGoBack !== 'function') {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
360
331
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
332
|
+
lastValue.current = canDismiss;
|
|
333
|
+
try {
|
|
334
|
+
setCanGoBack(canDismiss);
|
|
335
|
+
} catch (error) {
|
|
336
|
+
console.warn('[NavigationContainer] setCanGoBack failed:', error);
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
[],
|
|
365
340
|
);
|
|
366
341
|
};
|
|
367
342
|
|