react-native-screens 4.0.0-beta.12 → 4.0.0-beta.14
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/README.md +3 -1
- package/android/CMakeLists.txt +28 -19
- package/android/src/main/java/com/swmansion/rnscreens/NativeDismissalObserver.kt +12 -0
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt +59 -84
- package/android/src/main/java/com/swmansion/rnscreens/bottomsheet/BottomSheetBehaviorExt.kt +42 -0
- package/android/src/main/java/com/swmansion/rnscreens/bottomsheet/DimmingFragment.kt +24 -19
- package/android/src/main/java/com/swmansion/rnscreens/bottomsheet/SheetUtils.kt +8 -0
- package/android/src/main/jni/CMakeLists.txt +28 -19
- package/ios/RNSConvert.h +13 -4
- package/ios/RNSConvert.mm +50 -28
- package/ios/RNSEnums.h +46 -0
- package/ios/RNSScreenStackHeaderConfig.h +1 -1
- package/ios/RNSScreenStackHeaderConfig.mm +30 -25
- package/lib/commonjs/components/FullWindowOverlay.js +8 -5
- package/lib/commonjs/components/FullWindowOverlay.js.map +1 -1
- package/lib/commonjs/components/Screen.js +28 -10
- package/lib/commonjs/components/Screen.js.map +1 -1
- package/lib/commonjs/components/ScreenContainer.js +3 -5
- package/lib/commonjs/components/ScreenContainer.js.map +1 -1
- package/lib/commonjs/components/ScreenContainer.web.js +3 -4
- package/lib/commonjs/components/ScreenContainer.web.js.map +1 -1
- package/lib/commonjs/components/ScreenContentWrapper.js +2 -4
- package/lib/commonjs/components/ScreenContentWrapper.js.map +1 -1
- package/lib/commonjs/components/ScreenContentWrapper.web.js +1 -2
- package/lib/commonjs/components/ScreenContentWrapper.web.js.map +1 -1
- package/lib/commonjs/components/ScreenFooter.js +2 -8
- package/lib/commonjs/components/ScreenFooter.js.map +1 -1
- package/lib/commonjs/components/ScreenFooter.web.js +1 -2
- package/lib/commonjs/components/ScreenFooter.web.js.map +1 -1
- package/lib/commonjs/components/ScreenStack.js +2 -2
- package/lib/commonjs/components/ScreenStack.js.map +1 -1
- package/lib/commonjs/components/ScreenStack.web.js +2 -1
- package/lib/commonjs/components/ScreenStack.web.js.map +1 -1
- package/lib/commonjs/components/SearchBar.js +5 -5
- package/lib/commonjs/components/SearchBar.js.map +1 -1
- package/lib/commonjs/components/SearchBar.web.js +3 -4
- package/lib/commonjs/components/SearchBar.web.js.map +1 -1
- package/lib/commonjs/core.js +0 -3
- package/lib/commonjs/core.js.map +1 -1
- package/lib/commonjs/fabric/ModalScreenNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/commonjs/gesture-handler/GestureDetectorProvider.js +2 -2
- package/lib/commonjs/gesture-handler/GestureDetectorProvider.js.map +1 -1
- package/lib/commonjs/index.js +14 -78
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js +4 -0
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/commonjs/native-stack/views/FooterComponent.js +2 -2
- package/lib/commonjs/native-stack/views/FooterComponent.js.map +1 -1
- package/lib/commonjs/native-stack/views/HeaderConfig.js +10 -8
- package/lib/commonjs/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/commonjs/native-stack/views/NativeStackView.js +12 -9
- package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js +2 -2
- package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedScreen.js +2 -2
- package/lib/commonjs/reanimated/ReanimatedScreen.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedScreenProvider.js +2 -2
- package/lib/commonjs/reanimated/ReanimatedScreenProvider.js.map +1 -1
- package/lib/commonjs/utils.js +28 -6
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/components/FullWindowOverlay.js +9 -6
- package/lib/module/components/FullWindowOverlay.js.map +1 -1
- package/lib/module/components/Screen.js +27 -9
- package/lib/module/components/Screen.js.map +1 -1
- package/lib/module/components/ScreenContainer.js +2 -4
- package/lib/module/components/ScreenContainer.js.map +1 -1
- package/lib/module/components/ScreenContainer.web.js +2 -3
- package/lib/module/components/ScreenContainer.web.js.map +1 -1
- package/lib/module/components/ScreenContentWrapper.js +1 -3
- package/lib/module/components/ScreenContentWrapper.js.map +1 -1
- package/lib/module/components/ScreenContentWrapper.web.js +0 -1
- package/lib/module/components/ScreenContentWrapper.web.js.map +1 -1
- package/lib/module/components/ScreenFooter.js +1 -7
- package/lib/module/components/ScreenFooter.js.map +1 -1
- package/lib/module/components/ScreenFooter.web.js +0 -1
- package/lib/module/components/ScreenFooter.web.js.map +1 -1
- package/lib/module/components/ScreenStack.js +1 -1
- package/lib/module/components/ScreenStack.js.map +1 -1
- package/lib/module/components/ScreenStack.web.js +2 -1
- package/lib/module/components/ScreenStack.web.js.map +1 -1
- package/lib/module/components/SearchBar.js +3 -3
- package/lib/module/components/SearchBar.js.map +1 -1
- package/lib/module/components/SearchBar.web.js +2 -3
- package/lib/module/components/SearchBar.web.js.map +1 -1
- package/lib/module/core.js +0 -3
- package/lib/module/core.js.map +1 -1
- package/lib/module/fabric/ModalScreenNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/module/gesture-handler/GestureDetectorProvider.js +1 -1
- package/lib/module/gesture-handler/GestureDetectorProvider.js.map +1 -1
- package/lib/module/index.js +8 -13
- package/lib/module/index.js.map +1 -1
- package/lib/module/native-stack/navigators/createNativeStackNavigator.js +4 -0
- package/lib/module/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/module/native-stack/views/FooterComponent.js +1 -1
- package/lib/module/native-stack/views/FooterComponent.js.map +1 -1
- package/lib/module/native-stack/views/HeaderConfig.js +3 -1
- package/lib/module/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/module/native-stack/views/NativeStackView.js +4 -1
- package/lib/module/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/module/reanimated/ReanimatedNativeStackScreen.js +1 -2
- package/lib/module/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
- package/lib/module/reanimated/ReanimatedScreen.js +1 -2
- package/lib/module/reanimated/ReanimatedScreen.js.map +1 -1
- package/lib/module/reanimated/ReanimatedScreenProvider.js +1 -1
- package/lib/module/reanimated/ReanimatedScreenProvider.js.map +1 -1
- package/lib/module/utils.js +26 -5
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/components/FullWindowOverlay.d.ts.map +1 -1
- package/lib/typescript/components/Screen.d.ts +2 -7
- package/lib/typescript/components/Screen.d.ts.map +1 -1
- package/lib/typescript/components/Screen.web.d.ts +1 -1
- package/lib/typescript/components/Screen.web.d.ts.map +1 -1
- package/lib/typescript/components/ScreenContainer.d.ts +1 -3
- package/lib/typescript/components/ScreenContainer.d.ts.map +1 -1
- package/lib/typescript/components/ScreenContainer.web.d.ts +2 -3
- package/lib/typescript/components/ScreenContainer.web.d.ts.map +1 -1
- package/lib/typescript/components/ScreenContentWrapper.d.ts +0 -1
- package/lib/typescript/components/ScreenContentWrapper.d.ts.map +1 -1
- package/lib/typescript/components/ScreenContentWrapper.web.d.ts +0 -1
- package/lib/typescript/components/ScreenContentWrapper.web.d.ts.map +1 -1
- package/lib/typescript/components/ScreenFooter.d.ts +0 -4
- package/lib/typescript/components/ScreenFooter.d.ts.map +1 -1
- package/lib/typescript/components/ScreenFooter.web.d.ts +0 -1
- package/lib/typescript/components/ScreenFooter.web.d.ts.map +1 -1
- package/lib/typescript/components/ScreenStack.d.ts +1 -1
- package/lib/typescript/components/ScreenStack.d.ts.map +1 -1
- package/lib/typescript/components/ScreenStack.web.d.ts +2 -1
- package/lib/typescript/components/ScreenStack.web.d.ts.map +1 -1
- package/lib/typescript/components/ScreenStackHeaderConfig.d.ts +1 -1
- package/lib/typescript/components/ScreenStackHeaderConfig.d.ts.map +1 -1
- package/lib/typescript/components/ScreenStackHeaderConfig.web.d.ts +1 -1
- package/lib/typescript/components/ScreenStackHeaderConfig.web.d.ts.map +1 -1
- package/lib/typescript/components/SearchBar.d.ts +1 -15
- package/lib/typescript/components/SearchBar.d.ts.map +1 -1
- package/lib/typescript/components/SearchBar.web.d.ts +2 -3
- package/lib/typescript/components/SearchBar.web.d.ts.map +1 -1
- package/lib/typescript/core.d.ts +0 -1
- package/lib/typescript/core.d.ts.map +1 -1
- package/lib/typescript/fabric/ModalScreenNativeComponent.d.ts +7 -1
- package/lib/typescript/fabric/ModalScreenNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/ScreenStackHeaderConfigNativeComponent.d.ts +2 -2
- package/lib/typescript/fabric/ScreenStackHeaderConfigNativeComponent.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +8 -12
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/native-stack/navigators/createNativeStackNavigator.d.ts +3 -0
- package/lib/typescript/native-stack/navigators/createNativeStackNavigator.d.ts.map +1 -1
- package/lib/typescript/native-stack/types.d.ts +49 -1
- package/lib/typescript/native-stack/types.d.ts.map +1 -1
- package/lib/typescript/native-stack/utils/getDefaultHeaderHeight.d.ts +1 -1
- package/lib/typescript/native-stack/utils/getDefaultHeaderHeight.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/HeaderConfig.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/NativeStackView.d.ts.map +1 -1
- package/lib/typescript/reanimated/ReanimatedNativeStackScreen.d.ts +1 -1
- package/lib/typescript/reanimated/ReanimatedNativeStackScreen.d.ts.map +1 -1
- package/lib/typescript/reanimated/ReanimatedScreen.d.ts +1 -1
- package/lib/typescript/reanimated/ReanimatedScreen.d.ts.map +1 -1
- package/lib/typescript/reanimated/ReanimatedScreenProvider.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +1 -1
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils.d.ts +26 -1
- package/lib/typescript/utils.d.ts.map +1 -1
- package/native-stack/README.md +2 -1
- package/native-stack/package.json +4 -4
- package/package.json +1 -1
- package/src/components/FullWindowOverlay.tsx +10 -2
- package/src/components/Screen.tsx +42 -25
- package/src/components/Screen.web.tsx +1 -1
- package/src/components/ScreenContainer.tsx +4 -11
- package/src/components/ScreenContainer.web.tsx +2 -3
- package/src/components/ScreenContentWrapper.tsx +2 -5
- package/src/components/ScreenContentWrapper.web.tsx +1 -2
- package/src/components/ScreenFooter.tsx +2 -8
- package/src/components/ScreenFooter.web.tsx +1 -2
- package/src/components/ScreenStack.tsx +2 -1
- package/src/components/ScreenStack.web.tsx +3 -1
- package/src/components/ScreenStackHeaderConfig.tsx +1 -1
- package/src/components/ScreenStackHeaderConfig.web.tsx +1 -1
- package/src/components/SearchBar.tsx +4 -7
- package/src/components/SearchBar.web.tsx +2 -3
- package/src/core.ts +0 -3
- package/src/fabric/ModalScreenNativeComponent.ts +9 -1
- package/src/fabric/ScreenStackHeaderConfigNativeComponent.ts +2 -1
- package/src/gesture-handler/GestureDetectorProvider.tsx +1 -1
- package/src/index.tsx +6 -32
- package/src/native-stack/navigators/createNativeStackNavigator.tsx +3 -0
- package/src/native-stack/types.tsx +50 -6
- package/src/native-stack/utils/getDefaultHeaderHeight.tsx +1 -1
- package/src/native-stack/views/FooterComponent.tsx +1 -1
- package/src/native-stack/views/HeaderConfig.tsx +7 -5
- package/src/native-stack/views/NativeStackView.tsx +5 -8
- package/src/reanimated/ReanimatedNativeStackScreen.tsx +2 -2
- package/src/reanimated/ReanimatedScreen.tsx +2 -1
- package/src/reanimated/ReanimatedScreenProvider.tsx +2 -1
- package/src/types.tsx +1 -0
- package/src/utils.ts +27 -5
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
export declare const isSearchBarAvailableForCurrentPlatform: boolean;
|
|
2
2
|
export declare function executeNativeBackPress(): boolean;
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Exposes information useful for downstream navigation library implementers,
|
|
5
|
+
* so they can keep reasonable backward compatibility, if desired.
|
|
6
|
+
*
|
|
7
|
+
* We don't mean for this object to only grow in number of fields, however at the same time
|
|
8
|
+
* we won't be very hasty to reduce it. Expect gradual changes.
|
|
9
|
+
*/
|
|
10
|
+
export declare const compatibilityFlags: {
|
|
11
|
+
/**
|
|
12
|
+
* Because of a bug introduced in https://github.com/software-mansion/react-native-screens/pull/1646
|
|
13
|
+
* react-native-screens v3.21 changed how header's backTitle handles whitespace strings in https://github.com/software-mansion/react-native-screens/pull/1726
|
|
14
|
+
* To allow for backwards compatibility in @react-navigation/native-stack we need a way to check if this version or newer is used.
|
|
15
|
+
* See https://github.com/react-navigation/react-navigation/pull/11423 for more context.
|
|
16
|
+
*/
|
|
17
|
+
isNewBackTitleImplementation: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* With version 4.0.0 the header implementation has been changed. To allow for backward compat
|
|
20
|
+
* with native-stack@v6 we want to expose a way to check whether the new implementation
|
|
21
|
+
* is in use or not.
|
|
22
|
+
*
|
|
23
|
+
* See:
|
|
24
|
+
* * https://github.com/software-mansion/react-native-screens/pull/2325
|
|
25
|
+
* * https://github.com/react-navigation/react-navigation/pull/12125
|
|
26
|
+
*/
|
|
27
|
+
usesHeaderFlexboxImplementation: boolean;
|
|
28
|
+
};
|
|
4
29
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sCAAsC,SAG5B,CAAC;AAExB,wBAAgB,sBAAsB,YAIrC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sCAAsC,SAG5B,CAAC;AAExB,wBAAgB,sBAAsB,YAIrC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;IAC7B;;;;;OAKG;;IAGH;;;;;;;;OAQG;;CAEJ,CAAC"}
|
package/native-stack/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Native Stack Navigator
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> [!CAUTION]
|
|
4
|
+
> NativeStack has been moved from react-native-screens/native-stack to @react-navigation/native since version v6. With react-native-screens v4 native stack v5 (react-native-screens/native-stack) is deprecated and marked for removal in the upcoming minor release, react-native-screens v4 will support only @react-navigation/native-stack v7.
|
|
4
5
|
|
|
5
6
|
Provides a way for your app to transition between screens where each new screen is placed on top of a stack.
|
|
6
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
"main": "../lib/commonjs/native-stack/index",
|
|
3
|
+
"module": "../lib/module/native-stack/index",
|
|
4
|
+
"react-native": "../src/native-stack/index",
|
|
5
|
+
"types": "../lib/typescript/native-stack/index.d.ts"
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-screens",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.14",
|
|
4
4
|
"description": "Native navigation primitives for your React Native app.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"submodules": "git submodule update --init --recursive && (cd react-navigation && yarn)",
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import React, { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Platform,
|
|
4
|
+
StyleProp,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
View,
|
|
7
|
+
ViewStyle,
|
|
8
|
+
useWindowDimensions,
|
|
9
|
+
} from 'react-native';
|
|
3
10
|
|
|
4
11
|
// Native components
|
|
5
12
|
import FullWindowOverlayNativeComponent from '../fabric/FullWindowOverlayNativeComponent';
|
|
@@ -10,13 +17,14 @@ const NativeFullWindowOverlay: React.ComponentType<
|
|
|
10
17
|
> = FullWindowOverlayNativeComponent as any;
|
|
11
18
|
|
|
12
19
|
function FullWindowOverlay(props: { children: ReactNode }) {
|
|
20
|
+
const { width, height } = useWindowDimensions();
|
|
13
21
|
if (Platform.OS !== 'ios') {
|
|
14
22
|
console.warn('Using FullWindowOverlay is only valid on iOS devices.');
|
|
15
23
|
return <View {...props} />;
|
|
16
24
|
}
|
|
17
25
|
return (
|
|
18
26
|
<NativeFullWindowOverlay
|
|
19
|
-
style={{
|
|
27
|
+
style={[StyleSheet.absoluteFill, { width, height }]}>
|
|
20
28
|
{props.children}
|
|
21
29
|
</NativeFullWindowOverlay>
|
|
22
30
|
);
|
|
@@ -5,7 +5,7 @@ import { Animated, View, Platform } from 'react-native';
|
|
|
5
5
|
|
|
6
6
|
import TransitionProgressContext from '../TransitionProgressContext';
|
|
7
7
|
import DelayedFreeze from './helpers/DelayedFreeze';
|
|
8
|
-
import { ScreenProps } from '
|
|
8
|
+
import { ScreenProps } from '../types';
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
freezeEnabled,
|
|
@@ -14,23 +14,20 @@ import {
|
|
|
14
14
|
} from '../core';
|
|
15
15
|
|
|
16
16
|
// Native components
|
|
17
|
-
import ScreenNativeComponent
|
|
18
|
-
|
|
17
|
+
import ScreenNativeComponent, {
|
|
18
|
+
NativeProps as ScreenNativeComponentProps,
|
|
19
|
+
} from '../fabric/ScreenNativeComponent';
|
|
20
|
+
import ModalScreenNativeComponent, {
|
|
21
|
+
NativeProps as ModalScreenNativeComponentProps,
|
|
22
|
+
} from '../fabric/ModalScreenNativeComponent';
|
|
19
23
|
import { usePrevious } from './helpers/usePrevious';
|
|
20
24
|
|
|
21
|
-
type
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
sheetInitialDetent: number;
|
|
26
|
-
sheetLargestUndimmedDetent: number;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const NativeScreen: React.ComponentType<NativeScreenProps> =
|
|
30
|
-
ScreenNativeComponent as React.ComponentType<NativeScreenProps>;
|
|
31
|
-
const AnimatedNativeScreen = Animated.createAnimatedComponent(NativeScreen);
|
|
25
|
+
type NativeProps = ScreenNativeComponentProps | ModalScreenNativeComponentProps;
|
|
26
|
+
const AnimatedNativeScreen = Animated.createAnimatedComponent(
|
|
27
|
+
ScreenNativeComponent,
|
|
28
|
+
);
|
|
32
29
|
const AnimatedNativeModalScreen = Animated.createAnimatedComponent(
|
|
33
|
-
ModalScreenNativeComponent
|
|
30
|
+
ModalScreenNativeComponent,
|
|
34
31
|
);
|
|
35
32
|
|
|
36
33
|
// Incomplete type, all accessible properties available at:
|
|
@@ -196,6 +193,11 @@ export const InnerScreen = React.forwardRef<View, ScreenProps>(
|
|
|
196
193
|
sheetInitialDetentIndex = 0,
|
|
197
194
|
// Other
|
|
198
195
|
stackPresentation,
|
|
196
|
+
// Events for override
|
|
197
|
+
onAppear,
|
|
198
|
+
onDisappear,
|
|
199
|
+
onWillAppear,
|
|
200
|
+
onWillDisappear,
|
|
199
201
|
} = rest;
|
|
200
202
|
|
|
201
203
|
if (enabled && isNativePlatformSupported) {
|
|
@@ -273,6 +275,22 @@ export const InnerScreen = React.forwardRef<View, ScreenProps>(
|
|
|
273
275
|
<DelayedFreeze freeze={freezeOnBlur && activityState === 0}>
|
|
274
276
|
<AnimatedScreen
|
|
275
277
|
{...props}
|
|
278
|
+
/**
|
|
279
|
+
* This messy override is to conform NativeProps used by codegen and
|
|
280
|
+
* our Public API. To see reasoning go to this PR:
|
|
281
|
+
* https://github.com/software-mansion/react-native-screens/pull/2423#discussion_r1810616995
|
|
282
|
+
*/
|
|
283
|
+
onAppear={onAppear as NativeProps['onAppear']}
|
|
284
|
+
onDisappear={onDisappear as NativeProps['onDisappear']}
|
|
285
|
+
onWillAppear={onWillAppear as NativeProps['onWillAppear']}
|
|
286
|
+
onWillDisappear={onWillDisappear as NativeProps['onWillDisappear']}
|
|
287
|
+
onGestureCancel={
|
|
288
|
+
(onGestureCancel as NativeProps['onGestureCancel']) ??
|
|
289
|
+
(() => {
|
|
290
|
+
// for internal use
|
|
291
|
+
})
|
|
292
|
+
}
|
|
293
|
+
//
|
|
276
294
|
// Hierarchy of screens is handled on the native side and setting zIndex value causes this issue:
|
|
277
295
|
// https://github.com/software-mansion/react-native-screens/issues/2345
|
|
278
296
|
// With below change of zIndex, we force RN diffing mechanism to NOT include detaching and attaching mutation in one transaction.
|
|
@@ -310,12 +328,6 @@ export const InnerScreen = React.forwardRef<View, ScreenProps>(
|
|
|
310
328
|
],
|
|
311
329
|
{ useNativeDriver: true },
|
|
312
330
|
)
|
|
313
|
-
}
|
|
314
|
-
onGestureCancel={
|
|
315
|
-
onGestureCancel ??
|
|
316
|
-
(() => {
|
|
317
|
-
// for internal use
|
|
318
|
-
})
|
|
319
331
|
}>
|
|
320
332
|
{!isNativeStack ? ( // see comment of this prop in types.tsx for information why it is needed
|
|
321
333
|
children
|
|
@@ -361,10 +373,15 @@ export const InnerScreen = React.forwardRef<View, ScreenProps>(
|
|
|
361
373
|
// e.g. to use `useReanimatedTransitionProgress` (see `reanimated` folder in repo)
|
|
362
374
|
export const ScreenContext = React.createContext(InnerScreen);
|
|
363
375
|
|
|
364
|
-
const Screen
|
|
365
|
-
|
|
376
|
+
const Screen = React.forwardRef<View, ScreenProps>(
|
|
377
|
+
(props, ref) => {
|
|
378
|
+
const ScreenWrapper = React.useContext(ScreenContext) || InnerScreen;
|
|
379
|
+
|
|
380
|
+
return <ScreenWrapper {...props} ref={ref} />;
|
|
381
|
+
}
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
Screen.displayName = 'Screen';
|
|
366
385
|
|
|
367
|
-
return <ScreenWrapper {...props} />;
|
|
368
|
-
};
|
|
369
386
|
|
|
370
387
|
export default Screen;
|
|
@@ -2,20 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { Platform, View } from 'react-native';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { ScreenContainerProps } from '
|
|
5
|
+
import { ScreenContainerProps } from '../types';
|
|
6
6
|
import { isNativePlatformSupported, screensEnabled } from '../core';
|
|
7
7
|
|
|
8
8
|
// Native components
|
|
9
9
|
import ScreenContainerNativeComponent from '../fabric/ScreenContainerNativeComponent';
|
|
10
10
|
import ScreenNavigationContainerNativeComponent from '../fabric/ScreenNavigationContainerNativeComponent';
|
|
11
11
|
|
|
12
|
-
export const NativeScreenContainer: React.ComponentType<ScreenContainerProps> =
|
|
13
|
-
Platform.OS !== 'web' ? (ScreenContainerNativeComponent as any) : View;
|
|
14
|
-
export const NativeScreenNavigationContainer: React.ComponentType<ScreenContainerProps> =
|
|
15
|
-
Platform.OS !== 'web'
|
|
16
|
-
? (ScreenNavigationContainerNativeComponent as any)
|
|
17
|
-
: View;
|
|
18
|
-
|
|
19
12
|
function ScreenContainer(props: ScreenContainerProps) {
|
|
20
13
|
const { enabled = screensEnabled(), hasTwoStates, ...rest } = props;
|
|
21
14
|
|
|
@@ -23,11 +16,11 @@ function ScreenContainer(props: ScreenContainerProps) {
|
|
|
23
16
|
if (hasTwoStates) {
|
|
24
17
|
const ScreenNavigationContainer =
|
|
25
18
|
Platform.OS === 'ios'
|
|
26
|
-
?
|
|
27
|
-
:
|
|
19
|
+
? ScreenNavigationContainerNativeComponent
|
|
20
|
+
: ScreenContainerNativeComponent;
|
|
28
21
|
return <ScreenNavigationContainer {...rest} />;
|
|
29
22
|
}
|
|
30
|
-
return <
|
|
23
|
+
return <ScreenContainerNativeComponent {...rest} />;
|
|
31
24
|
}
|
|
32
25
|
return <View {...rest} />;
|
|
33
26
|
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ViewProps } from 'react-native';
|
|
3
3
|
import ScreenContentWrapperNativeComponent from '../fabric/ScreenContentWrapperNativeComponent';
|
|
4
4
|
|
|
5
|
-
export const NativeScreenContentWrapper: React.ComponentType<ViewProps> =
|
|
6
|
-
Platform.OS !== 'web' ? (ScreenContentWrapperNativeComponent as any) : View;
|
|
7
|
-
|
|
8
5
|
function ScreenContentWrapper(props: ViewProps) {
|
|
9
|
-
return <
|
|
6
|
+
return <ScreenContentWrapperNativeComponent collapsable={false} {...props} />;
|
|
10
7
|
}
|
|
11
8
|
|
|
12
9
|
export default ScreenContentWrapper;
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ViewProps } from 'react-native';
|
|
3
3
|
import ScreenFooterNativeComponent from '../fabric/ScreenFooterNativeComponent';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Unstable API
|
|
7
|
-
*/
|
|
8
|
-
export const NativeScreenFooter: React.ComponentType<ViewProps> =
|
|
9
|
-
Platform.OS !== 'web' ? (ScreenFooterNativeComponent as any) : View;
|
|
10
|
-
|
|
11
5
|
/**
|
|
12
6
|
* Unstable API
|
|
13
7
|
*/
|
|
14
8
|
function ScreenFooter(props: ViewProps) {
|
|
15
|
-
return <
|
|
9
|
+
return <ScreenFooterNativeComponent {...props} />;
|
|
16
10
|
}
|
|
17
11
|
|
|
18
12
|
export default ScreenFooter;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { ScreenStackProps
|
|
4
|
+
import { ScreenStackProps } from '../types';
|
|
5
|
+
import { freezeEnabled } from '../core';
|
|
5
6
|
import DelayedFreeze from './helpers/DelayedFreeze';
|
|
6
7
|
|
|
7
8
|
// Native components
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
SearchBarCommands,
|
|
7
|
-
SearchBarProps,
|
|
8
|
-
} from 'react-native-screens';
|
|
4
|
+
import { SearchBarCommands, SearchBarProps } from '../types';
|
|
5
|
+
import { isSearchBarAvailableForCurrentPlatform } from '../utils';
|
|
9
6
|
import { View } from 'react-native';
|
|
10
7
|
|
|
11
8
|
// Native components
|
|
@@ -18,13 +15,13 @@ import SearchBarNativeComponent, {
|
|
|
18
15
|
} from '../fabric/SearchBarNativeComponent';
|
|
19
16
|
import { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
const NativeSearchBar: React.ComponentType<
|
|
22
19
|
SearchBarNativeProps & { ref?: React.RefObject<SearchBarCommands> }
|
|
23
20
|
> &
|
|
24
21
|
typeof NativeSearchBarCommands =
|
|
25
22
|
SearchBarNativeComponent as unknown as React.ComponentType<SearchBarNativeProps> &
|
|
26
23
|
SearchBarCommandsType;
|
|
27
|
-
|
|
24
|
+
const NativeSearchBarCommands: SearchBarCommandsType =
|
|
28
25
|
SearchBarNativeCommands as SearchBarCommandsType;
|
|
29
26
|
|
|
30
27
|
type NativeSearchBarRef = React.ElementRef<typeof NativeSearchBar>;
|
package/src/core.ts
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { Platform, UIManager } from 'react-native';
|
|
4
4
|
|
|
5
|
-
// const that tells if the library should use new implementation, will be undefined for older versions
|
|
6
|
-
export const shouldUseActivityState = true;
|
|
7
|
-
|
|
8
5
|
export const isNativePlatformSupported =
|
|
9
6
|
Platform.OS === 'ios' ||
|
|
10
7
|
Platform.OS === 'android' ||
|
|
@@ -27,6 +27,11 @@ type HeaderHeightChangeEvent = Readonly<{
|
|
|
27
27
|
headerHeight: Double;
|
|
28
28
|
}>;
|
|
29
29
|
|
|
30
|
+
type SheetDetentChangedEvent = Readonly<{
|
|
31
|
+
index: Int32;
|
|
32
|
+
isStable: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
|
|
30
35
|
type GestureResponseDistanceType = Readonly<{
|
|
31
36
|
start: Float;
|
|
32
37
|
end: Float;
|
|
@@ -53,7 +58,8 @@ type StackAnimation =
|
|
|
53
58
|
| 'slide_from_left'
|
|
54
59
|
| 'slide_from_bottom'
|
|
55
60
|
| 'fade_from_bottom'
|
|
56
|
-
| '
|
|
61
|
+
| 'ios_from_right'
|
|
62
|
+
| 'ios_from_left';
|
|
57
63
|
|
|
58
64
|
type SwipeDirection = 'vertical' | 'horizontal';
|
|
59
65
|
|
|
@@ -70,12 +76,14 @@ export interface NativeProps extends ViewProps {
|
|
|
70
76
|
onTransitionProgress?: DirectEventHandler<TransitionProgressEvent>;
|
|
71
77
|
onGestureCancel?: DirectEventHandler<ScreenEvent>;
|
|
72
78
|
onHeaderBackButtonClicked?: DirectEventHandler<ScreenEvent>;
|
|
79
|
+
onSheetDetentChanged?: DirectEventHandler<SheetDetentChangedEvent>;
|
|
73
80
|
sheetAllowedDetents?: number[];
|
|
74
81
|
sheetLargestUndimmedDetent?: WithDefault<Int32, -1>;
|
|
75
82
|
sheetGrabberVisible?: WithDefault<boolean, false>;
|
|
76
83
|
sheetCornerRadius?: WithDefault<Float, -1.0>;
|
|
77
84
|
sheetExpandsWhenScrolledToEdge?: WithDefault<boolean, false>;
|
|
78
85
|
sheetInitialDetent?: WithDefault<Int32, 0>;
|
|
86
|
+
sheetElevation?: WithDefault<Int32, 24>;
|
|
79
87
|
customAnimationOnSwipe?: boolean;
|
|
80
88
|
fullScreenSwipeEnabled?: boolean;
|
|
81
89
|
fullScreenSwipeShadowEnabled?: boolean;
|
|
@@ -18,6 +18,7 @@ type OnDetachedEvent = Readonly<{}>;
|
|
|
18
18
|
type BackButtonDisplayMode = 'minimal' | 'default' | 'generic';
|
|
19
19
|
|
|
20
20
|
type BlurEffect =
|
|
21
|
+
| 'none'
|
|
21
22
|
| 'extraLight'
|
|
22
23
|
| 'light'
|
|
23
24
|
| 'dark'
|
|
@@ -68,7 +69,7 @@ export interface NativeProps extends ViewProps {
|
|
|
68
69
|
backButtonDisplayMode?: WithDefault<BackButtonDisplayMode, 'default'>;
|
|
69
70
|
hideBackButton?: boolean;
|
|
70
71
|
backButtonInCustomView?: boolean;
|
|
71
|
-
blurEffect?: WithDefault<BlurEffect, '
|
|
72
|
+
blurEffect?: WithDefault<BlurEffect, 'none'>;
|
|
72
73
|
// TODO: implement this props on iOS
|
|
73
74
|
topInsetEnabled?: boolean;
|
|
74
75
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { GHContext } from '
|
|
2
|
+
import { GHContext } from '../native-stack/contexts/GHContext';
|
|
3
3
|
import ScreenGestureDetector from './ScreenGestureDetector';
|
|
4
4
|
import type { GestureProviderProps } from '../native-stack/types';
|
|
5
5
|
|
package/src/index.tsx
CHANGED
|
@@ -8,7 +8,6 @@ export {
|
|
|
8
8
|
enableFreeze,
|
|
9
9
|
screensEnabled,
|
|
10
10
|
freezeEnabled,
|
|
11
|
-
shouldUseActivityState,
|
|
12
11
|
} from './core';
|
|
13
12
|
|
|
14
13
|
/**
|
|
@@ -16,19 +15,10 @@ export {
|
|
|
16
15
|
*/
|
|
17
16
|
export {
|
|
18
17
|
default as Screen,
|
|
19
|
-
NativeScreen,
|
|
20
18
|
InnerScreen,
|
|
21
19
|
ScreenContext,
|
|
22
20
|
} from './components/Screen';
|
|
23
21
|
|
|
24
|
-
export {
|
|
25
|
-
default as ScreenContainer,
|
|
26
|
-
NativeScreenContainer,
|
|
27
|
-
NativeScreenNavigationContainer,
|
|
28
|
-
} from './components/ScreenContainer';
|
|
29
|
-
|
|
30
|
-
export { default as ScreenStack } from './components/ScreenStack';
|
|
31
|
-
|
|
32
22
|
export {
|
|
33
23
|
ScreenStackHeaderConfig,
|
|
34
24
|
ScreenStackHeaderSubview,
|
|
@@ -39,28 +29,12 @@ export {
|
|
|
39
29
|
ScreenStackHeaderSearchBarView,
|
|
40
30
|
} from './components/ScreenStackHeaderConfig';
|
|
41
31
|
|
|
42
|
-
export {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
NativeSearchBarCommands,
|
|
46
|
-
} from './components/SearchBar';
|
|
47
|
-
|
|
32
|
+
export { default as SearchBar } from './components/SearchBar';
|
|
33
|
+
export { default as ScreenContainer } from './components/ScreenContainer';
|
|
34
|
+
export { default as ScreenStack } from './components/ScreenStack';
|
|
48
35
|
export { default as FullWindowOverlay } from './components/FullWindowOverlay';
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
default as ScreenFooter,
|
|
52
|
-
NativeScreenFooter,
|
|
53
|
-
} from './components/ScreenFooter';
|
|
54
|
-
|
|
55
|
-
export {
|
|
56
|
-
default as ScreenContentWrapper,
|
|
57
|
-
NativeScreenContentWrapper,
|
|
58
|
-
} from './components/ScreenContentWrapper';
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Modules
|
|
62
|
-
*/
|
|
63
|
-
export { default as NativeScreensModule } from './fabric/NativeScreensModule';
|
|
36
|
+
export { default as ScreenFooter } from './components/ScreenFooter';
|
|
37
|
+
export { default as ScreenContentWrapper } from './components/ScreenContentWrapper';
|
|
64
38
|
|
|
65
39
|
/**
|
|
66
40
|
* Contexts
|
|
@@ -72,7 +46,7 @@ export { GHContext } from './native-stack/contexts/GHContext';
|
|
|
72
46
|
*/
|
|
73
47
|
export {
|
|
74
48
|
isSearchBarAvailableForCurrentPlatform,
|
|
75
|
-
|
|
49
|
+
compatibilityFlags,
|
|
76
50
|
executeNativeBackPress,
|
|
77
51
|
} from './utils';
|
|
78
52
|
|
|
@@ -85,6 +85,9 @@ function NativeStackNavigator({
|
|
|
85
85
|
);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated NativeStack has been moved from react-native-screens/native-stack to @react-navigation/native since version v6. With react-native-screens v4 native stack v5 (react-native-screens/native-stack) is deprecated and marked for removal in the upcoming minor release, react-native-screens v4 will support only @react-navigation/native-stack v7.
|
|
90
|
+
*/
|
|
88
91
|
export default createNavigatorFactory<
|
|
89
92
|
StackNavigationState<ParamListBase>,
|
|
90
93
|
NativeStackNavigationOptions,
|