react-native-screens 3.13.0 → 3.14.1
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 +2 -2
- package/RNScreens.podspec +5 -4
- package/android/build.gradle +18 -1
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt +8 -4
- package/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt +24 -6
- package/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt +14 -18
- package/android/src/main/jni/Android.mk +1 -2
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerDelegate.java +39 -14
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerInterface.java +15 -6
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenStackHeaderConfigManagerDelegate.java +3 -3
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenStackHeaderConfigManagerInterface.java +1 -1
- package/common/cpp/Android.mk +1 -2
- package/createNativeStackNavigator/README.md +4 -0
- package/ios/RNSConvert.h +30 -0
- package/ios/RNSConvert.mm +120 -0
- package/ios/RNSEnums.h +59 -0
- package/ios/RNSFullWindowOverlay.h +17 -2
- package/ios/RNSFullWindowOverlay.mm +199 -0
- package/ios/RNSScreen.h +70 -79
- package/ios/{RNSScreen.m → RNSScreen.mm} +679 -302
- package/ios/RNSScreenContainer.h +15 -1
- package/ios/{RNSScreenContainer.m → RNSScreenContainer.mm} +99 -8
- package/ios/{RNSScreenNavigationContainer.m → RNSScreenNavigationContainer.mm} +22 -0
- package/ios/RNSScreenStack.h +19 -3
- package/ios/{RNSScreenStack.m → RNSScreenStack.mm} +377 -126
- package/ios/{RNSScreenStackAnimator.m → RNSScreenStackAnimator.mm} +19 -14
- package/ios/RNSScreenStackHeaderConfig.h +20 -21
- package/ios/{RNSScreenStackHeaderConfig.m → RNSScreenStackHeaderConfig.mm} +232 -117
- package/ios/RNSScreenStackHeaderSubview.h +45 -0
- package/ios/RNSScreenStackHeaderSubview.mm +137 -0
- package/ios/RNSScreenViewEvent.h +12 -0
- package/ios/RNSScreenViewEvent.mm +59 -0
- package/ios/{RNSScreenWindowTraits.m → RNSScreenWindowTraits.mm} +3 -2
- package/ios/RNSSearchBar.h +14 -1
- package/ios/RNSSearchBar.mm +351 -0
- package/ios/{UIViewController+RNScreens.m → UIViewController+RNScreens.mm} +0 -0
- package/ios/{UIWindow+RNScreens.m → UIWindow+RNScreens.mm} +0 -0
- package/lib/commonjs/fabric/FullWindowOverlay.js +26 -0
- package/lib/commonjs/fabric/FullWindowOverlay.js.map +1 -0
- package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js +21 -0
- package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js.map +1 -0
- package/lib/commonjs/fabric/Screen.js +10 -8
- package/lib/commonjs/fabric/Screen.js.map +1 -1
- package/lib/commonjs/fabric/ScreenContainer.js +28 -0
- package/lib/commonjs/fabric/ScreenContainer.js.map +1 -0
- package/lib/commonjs/fabric/ScreenContainerNativeComponent.js +21 -0
- package/lib/commonjs/fabric/ScreenContainerNativeComponent.js.map +1 -0
- package/lib/commonjs/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenNavigationContainer.js +28 -0
- package/lib/commonjs/fabric/ScreenNavigationContainer.js.map +1 -0
- package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js +21 -0
- package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -0
- package/lib/commonjs/fabric/ScreenStack.js +6 -7
- package/lib/commonjs/fabric/ScreenStack.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackHeaderSubview.js +4 -1
- package/lib/commonjs/fabric/ScreenStackHeaderSubview.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/SearchBar.js +37 -0
- package/lib/commonjs/fabric/SearchBar.js.map +1 -0
- package/lib/commonjs/fabric/SearchBarNativeComponent.js +25 -0
- package/lib/commonjs/fabric/SearchBarNativeComponent.js.map +1 -0
- package/lib/commonjs/fabric/index.js +32 -0
- package/lib/commonjs/fabric/index.js.map +1 -1
- package/lib/commonjs/index.native.js +14 -18
- package/lib/commonjs/index.native.js.map +1 -1
- package/lib/commonjs/native-stack/views/NativeStackView.js +4 -0
- package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js +8 -2
- package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
- package/lib/module/fabric/FullWindowOverlay.js +15 -0
- package/lib/module/fabric/FullWindowOverlay.js.map +1 -0
- package/lib/module/fabric/FullWindowOverlayNativeComponent.js +9 -0
- package/lib/module/fabric/FullWindowOverlayNativeComponent.js.map +1 -0
- package/lib/module/fabric/Screen.js +8 -3
- package/lib/module/fabric/Screen.js.map +1 -1
- package/lib/module/fabric/ScreenContainer.js +17 -0
- package/lib/module/fabric/ScreenContainer.js.map +1 -0
- package/lib/module/fabric/ScreenContainerNativeComponent.js +9 -0
- package/lib/module/fabric/ScreenContainerNativeComponent.js.map +1 -0
- package/lib/module/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenNavigationContainer.js +17 -0
- package/lib/module/fabric/ScreenNavigationContainer.js.map +1 -0
- package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js +9 -0
- package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -0
- package/lib/module/fabric/ScreenStack.js +5 -2
- package/lib/module/fabric/ScreenStack.js.map +1 -1
- package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackHeaderSubview.js +4 -1
- package/lib/module/fabric/ScreenStackHeaderSubview.js.map +1 -1
- package/lib/module/fabric/ScreenStackNativeComponent.js.map +1 -1
- package/lib/module/fabric/SearchBar.js +24 -0
- package/lib/module/fabric/SearchBar.js.map +1 -0
- package/lib/module/fabric/SearchBarNativeComponent.js +11 -0
- package/lib/module/fabric/SearchBarNativeComponent.js.map +1 -0
- package/lib/module/fabric/index.js +5 -1
- package/lib/module/fabric/index.js.map +1 -1
- package/lib/module/index.native.js +15 -20
- package/lib/module/index.native.js.map +1 -1
- package/lib/module/native-stack/views/NativeStackView.js +4 -0
- package/lib/module/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/module/reanimated/ReanimatedNativeStackScreen.js +7 -2
- package/lib/module/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
- package/lib/typescript/native-stack/types.d.ts +12 -0
- package/lib/typescript/reanimated/ReanimatedNativeStackScreen.d.ts +1 -1
- package/lib/typescript/reanimated/ReanimatedScreen.d.ts +1 -1
- package/lib/typescript/types.d.ts +24 -0
- package/native-stack/README.md +21 -0
- package/package.json +2 -2
- package/src/fabric/FullWindowOverlay.js +13 -0
- package/src/fabric/FullWindowOverlayNativeComponent.js +19 -0
- package/src/fabric/Screen.js +5 -2
- package/src/fabric/ScreenContainer.js +16 -0
- package/src/fabric/ScreenContainerNativeComponent.js +19 -0
- package/src/fabric/ScreenNativeComponent.js +41 -8
- package/src/fabric/ScreenNavigationContainer.js +16 -0
- package/src/fabric/ScreenNavigationContainerNativeComponent.js +19 -0
- package/src/fabric/ScreenStack.js +4 -2
- package/src/fabric/ScreenStackHeaderConfigNativeComponent.js +1 -1
- package/src/fabric/ScreenStackHeaderSubview.js +3 -1
- package/src/fabric/ScreenStackNativeComponent.js +4 -0
- package/src/fabric/SearchBar.js +20 -0
- package/src/fabric/SearchBarNativeComponent.js +62 -0
- package/src/fabric/index.js +8 -0
- package/src/index.native.tsx +20 -19
- package/src/native-stack/types.tsx +12 -0
- package/src/native-stack/views/NativeStackView.tsx +4 -0
- package/src/reanimated/ReanimatedNativeStackScreen.tsx +6 -0
- package/src/types.tsx +25 -0
- package/ios/RNSFullWindowOverlay.m +0 -105
- package/ios/RNSScreenComponentView.h +0 -23
- package/ios/RNSScreenComponentView.mm +0 -159
- package/ios/RNSScreenController.h +0 -10
- package/ios/RNSScreenController.mm +0 -79
- package/ios/RNSScreenStackComponentView.h +0 -15
- package/ios/RNSScreenStackComponentView.mm +0 -295
- package/ios/RNSScreenStackHeaderConfigComponentView.h +0 -42
- package/ios/RNSScreenStackHeaderConfigComponentView.mm +0 -662
- package/ios/RNSScreenStackHeaderSubviewComponentView.h +0 -14
- package/ios/RNSScreenStackHeaderSubviewComponentView.mm +0 -77
- package/ios/RNSSearchBar.m +0 -198
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import FullWindowOverlayNativeComponent from './FullWindowOverlayNativeComponent';
|
|
3
|
+
|
|
4
|
+
function FullWindowOverlay(props) {
|
|
5
|
+
return (
|
|
6
|
+
<FullWindowOverlayNativeComponent
|
|
7
|
+
{...props}
|
|
8
|
+
style={[{ flex: 1 }, props.style]}
|
|
9
|
+
/>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default FullWindowOverlay;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @flow strict-local
|
|
3
|
+
* @format
|
|
4
|
+
*/
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
7
|
+
import type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';
|
|
8
|
+
import type { HostComponent } from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
|
|
9
|
+
|
|
10
|
+
type NativeProps = $ReadOnly<{|
|
|
11
|
+
...ViewProps,
|
|
12
|
+
|}>;
|
|
13
|
+
|
|
14
|
+
type ComponentType = HostComponent<NativeProps>;
|
|
15
|
+
|
|
16
|
+
export default (codegenNativeComponent<NativeProps>(
|
|
17
|
+
'RNSFullWindowOverlay',
|
|
18
|
+
{}
|
|
19
|
+
): ComponentType);
|
package/src/fabric/Screen.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import ScreenNativeComponent from './ScreenNativeComponent';
|
|
3
3
|
import { StyleSheet } from 'react-native';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
function Screen(props, ref) {
|
|
6
6
|
return (
|
|
7
7
|
<ScreenNativeComponent
|
|
8
|
+
ref={ref}
|
|
8
9
|
{...props}
|
|
9
10
|
style={[props.style, StyleSheet.absoluteFill]}
|
|
10
11
|
/>
|
|
11
12
|
);
|
|
12
13
|
}
|
|
14
|
+
|
|
15
|
+
export default React.forwardRef(Screen);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ScreenContainerNativeComponent from './ScreenContainerNativeComponent';
|
|
3
|
+
|
|
4
|
+
function ScreenContainer(props) {
|
|
5
|
+
return (
|
|
6
|
+
<ScreenContainerNativeComponent
|
|
7
|
+
{...props}
|
|
8
|
+
style={[
|
|
9
|
+
{ flex: 1, alignItems: 'center', justifyContent: 'center' },
|
|
10
|
+
props.style,
|
|
11
|
+
]}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default ScreenContainer;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @flow strict-local
|
|
3
|
+
* @format
|
|
4
|
+
*/
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
7
|
+
import type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';
|
|
8
|
+
import type { HostComponent } from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
|
|
9
|
+
|
|
10
|
+
type NativeProps = $ReadOnly<{|
|
|
11
|
+
...ViewProps,
|
|
12
|
+
|}>;
|
|
13
|
+
|
|
14
|
+
type ComponentType = HostComponent<NativeProps>;
|
|
15
|
+
|
|
16
|
+
export default (codegenNativeComponent<NativeProps>(
|
|
17
|
+
'RNSScreenContainer',
|
|
18
|
+
{}
|
|
19
|
+
): ComponentType);
|
|
@@ -19,7 +19,28 @@ type ScreenDismissedEvent = $ReadOnly<{|
|
|
|
19
19
|
dismissCount: Int32,
|
|
20
20
|
|}>;
|
|
21
21
|
|
|
22
|
-
type
|
|
22
|
+
type TransitionProgressEvent = $ReadOnly<{|
|
|
23
|
+
progress: Double,
|
|
24
|
+
closing: Int32,
|
|
25
|
+
goingForward: Int32,
|
|
26
|
+
|}>;
|
|
27
|
+
|
|
28
|
+
type GestureResponseDistanceType = $ReadOnly<{|
|
|
29
|
+
start: Float,
|
|
30
|
+
end: Float,
|
|
31
|
+
top: Float,
|
|
32
|
+
bottom: Float,
|
|
33
|
+
|}>;
|
|
34
|
+
|
|
35
|
+
type StackPresentation =
|
|
36
|
+
| 'push'
|
|
37
|
+
| 'modal'
|
|
38
|
+
| 'transparentModal'
|
|
39
|
+
| 'fullScreenModal'
|
|
40
|
+
| 'formSheet'
|
|
41
|
+
| 'containedModal'
|
|
42
|
+
| 'containedTransparentModal';
|
|
43
|
+
|
|
23
44
|
type StackAnimation =
|
|
24
45
|
| 'default'
|
|
25
46
|
| 'flip'
|
|
@@ -31,6 +52,8 @@ type StackAnimation =
|
|
|
31
52
|
| 'slide_from_bottom'
|
|
32
53
|
| 'fade_from_bottom';
|
|
33
54
|
|
|
55
|
+
type SwipeDirection = 'vertical' | 'horizontal';
|
|
56
|
+
|
|
34
57
|
type ReplaceAnimation = 'pop' | 'push';
|
|
35
58
|
|
|
36
59
|
export type NativeProps = $ReadOnly<{|
|
|
@@ -38,23 +61,33 @@ export type NativeProps = $ReadOnly<{|
|
|
|
38
61
|
onAppear?: ?BubblingEventHandler<ScreenEvent>,
|
|
39
62
|
onDisappear?: ?BubblingEventHandler<ScreenEvent>,
|
|
40
63
|
onDismissed?: ?BubblingEventHandler<ScreenDismissedEvent>,
|
|
64
|
+
onNativeDismissCancelled?: ?BubblingEventHandler<ScreenDismissedEvent>,
|
|
41
65
|
onWillAppear?: ?BubblingEventHandler<ScreenEvent>,
|
|
42
66
|
onWillDisappear?: ?BubblingEventHandler<ScreenEvent>,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
67
|
+
onTransitionProgress?: ?BubblingEventHandler<TransitionProgressEvent>,
|
|
68
|
+
customAnimationOnSwipe?: boolean,
|
|
69
|
+
fullScreenSwipeEnabled?: boolean,
|
|
70
|
+
homeIndicatorHidden?: boolean,
|
|
71
|
+
preventNativeDismiss?: boolean,
|
|
46
72
|
gestureEnabled?: WithDefault<boolean, true>,
|
|
47
|
-
|
|
73
|
+
statusBarColor?: ColorValue,
|
|
74
|
+
statusBarHidden?: boolean,
|
|
48
75
|
screenOrientation?: string,
|
|
49
76
|
statusBarAnimation?: string,
|
|
50
|
-
statusBarColor?: ColorValue,
|
|
51
77
|
statusBarStyle?: string,
|
|
52
78
|
statusBarTranslucent?: boolean,
|
|
53
|
-
|
|
79
|
+
gestureResponseDistance?: GestureResponseDistanceType,
|
|
80
|
+
stackPresentation?: WithDefault<StackPresentation, 'push'>,
|
|
81
|
+
stackAnimation?: WithDefault<StackAnimation, 'default'>,
|
|
82
|
+
transitionDuration?: WithDefault<Int32, 350>,
|
|
83
|
+
replaceAnimation?: WithDefault<ReplaceAnimation, 'pop'>,
|
|
84
|
+
swipeDirection?: WithDefault<SwipeDirection, 'horizontal'>,
|
|
85
|
+
hideKeyboardOnSwipe?: boolean,
|
|
86
|
+
activityState?: WithDefault<Float, -1.0>,
|
|
87
|
+
// TODO: implement these props on iOS
|
|
54
88
|
navigationBarColor?: ColorValue,
|
|
55
89
|
navigationBarHidden?: boolean,
|
|
56
90
|
nativeBackButtonDismissalEnabled?: boolean,
|
|
57
|
-
activityState?: WithDefault<Int32, -1>,
|
|
58
91
|
|}>;
|
|
59
92
|
|
|
60
93
|
type ComponentType = HostComponent<NativeProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ScreenNavigationContainerNativeComponent from './ScreenNavigationContainerNativeComponent';
|
|
3
|
+
|
|
4
|
+
function ScreenNavigationContainer(props) {
|
|
5
|
+
return (
|
|
6
|
+
<ScreenNavigationContainerNativeComponent
|
|
7
|
+
{...props}
|
|
8
|
+
style={[
|
|
9
|
+
{ flex: 1, alignItems: 'center', justifyContent: 'center' },
|
|
10
|
+
props.style,
|
|
11
|
+
]}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default ScreenNavigationContainer;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @flow strict-local
|
|
3
|
+
* @format
|
|
4
|
+
*/
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
7
|
+
import type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';
|
|
8
|
+
import type { HostComponent } from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
|
|
9
|
+
|
|
10
|
+
type NativeProps = $ReadOnly<{|
|
|
11
|
+
...ViewProps,
|
|
12
|
+
|}>;
|
|
13
|
+
|
|
14
|
+
type ComponentType = HostComponent<NativeProps>;
|
|
15
|
+
|
|
16
|
+
export default (codegenNativeComponent<NativeProps>(
|
|
17
|
+
'RNSScreenNavigationContainer',
|
|
18
|
+
{}
|
|
19
|
+
): ComponentType);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import ScreenStackNativeComponent from './ScreenStackNativeComponent';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
function ScreenStack(props) {
|
|
5
5
|
return (
|
|
6
6
|
<ScreenStackNativeComponent {...props} style={[{ flex: 1 }, props.style]} />
|
|
7
7
|
);
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
export default ScreenStack;
|
|
@@ -41,9 +41,9 @@ export type NativeProps = $ReadOnly<{|
|
|
|
41
41
|
titleColor?: ColorValue,
|
|
42
42
|
disableBackButtonMenu?: boolean,
|
|
43
43
|
hideBackButton?: boolean,
|
|
44
|
+
backButtonInCustomView?: boolean,
|
|
44
45
|
// TODO: implement this props on iOS
|
|
45
46
|
topInsetEnabled?: boolean,
|
|
46
|
-
backButtonInCustomView?: boolean,
|
|
47
47
|
|}>;
|
|
48
48
|
|
|
49
49
|
type ComponentType = HostComponent<NativeProps>;
|
|
@@ -13,8 +13,10 @@ const styles = StyleSheet.create({
|
|
|
13
13
|
},
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
function ScreenStackHeaderSubview(props) {
|
|
17
17
|
return (
|
|
18
18
|
<NativeScreenStackHeaderSubview {...props} style={styles.headerSubview} />
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
|
+
|
|
22
|
+
export default ScreenStackHeaderSubview;
|
|
@@ -6,9 +6,13 @@
|
|
|
6
6
|
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
7
7
|
import type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';
|
|
8
8
|
import type { HostComponent } from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
|
|
9
|
+
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
10
|
+
|
|
11
|
+
type FinishTransitioningEvent = $ReadOnly<{||}>;
|
|
9
12
|
|
|
10
13
|
type NativeProps = $ReadOnly<{|
|
|
11
14
|
...ViewProps,
|
|
15
|
+
onFinishTransitioning?: ?DirectEventHandler<FinishTransitioningEvent>,
|
|
12
16
|
|}>;
|
|
13
17
|
|
|
14
18
|
type ComponentType = HostComponent<NativeProps>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SearchBarNativeComponent from './SearchBarNativeComponent';
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
|
+
|
|
5
|
+
const styles = StyleSheet.create({
|
|
6
|
+
headerSubview: {
|
|
7
|
+
position: 'absolute',
|
|
8
|
+
top: 0,
|
|
9
|
+
right: 0,
|
|
10
|
+
flexDirection: 'row',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
function SearchBar(props) {
|
|
17
|
+
return <SearchBarNativeComponent {...props} style={styles.headerSubview} />;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default SearchBar;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @flow strict-local
|
|
3
|
+
* @format
|
|
4
|
+
*/
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
7
|
+
import type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';
|
|
8
|
+
import type { HostComponent } from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
|
|
9
|
+
import { ColorValue } from 'react-native/Libraries/StyleSheet/StyleSheet';
|
|
10
|
+
import type {
|
|
11
|
+
WithDefault,
|
|
12
|
+
BubblingEventHandler,
|
|
13
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
14
|
+
import { tintColor } from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes';
|
|
15
|
+
|
|
16
|
+
type SearchBarEvent = $ReadOnly<{||}>;
|
|
17
|
+
|
|
18
|
+
type SearchButtonPressedEvent = $ReadOnly<{|
|
|
19
|
+
text?: string,
|
|
20
|
+
|}>;
|
|
21
|
+
|
|
22
|
+
type ChangeTextEvent = $ReadOnly<{|
|
|
23
|
+
text?: string,
|
|
24
|
+
|}>;
|
|
25
|
+
|
|
26
|
+
type AutoCapitalizeType = 'none' | 'words' | 'sentences' | 'characters';
|
|
27
|
+
|
|
28
|
+
type NativeProps = $ReadOnly<{|
|
|
29
|
+
...ViewProps,
|
|
30
|
+
onFocus?: ?BubblingEventHandler<SearchBarEvent>,
|
|
31
|
+
onBlur?: ?BubblingEventHandler<SearchBarEvent>,
|
|
32
|
+
onSearchButtonPress?: ?BubblingEventHandler<SearchButtonPressedEvent>,
|
|
33
|
+
onCancelButtonPress?: ?BubblingEventHandler<SearchBarEvent>,
|
|
34
|
+
onChangeText?: ?BubblingEventHandler<ChangeTextEvent>,
|
|
35
|
+
hideWhenScrolling?: boolean,
|
|
36
|
+
autoCapitalize?: WithDefault<AutoCapitalizeType, 'none'>,
|
|
37
|
+
placeholder?: string,
|
|
38
|
+
obscureBackground?: boolean,
|
|
39
|
+
hideNavigationBar?: boolean,
|
|
40
|
+
cancelButtonText?: string,
|
|
41
|
+
// TODO: implement these on iOS
|
|
42
|
+
barTintColor?: ColorValue,
|
|
43
|
+
tintColor?: ColorValue,
|
|
44
|
+
textColor?: ColorValue,
|
|
45
|
+
|
|
46
|
+
// Android only
|
|
47
|
+
disableBackButtonOverride?: boolean,
|
|
48
|
+
// TODO: consider creating enum here
|
|
49
|
+
inputType?: string,
|
|
50
|
+
onClose?: ?BubblingEventHandler<SearchBarEvent>,
|
|
51
|
+
onOpen?: ?BubblingEventHandler<SearchBarEvent>,
|
|
52
|
+
hintTextColor?: ColorValue,
|
|
53
|
+
headerIconColor?: ColorValue,
|
|
54
|
+
shouldShowHintSearchIcon?: WithDefault<boolean, true>,
|
|
55
|
+
|}>;
|
|
56
|
+
|
|
57
|
+
type ComponentType = HostComponent<NativeProps>;
|
|
58
|
+
|
|
59
|
+
export default (codegenNativeComponent<NativeProps>(
|
|
60
|
+
'RNSSearchBar',
|
|
61
|
+
{}
|
|
62
|
+
): ComponentType);
|
package/src/fabric/index.js
CHANGED
|
@@ -2,10 +2,18 @@ import Screen from './Screen';
|
|
|
2
2
|
import ScreenStackHeaderSubview from './ScreenStackHeaderSubview';
|
|
3
3
|
import ScreenStackHeaderConfig from './ScreenStackHeaderConfigNativeComponent';
|
|
4
4
|
import ScreenStack from './ScreenStack';
|
|
5
|
+
import SearchBar from './SearchBar';
|
|
6
|
+
import ScreenContainer from './ScreenContainer';
|
|
7
|
+
import ScreenNavigationContainer from './ScreenNavigationContainer';
|
|
8
|
+
import FullWindowOverlay from './FullWindowOverlay';
|
|
5
9
|
|
|
6
10
|
export {
|
|
7
11
|
Screen,
|
|
8
12
|
ScreenStackHeaderSubview,
|
|
9
13
|
ScreenStackHeaderConfig,
|
|
10
14
|
ScreenStack,
|
|
15
|
+
SearchBar,
|
|
16
|
+
ScreenContainer,
|
|
17
|
+
ScreenNavigationContainer,
|
|
18
|
+
FullWindowOverlay,
|
|
11
19
|
};
|
package/src/index.native.tsx
CHANGED
|
@@ -11,9 +11,6 @@ import {
|
|
|
11
11
|
ViewProps,
|
|
12
12
|
} from 'react-native';
|
|
13
13
|
import { Freeze } from 'react-freeze';
|
|
14
|
-
// @ts-ignore Getting private component
|
|
15
|
-
// eslint-disable-next-line import/default
|
|
16
|
-
import processColor from 'react-native/Libraries/StyleSheet/processColor';
|
|
17
14
|
import { version } from 'react-native/package.json';
|
|
18
15
|
|
|
19
16
|
import TransitionProgressContext from './TransitionProgressContext';
|
|
@@ -106,6 +103,7 @@ const ScreensNativeModules = {
|
|
|
106
103
|
get NativeScreenContainer() {
|
|
107
104
|
NativeScreenContainerValue =
|
|
108
105
|
NativeScreenContainerValue ||
|
|
106
|
+
FabricComponents.ScreenContainer ||
|
|
109
107
|
requireNativeComponent('RNSScreenContainer');
|
|
110
108
|
return NativeScreenContainerValue;
|
|
111
109
|
},
|
|
@@ -114,7 +112,8 @@ const ScreensNativeModules = {
|
|
|
114
112
|
NativeScreenNavigationContainerValue =
|
|
115
113
|
NativeScreenNavigationContainerValue ||
|
|
116
114
|
(Platform.OS === 'ios'
|
|
117
|
-
?
|
|
115
|
+
? FabricComponents.ScreenNavigationContainer ||
|
|
116
|
+
requireNativeComponent('RNSScreenNavigationContainer')
|
|
118
117
|
: this.NativeScreenContainer);
|
|
119
118
|
return NativeScreenNavigationContainerValue;
|
|
120
119
|
},
|
|
@@ -144,13 +143,18 @@ const ScreensNativeModules = {
|
|
|
144
143
|
},
|
|
145
144
|
|
|
146
145
|
get NativeSearchBar() {
|
|
147
|
-
NativeSearchBar =
|
|
146
|
+
NativeSearchBar =
|
|
147
|
+
NativeSearchBar ||
|
|
148
|
+
FabricComponents.SearchBar ||
|
|
149
|
+
requireNativeComponent('RNSSearchBar');
|
|
148
150
|
return NativeSearchBar;
|
|
149
151
|
},
|
|
150
152
|
|
|
151
153
|
get NativeFullWindowOverlay() {
|
|
152
154
|
NativeFullWindowOverlay =
|
|
153
|
-
NativeFullWindowOverlay ||
|
|
155
|
+
NativeFullWindowOverlay ||
|
|
156
|
+
FabricComponents.FullWindowOverlay ||
|
|
157
|
+
requireNativeComponent('RNSFullWindowOverlay');
|
|
154
158
|
return NativeFullWindowOverlay;
|
|
155
159
|
},
|
|
156
160
|
};
|
|
@@ -233,15 +237,9 @@ class Screen extends React.Component<ScreenProps> {
|
|
|
233
237
|
const { enabled = ENABLE_SCREENS, ...rest } = this.props;
|
|
234
238
|
|
|
235
239
|
if (enabled && isPlatformSupported) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
} else {
|
|
240
|
-
AnimatedNativeScreen = Animated.createAnimatedComponent(
|
|
241
|
-
ScreensNativeModules.NativeScreen
|
|
242
|
-
) as React.ComponentType<ScreenProps>;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
240
|
+
AnimatedNativeScreen =
|
|
241
|
+
AnimatedNativeScreen ||
|
|
242
|
+
Animated.createAnimatedComponent(ScreensNativeModules.NativeScreen);
|
|
245
243
|
|
|
246
244
|
let {
|
|
247
245
|
// Filter out active prop in this case because it is unused and
|
|
@@ -251,7 +249,7 @@ class Screen extends React.Component<ScreenProps> {
|
|
|
251
249
|
activityState,
|
|
252
250
|
children,
|
|
253
251
|
isNativeStack,
|
|
254
|
-
|
|
252
|
+
gestureResponseDistance,
|
|
255
253
|
...props
|
|
256
254
|
} = rest;
|
|
257
255
|
|
|
@@ -262,8 +260,6 @@ class Screen extends React.Component<ScreenProps> {
|
|
|
262
260
|
activityState = active !== 0 ? 2 : 0; // in the new version, we need one of the screens to have value of 2 after the transition
|
|
263
261
|
}
|
|
264
262
|
|
|
265
|
-
const processedColor = processColor(statusBarColor);
|
|
266
|
-
|
|
267
263
|
const handleRef = (ref: ViewConfig) => {
|
|
268
264
|
if (!ENABLE_FABRIC) {
|
|
269
265
|
if (ref?.viewConfig?.validAttributes?.style) {
|
|
@@ -280,8 +276,13 @@ class Screen extends React.Component<ScreenProps> {
|
|
|
280
276
|
<MaybeFreeze freeze={activityState === 0}>
|
|
281
277
|
<AnimatedNativeScreen
|
|
282
278
|
{...props}
|
|
283
|
-
statusBarColor={processedColor}
|
|
284
279
|
activityState={activityState}
|
|
280
|
+
gestureResponseDistance={{
|
|
281
|
+
start: gestureResponseDistance?.start ?? -1,
|
|
282
|
+
end: gestureResponseDistance?.end ?? -1,
|
|
283
|
+
top: gestureResponseDistance?.top ?? -1,
|
|
284
|
+
bottom: gestureResponseDistance?.bottom ?? -1,
|
|
285
|
+
}}
|
|
285
286
|
// This prevents showing blank screen when navigating between multiple screens with freezing
|
|
286
287
|
// https://github.com/software-mansion/react-native-screens/pull/1208
|
|
287
288
|
ref={handleRef}
|
|
@@ -111,6 +111,12 @@ export type NativeStackNavigationOptions = {
|
|
|
111
111
|
* @platform ios
|
|
112
112
|
*/
|
|
113
113
|
gestureEnabled?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Use it to restrict the distance from the edges of screen in which the gesture should be recognized. To be used alongside `fullScreenSwipeEnabled`.
|
|
116
|
+
*
|
|
117
|
+
* @platform ios
|
|
118
|
+
*/
|
|
119
|
+
gestureResponseDistance?: ScreenProps['gestureResponseDistance'];
|
|
114
120
|
/**
|
|
115
121
|
* Title to display in the back button.
|
|
116
122
|
* Only supported on iOS.
|
|
@@ -249,6 +255,12 @@ export type NativeStackNavigationOptions = {
|
|
|
249
255
|
* @platform ios
|
|
250
256
|
*/
|
|
251
257
|
homeIndicatorHidden?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Whether the keyboard should hide when swiping to the previous screen. Defaults to `false`.
|
|
260
|
+
*
|
|
261
|
+
* @platform ios
|
|
262
|
+
*/
|
|
263
|
+
hideKeyboardOnSwipe?: boolean;
|
|
252
264
|
/**
|
|
253
265
|
* Boolean indicating whether, when the Android default back button is clicked, the `pop` action should be performed on the native side or on the JS side to be able to prevent it.
|
|
254
266
|
* Unfortunately the same behavior is not available on iOS since the behavior of native back button cannot be changed there.
|
|
@@ -151,6 +151,7 @@ const RouteView = ({
|
|
|
151
151
|
const {
|
|
152
152
|
gestureEnabled,
|
|
153
153
|
headerShown,
|
|
154
|
+
hideKeyboardOnSwipe,
|
|
154
155
|
homeIndicatorHidden,
|
|
155
156
|
nativeBackButtonDismissalEnabled = false,
|
|
156
157
|
navigationBarColor,
|
|
@@ -169,6 +170,7 @@ const RouteView = ({
|
|
|
169
170
|
let {
|
|
170
171
|
customAnimationOnSwipe,
|
|
171
172
|
fullScreenSwipeEnabled,
|
|
173
|
+
gestureResponseDistance,
|
|
172
174
|
stackAnimation,
|
|
173
175
|
stackPresentation = 'push',
|
|
174
176
|
} = options;
|
|
@@ -218,8 +220,10 @@ const RouteView = ({
|
|
|
218
220
|
style={StyleSheet.absoluteFill}
|
|
219
221
|
customAnimationOnSwipe={customAnimationOnSwipe}
|
|
220
222
|
fullScreenSwipeEnabled={fullScreenSwipeEnabled}
|
|
223
|
+
hideKeyboardOnSwipe={hideKeyboardOnSwipe}
|
|
221
224
|
homeIndicatorHidden={homeIndicatorHidden}
|
|
222
225
|
gestureEnabled={isAndroid ? false : gestureEnabled}
|
|
226
|
+
gestureResponseDistance={gestureResponseDistance}
|
|
223
227
|
nativeBackButtonDismissalEnabled={nativeBackButtonDismissalEnabled}
|
|
224
228
|
navigationBarColor={navigationBarColor}
|
|
225
229
|
navigationBarHidden={navigationBarHidden}
|
|
@@ -14,6 +14,9 @@ const AnimatedScreen = Animated.createAnimatedComponent(
|
|
|
14
14
|
(Screen as unknown) as React.ComponentClass
|
|
15
15
|
);
|
|
16
16
|
|
|
17
|
+
// @ts-expect-error nativeFabricUIManager is not yet included in the RN types
|
|
18
|
+
const ENABLE_FABRIC = !!global?.nativeFabricUIManager;
|
|
19
|
+
|
|
17
20
|
const ReanimatedNativeStackScreen = React.forwardRef<
|
|
18
21
|
typeof AnimatedScreen,
|
|
19
22
|
ScreenProps
|
|
@@ -39,6 +42,9 @@ const ReanimatedNativeStackScreen = React.forwardRef<
|
|
|
39
42
|
// This should not be necessary, but is not properly managed by `react-native-reanimated`
|
|
40
43
|
// @ts-ignore wrong type
|
|
41
44
|
Platform.OS === 'android'
|
|
45
|
+
? 'onTransitionProgress'
|
|
46
|
+
: // for some reason there is a difference in required event name between architectures
|
|
47
|
+
ENABLE_FABRIC
|
|
42
48
|
? 'onTransitionProgress'
|
|
43
49
|
: 'topTransitionProgress',
|
|
44
50
|
]
|
package/src/types.tsx
CHANGED
|
@@ -70,6 +70,13 @@ export type TransitionProgressEventType = {
|
|
|
70
70
|
goingForward: number;
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
+
export type GestureResponseDistanceType = {
|
|
74
|
+
start?: number;
|
|
75
|
+
end?: number;
|
|
76
|
+
top?: number;
|
|
77
|
+
bottom?: number;
|
|
78
|
+
};
|
|
79
|
+
|
|
73
80
|
export interface ScreenProps extends ViewProps {
|
|
74
81
|
active?: 0 | 1 | Animated.AnimatedInterpolation;
|
|
75
82
|
activityState?: 0 | 1 | 2 | Animated.AnimatedInterpolation;
|
|
@@ -102,12 +109,24 @@ export interface ScreenProps extends ViewProps {
|
|
|
102
109
|
* @platform ios
|
|
103
110
|
*/
|
|
104
111
|
gestureEnabled?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Use it to restrict the distance from the edges of screen in which the gesture should be recognized. To be used alongside `fullScreenSwipeEnabled`.
|
|
114
|
+
*
|
|
115
|
+
* @platform ios
|
|
116
|
+
*/
|
|
117
|
+
gestureResponseDistance?: GestureResponseDistanceType;
|
|
105
118
|
/**
|
|
106
119
|
* Whether the home indicator should be hidden on this screen. Defaults to `false`.
|
|
107
120
|
*
|
|
108
121
|
* @platform ios
|
|
109
122
|
*/
|
|
110
123
|
homeIndicatorHidden?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Whether the keyboard should hide when swiping to the previous screen. Defaults to `false`.
|
|
126
|
+
*
|
|
127
|
+
* @platform ios
|
|
128
|
+
*/
|
|
129
|
+
hideKeyboardOnSwipe?: boolean;
|
|
111
130
|
/**
|
|
112
131
|
* Boolean indicating whether, when the Android default back button is clicked, the `pop` action should be performed on the native side or on the JS side to be able to prevent it.
|
|
113
132
|
* Unfortunately the same behavior is not available on iOS since the behavior of native back button cannot be changed there.
|
|
@@ -425,6 +444,12 @@ export interface SearchBarProps {
|
|
|
425
444
|
* The search field background color
|
|
426
445
|
*/
|
|
427
446
|
barTintColor?: string;
|
|
447
|
+
/**
|
|
448
|
+
* The color for the cursor caret and cancel button text.
|
|
449
|
+
*
|
|
450
|
+
* @platform ios
|
|
451
|
+
*/
|
|
452
|
+
tintColor?: string;
|
|
428
453
|
/**
|
|
429
454
|
* The text to be used instead of default `Cancel` button text
|
|
430
455
|
*
|