@amazon-devices/react-native-screens 3.0.9000000000 → 3.0.9000000003
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/SystemModules/amzn__react-native-screens-3.private.modules.txt +116 -61
- package/kepler-compatibility.json +5 -2
- package/lib/commonjs/TransitionProgressContext.js.map +1 -1
- package/lib/commonjs/components/DebugContainer.js.map +1 -1
- package/lib/commonjs/components/DebugContainer.web.js.map +1 -1
- package/lib/commonjs/components/Screen.web.js.map +1 -1
- package/lib/commonjs/components/ScreenStackHeaderConfig.js.map +1 -1
- package/lib/commonjs/components/ScreenStackHeaderConfig.web.js.map +1 -1
- package/lib/commonjs/components/ScreenStackItem.js.map +1 -1
- package/lib/commonjs/components/SearchBar.js.map +1 -1
- package/lib/commonjs/components/helpers/usePrevious.js.map +1 -1
- package/lib/commonjs/gesture-handler/ScreenGestureDetector.js.map +1 -1
- package/lib/commonjs/index.js +0 -210
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/commonjs/native-stack/utils/AnimatedHeaderHeightContext.js.map +1 -1
- package/lib/commonjs/native-stack/utils/HeaderHeightContext.js.map +1 -1
- package/lib/commonjs/native-stack/utils/SafeAreaProviderCompat.js.map +1 -1
- package/lib/commonjs/native-stack/utils/useAnimatedHeaderHeight.js.map +1 -1
- package/lib/commonjs/native-stack/utils/useBackPressSubscription.js.map +1 -1
- package/lib/commonjs/native-stack/utils/useHeaderHeight.js.map +1 -1
- package/lib/commonjs/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedHeaderHeightContext.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedTransitionProgressContext.js.map +1 -1
- package/lib/commonjs/reanimated/useReanimatedHeaderHeight.js.map +1 -1
- package/lib/commonjs/reanimated/useReanimatedTransitionProgress.js.map +1 -1
- package/lib/commonjs/useTransitionProgress.js.map +1 -1
- package/lib/module/components/Screen.web.js.map +1 -1
- package/lib/module/components/ScreenStackHeaderConfig.js.map +1 -1
- package/lib/module/components/ScreenStackHeaderConfig.web.js.map +1 -1
- package/lib/module/components/SearchBar.js.map +1 -1
- package/lib/module/components/helpers/usePrevious.js.map +1 -1
- package/lib/module/native-stack/utils/useBackPressSubscription.js.map +1 -1
- package/lib/module/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/module/native-stack/views/NativeStackView.js.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/ScreenStackHeaderConfig.d.ts +5 -5
- package/lib/typescript/components/ScreenStackHeaderConfig.d.ts.map +1 -1
- package/lib/typescript/components/ScreenStackHeaderConfig.web.d.ts +6 -6
- package/lib/typescript/components/ScreenStackHeaderConfig.web.d.ts.map +1 -1
- package/lib/typescript/components/SearchBar.d.ts.map +1 -1
- package/lib/typescript/components/helpers/usePrevious.d.ts.map +1 -1
- package/lib/typescript/native-stack/utils/useBackPressSubscription.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/HeaderConfig.d.ts +2 -2
- 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/types.d.ts +2 -2
- package/lib/typescript/types.d.ts.map +1 -1
- package/oss-attribution/attribution.txt +77 -0
- package/oss-attribution/licenseInfos.json +27 -0
- package/package.json +1 -1
- package/src/index.tsx +0 -55
- package/SystemBundles/31d5b6b69618249f6233b73a1de7c4d890c86be7ccb031ce7cf2dcc41783f9f7.bundle +0 -45301
- package/SystemBundles/31d5b6b69618249f6233b73a1de7c4d890c86be7ccb031ce7cf2dcc41783f9f7.map +0 -13711
- package/lib/commonjs/TransitionProgressContext.js +0 -12
- package/lib/commonjs/components/DebugContainer.js +0 -39
- package/lib/commonjs/components/DebugContainer.web.js +0 -15
- package/lib/commonjs/components/FullWindowOverlay.js +0 -31
- package/lib/commonjs/components/FullWindowOverlay.web.js +0 -9
- package/lib/commonjs/components/Screen.js +0 -286
- package/lib/commonjs/components/Screen.web.js +0 -47
- package/lib/commonjs/components/ScreenContainer.js +0 -32
- package/lib/commonjs/components/ScreenContainer.web.js +0 -10
- package/lib/commonjs/components/ScreenContentWrapper.js +0 -17
- package/lib/commonjs/components/ScreenContentWrapper.web.js +0 -10
- package/lib/commonjs/components/ScreenFooter.js +0 -25
- package/lib/commonjs/components/ScreenFooter.web.js +0 -11
- package/lib/commonjs/components/ScreenStack.js +0 -67
- package/lib/commonjs/components/ScreenStack.web.js +0 -10
- package/lib/commonjs/components/ScreenStackHeaderConfig.js +0 -90
- package/lib/commonjs/components/ScreenStackHeaderConfig.web.js +0 -27
- package/lib/commonjs/components/ScreenStackItem.js +0 -107
- package/lib/commonjs/components/SearchBar.js +0 -63
- package/lib/commonjs/components/SearchBar.web.js +0 -10
- package/lib/commonjs/components/helpers/DelayedFreeze.js +0 -31
- package/lib/commonjs/components/helpers/usePrevious.js +0 -15
- package/lib/commonjs/contexts.js +0 -11
- package/lib/commonjs/core.js +0 -40
- package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js +0 -26
- package/lib/commonjs/fabric/ModalScreenNativeComponent.js +0 -14
- package/lib/commonjs/fabric/NativeScreensModule.js +0 -10
- package/lib/commonjs/fabric/NativeScreensModule.web.js +0 -8
- package/lib/commonjs/fabric/ScreenContainerNativeComponent.js +0 -30
- package/lib/commonjs/fabric/ScreenContentWrapperNativeComponent.js +0 -18
- package/lib/commonjs/fabric/ScreenFooterNativeComponent.js +0 -10
- package/lib/commonjs/fabric/ScreenNativeComponent.js +0 -70
- package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js +0 -12
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js +0 -32
- package/lib/commonjs/fabric/ScreenStackHeaderSubviewNativeComponent.js +0 -15
- package/lib/commonjs/fabric/ScreenStackNativeComponent.js +0 -32
- package/lib/commonjs/fabric/SearchBarNativeComponent.js +0 -18
- package/lib/commonjs/gesture-handler/GestureDetectorProvider.js +0 -19
- package/lib/commonjs/gesture-handler/RNScreensTurboModule.js +0 -8
- package/lib/commonjs/gesture-handler/ScreenGestureDetector.js +0 -201
- package/lib/commonjs/gesture-handler/constraints.js +0 -64
- package/lib/commonjs/gesture-handler/defaults.js +0 -45
- package/lib/commonjs/gesture-handler/fabricUtils.js +0 -66
- package/lib/commonjs/gesture-handler/fabricUtils.web.js +0 -17
- package/lib/commonjs/gesture-handler/index.js +0 -14
- package/lib/commonjs/native-stack/contexts/GHContext.js +0 -12
- package/lib/commonjs/native-stack/index.js +0 -49
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js +0 -76
- package/lib/commonjs/native-stack/types.js +0 -6
- package/lib/commonjs/native-stack/utils/AnimatedHeaderHeightContext.js +0 -12
- package/lib/commonjs/native-stack/utils/HeaderHeightContext.js +0 -12
- package/lib/commonjs/native-stack/utils/SafeAreaProviderCompat.js +0 -75
- package/lib/commonjs/native-stack/utils/getDefaultHeaderHeight.js +0 -35
- package/lib/commonjs/native-stack/utils/getStatusBarHeight.js +0 -22
- package/lib/commonjs/native-stack/utils/useAnimatedHeaderHeight.js +0 -19
- package/lib/commonjs/native-stack/utils/useBackPressSubscription.js +0 -52
- package/lib/commonjs/native-stack/utils/useHeaderHeight.js +0 -19
- package/lib/commonjs/native-stack/views/FontProcessor.js +0 -19
- package/lib/commonjs/native-stack/views/FooterComponent.js +0 -17
- package/lib/commonjs/native-stack/views/HeaderConfig.js +0 -149
- package/lib/commonjs/native-stack/views/NativeStackView.js +0 -420
- package/lib/commonjs/reanimated/ReanimatedHeaderHeightContext.js +0 -12
- package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js +0 -95
- package/lib/commonjs/reanimated/ReanimatedScreen.js +0 -22
- package/lib/commonjs/reanimated/ReanimatedScreenProvider.js +0 -39
- package/lib/commonjs/reanimated/ReanimatedTransitionProgressContext.js +0 -12
- package/lib/commonjs/reanimated/index.js +0 -28
- package/lib/commonjs/reanimated/useReanimatedHeaderHeight.js +0 -19
- package/lib/commonjs/reanimated/useReanimatedTransitionProgress.js +0 -19
- package/lib/commonjs/types.js +0 -6
- package/lib/commonjs/useTransitionProgress.js +0 -19
- package/lib/commonjs/utils.js +0 -43
- package/lib/module/TransitionProgressContext.js +0 -5
- package/lib/module/components/DebugContainer.js +0 -30
- package/lib/module/components/DebugContainer.web.js +0 -6
- package/lib/module/components/FullWindowOverlay.js +0 -24
- package/lib/module/components/FullWindowOverlay.web.js +0 -3
- package/lib/module/components/Screen.js +0 -282
- package/lib/module/components/Screen.web.js +0 -40
- package/lib/module/components/ScreenContainer.js +0 -26
- package/lib/module/components/ScreenContainer.web.js +0 -4
- package/lib/module/components/ScreenContentWrapper.js +0 -10
- package/lib/module/components/ScreenContentWrapper.web.js +0 -4
- package/lib/module/components/ScreenFooter.js +0 -18
- package/lib/module/components/ScreenFooter.web.js +0 -6
- package/lib/module/components/ScreenStack.js +0 -63
- package/lib/module/components/ScreenStack.web.js +0 -4
- package/lib/module/components/ScreenStackHeaderConfig.js +0 -81
- package/lib/module/components/ScreenStackHeaderConfig.web.js +0 -14
- package/lib/module/components/ScreenStackItem.js +0 -98
- package/lib/module/components/SearchBar.js +0 -57
- package/lib/module/components/SearchBar.web.js +0 -4
- package/lib/module/components/helpers/DelayedFreeze.js +0 -24
- package/lib/module/components/helpers/usePrevious.js +0 -9
- package/lib/module/contexts.js +0 -4
- package/lib/module/core.js +0 -31
- package/lib/module/fabric/FullWindowOverlayNativeComponent.js +0 -20
- package/lib/module/fabric/ModalScreenNativeComponent.js +0 -10
- package/lib/module/fabric/NativeScreensModule.js +0 -5
- package/lib/module/fabric/NativeScreensModule.web.js +0 -2
- package/lib/module/fabric/ScreenContainerNativeComponent.js +0 -24
- package/lib/module/fabric/ScreenContentWrapperNativeComponent.js +0 -10
- package/lib/module/fabric/ScreenFooterNativeComponent.js +0 -3
- package/lib/module/fabric/ScreenNativeComponent.js +0 -66
- package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js +0 -6
- package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js +0 -29
- package/lib/module/fabric/ScreenStackHeaderSubviewNativeComponent.js +0 -11
- package/lib/module/fabric/ScreenStackNativeComponent.js +0 -28
- package/lib/module/fabric/SearchBarNativeComponent.js +0 -12
- package/lib/module/gesture-handler/GestureDetectorProvider.js +0 -12
- package/lib/module/gesture-handler/RNScreensTurboModule.js +0 -2
- package/lib/module/gesture-handler/ScreenGestureDetector.js +0 -193
- package/lib/module/gesture-handler/constraints.js +0 -56
- package/lib/module/gesture-handler/defaults.js +0 -39
- package/lib/module/gesture-handler/fabricUtils.js +0 -61
- package/lib/module/gesture-handler/fabricUtils.web.js +0 -10
- package/lib/module/gesture-handler/index.js +0 -5
- package/lib/module/index.js +0 -33
- package/lib/module/native-stack/contexts/GHContext.js +0 -6
- package/lib/module/native-stack/index.js +0 -22
- package/lib/module/native-stack/navigators/createNativeStackNavigator.js +0 -73
- package/lib/module/native-stack/types.js +0 -2
- package/lib/module/native-stack/utils/AnimatedHeaderHeightContext.js +0 -4
- package/lib/module/native-stack/utils/HeaderHeightContext.js +0 -4
- package/lib/module/native-stack/utils/SafeAreaProviderCompat.js +0 -68
- package/lib/module/native-stack/utils/getDefaultHeaderHeight.js +0 -29
- package/lib/module/native-stack/utils/getStatusBarHeight.js +0 -16
- package/lib/module/native-stack/utils/useAnimatedHeaderHeight.js +0 -10
- package/lib/module/native-stack/utils/useBackPressSubscription.js +0 -45
- package/lib/module/native-stack/utils/useHeaderHeight.js +0 -10
- package/lib/module/native-stack/views/FontProcessor.js +0 -12
- package/lib/module/native-stack/views/FooterComponent.js +0 -10
- package/lib/module/native-stack/views/HeaderConfig.js +0 -139
- package/lib/module/native-stack/views/NativeStackView.js +0 -423
- package/lib/module/reanimated/ReanimatedHeaderHeightContext.js +0 -5
- package/lib/module/reanimated/ReanimatedNativeStackScreen.js +0 -93
- package/lib/module/reanimated/ReanimatedScreen.js +0 -16
- package/lib/module/reanimated/ReanimatedScreenProvider.js +0 -32
- package/lib/module/reanimated/ReanimatedTransitionProgressContext.js +0 -5
- package/lib/module/reanimated/index.js +0 -4
- package/lib/module/reanimated/useReanimatedHeaderHeight.js +0 -10
- package/lib/module/reanimated/useReanimatedTransitionProgress.js +0 -10
- package/lib/module/types.js +0 -2
- package/lib/module/useTransitionProgress.js +0 -10
- package/lib/module/utils.js +0 -35
- package/src/TransitionProgressContext.tsx +0 -14
- package/src/components/DebugContainer.tsx +0 -46
- package/src/components/DebugContainer.web.tsx +0 -7
- package/src/components/FullWindowOverlay.tsx +0 -33
- package/src/components/FullWindowOverlay.web.tsx +0 -6
- package/src/components/Screen.tsx +0 -392
- package/src/components/Screen.web.tsx +0 -46
- package/src/components/ScreenContainer.tsx +0 -28
- package/src/components/ScreenContainer.web.tsx +0 -5
- package/src/components/ScreenContentWrapper.tsx +0 -9
- package/src/components/ScreenContentWrapper.web.tsx +0 -5
- package/src/components/ScreenFooter.tsx +0 -20
- package/src/components/ScreenFooter.web.tsx +0 -7
- package/src/components/ScreenStack.tsx +0 -112
- package/src/components/ScreenStack.web.tsx +0 -5
- package/src/components/ScreenStackHeaderConfig.tsx +0 -122
- package/src/components/ScreenStackHeaderConfig.web.tsx +0 -39
- package/src/components/ScreenStackItem.tsx +0 -174
- package/src/components/SearchBar.tsx +0 -102
- package/src/components/SearchBar.web.tsx +0 -5
- package/src/components/helpers/DelayedFreeze.tsx +0 -27
- package/src/components/helpers/usePrevious.tsx +0 -11
- package/src/contexts.tsx +0 -9
- package/src/core.ts +0 -45
- package/src/fabric/FullWindowOverlayNativeComponent.ts +0 -23
- package/src/fabric/ModalScreenNativeComponent.ts +0 -115
- package/src/fabric/NativeScreensModule.ts +0 -8
- package/src/fabric/NativeScreensModule.web.ts +0 -1
- package/src/fabric/ScreenContainerNativeComponent.ts +0 -28
- package/src/fabric/ScreenContentWrapperNativeComponent.ts +0 -14
- package/src/fabric/ScreenFooterNativeComponent.ts +0 -6
- package/src/fabric/ScreenNativeComponent.ts +0 -171
- package/src/fabric/ScreenNavigationContainerNativeComponent.ts +0 -12
- package/src/fabric/ScreenStackHeaderConfigNativeComponent.ts +0 -97
- package/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts +0 -26
- package/src/fabric/ScreenStackNativeComponent.ts +0 -34
- package/src/fabric/SearchBarNativeComponent.ts +0 -83
- package/src/gesture-handler/GestureDetectorProvider.tsx +0 -16
- package/src/gesture-handler/RNScreensTurboModule.ts +0 -13
- package/src/gesture-handler/ScreenGestureDetector.tsx +0 -241
- package/src/gesture-handler/constraints.ts +0 -87
- package/src/gesture-handler/defaults.ts +0 -46
- package/src/gesture-handler/fabricUtils.ts +0 -86
- package/src/gesture-handler/fabricUtils.web.ts +0 -10
- package/src/gesture-handler/index.tsx +0 -4
- package/src/native-stack/contexts/GHContext.tsx +0 -9
- package/src/native-stack/index.tsx +0 -27
- package/src/native-stack/navigators/createNativeStackNavigator.tsx +0 -110
- package/src/native-stack/types.tsx +0 -659
- package/src/native-stack/utils/AnimatedHeaderHeightContext.tsx +0 -8
- package/src/native-stack/utils/HeaderHeightContext.tsx +0 -5
- package/src/native-stack/utils/SafeAreaProviderCompat.tsx +0 -78
- package/src/native-stack/utils/getDefaultHeaderHeight.tsx +0 -41
- package/src/native-stack/utils/getStatusBarHeight.tsx +0 -22
- package/src/native-stack/utils/useAnimatedHeaderHeight.tsx +0 -15
- package/src/native-stack/utils/useBackPressSubscription.tsx +0 -66
- package/src/native-stack/utils/useHeaderHeight.tsx +0 -15
- package/src/native-stack/views/FontProcessor.tsx +0 -14
- package/src/native-stack/views/FooterComponent.tsx +0 -10
- package/src/native-stack/views/HeaderConfig.tsx +0 -202
- package/src/native-stack/views/NativeStackView.tsx +0 -550
- package/src/reanimated/ReanimatedHeaderHeightContext.tsx +0 -7
- package/src/reanimated/ReanimatedNativeStackScreen.tsx +0 -132
- package/src/reanimated/ReanimatedScreen.tsx +0 -26
- package/src/reanimated/ReanimatedScreenProvider.tsx +0 -43
- package/src/reanimated/ReanimatedTransitionProgressContext.tsx +0 -13
- package/src/reanimated/index.tsx +0 -3
- package/src/reanimated/useReanimatedHeaderHeight.tsx +0 -14
- package/src/reanimated/useReanimatedTransitionProgress.tsx +0 -14
- package/src/types.tsx +0 -869
- package/src/useTransitionProgress.tsx +0 -15
- package/src/utils.ts +0 -40
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Portions of this file are copyright (c) 2023 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* PORTIONS OF THIS FILE ARE AMAZON PROPRIETARY/CONFIDENTIAL. USE IS SUBJECT TO LICENSE TERMS.
|
|
5
|
-
*
|
|
6
|
-
* Amazon modifications are indicated by [amznmod_* comments].
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* Changelog:
|
|
11
|
-
* Set up react-native-screens package to build for Kepler
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// code taken from
|
|
16
|
-
// https://github.com/react-navigation/react-navigation/blob/ec0d113eb25c39ef9defb6c7215640f44e3569ae/packages/elements/src/SafeAreaProviderCompat.tsx
|
|
17
|
-
import * as React from 'react';
|
|
18
|
-
import {
|
|
19
|
-
Dimensions,
|
|
20
|
-
Platform,
|
|
21
|
-
StyleProp,
|
|
22
|
-
StyleSheet,
|
|
23
|
-
View,
|
|
24
|
-
ViewStyle,
|
|
25
|
-
} from 'react-native';
|
|
26
|
-
import {
|
|
27
|
-
initialWindowMetrics,
|
|
28
|
-
SafeAreaInsetsContext,
|
|
29
|
-
SafeAreaProvider,
|
|
30
|
-
// amznmod_react - change imports to kepler packages
|
|
31
|
-
} from '@amazon-devices/react-native-safe-area-context';
|
|
32
|
-
|
|
33
|
-
type Props = {
|
|
34
|
-
children: React.ReactNode;
|
|
35
|
-
style?: StyleProp<ViewStyle>;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const { width = 0, height = 0 } = Dimensions.get('window');
|
|
39
|
-
|
|
40
|
-
// To support SSR on web, we need to have empty insets for initial values
|
|
41
|
-
// Otherwise there can be mismatch between SSR and client output
|
|
42
|
-
// We also need to specify empty values to support tests environments
|
|
43
|
-
const initialMetrics =
|
|
44
|
-
Platform.OS === 'web' || initialWindowMetrics == null
|
|
45
|
-
? {
|
|
46
|
-
frame: { x: 0, y: 0, width, height },
|
|
47
|
-
insets: { top: 0, left: 0, right: 0, bottom: 0 },
|
|
48
|
-
}
|
|
49
|
-
: initialWindowMetrics;
|
|
50
|
-
|
|
51
|
-
export default function SafeAreaProviderCompat({ children, style }: Props) {
|
|
52
|
-
return (
|
|
53
|
-
<SafeAreaInsetsContext.Consumer>
|
|
54
|
-
{insets => {
|
|
55
|
-
if (insets) {
|
|
56
|
-
// If we already have insets, don't wrap the stack in another safe area provider
|
|
57
|
-
// This avoids an issue with updates at the cost of potentially incorrect values
|
|
58
|
-
// https://github.com/react-navigation/react-navigation/issues/174
|
|
59
|
-
return <View style={[styles.container, style]}>{children}</View>;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<SafeAreaProvider initialMetrics={initialMetrics} style={style}>
|
|
64
|
-
{children}
|
|
65
|
-
</SafeAreaProvider>
|
|
66
|
-
);
|
|
67
|
-
}}
|
|
68
|
-
</SafeAreaInsetsContext.Consumer>
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
SafeAreaProviderCompat.initialMetrics = initialMetrics;
|
|
73
|
-
|
|
74
|
-
const styles = StyleSheet.create({
|
|
75
|
-
container: {
|
|
76
|
-
flex: 1,
|
|
77
|
-
},
|
|
78
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Platform } from 'react-native';
|
|
2
|
-
import { StackPresentationTypes } from '../../types';
|
|
3
|
-
type Layout = { width: number; height: number };
|
|
4
|
-
|
|
5
|
-
const formSheetModalHeight = 56;
|
|
6
|
-
|
|
7
|
-
export default function getDefaultHeaderHeight(
|
|
8
|
-
layout: Layout,
|
|
9
|
-
statusBarHeight: number,
|
|
10
|
-
stackPresentation: StackPresentationTypes,
|
|
11
|
-
isLargeHeader = false,
|
|
12
|
-
): number {
|
|
13
|
-
// default header heights
|
|
14
|
-
let headerHeight = Platform.OS === 'android' ? 56 : 64;
|
|
15
|
-
|
|
16
|
-
if (Platform.OS === 'ios') {
|
|
17
|
-
const isLandscape = layout.width > layout.height;
|
|
18
|
-
const isFormSheetModal =
|
|
19
|
-
stackPresentation === 'modal' || stackPresentation === 'formSheet';
|
|
20
|
-
if (isFormSheetModal && !isLandscape) {
|
|
21
|
-
// `modal` and `formSheet` presentations do not take whole screen, so should not take the inset.
|
|
22
|
-
statusBarHeight = 0;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (Platform.isPad || Platform.isTV) {
|
|
26
|
-
headerHeight = isFormSheetModal ? formSheetModalHeight : 50;
|
|
27
|
-
} else {
|
|
28
|
-
if (isLandscape) {
|
|
29
|
-
headerHeight = 32;
|
|
30
|
-
} else {
|
|
31
|
-
if (isFormSheetModal) {
|
|
32
|
-
headerHeight = formSheetModalHeight;
|
|
33
|
-
} else {
|
|
34
|
-
headerHeight = isLargeHeader ? 96 : 44;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return headerHeight + statusBarHeight;
|
|
41
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Rect } from 'react-native-safe-area-context';
|
|
2
|
-
import { Platform } from 'react-native';
|
|
3
|
-
|
|
4
|
-
export default function getStatusBarHeight(
|
|
5
|
-
topInset: number,
|
|
6
|
-
dimensions: Rect,
|
|
7
|
-
isStatusBarTranslucent: boolean,
|
|
8
|
-
) {
|
|
9
|
-
if (Platform.OS === 'ios') {
|
|
10
|
-
// It looks like some iOS devices don't have strictly set status bar height to 44.
|
|
11
|
-
// Thus, if the top inset is higher than 50, then the device should have a dynamic island.
|
|
12
|
-
// On models with Dynamic Island the status bar height is smaller than the safe area top inset by 5 pixels.
|
|
13
|
-
// See https://developer.apple.com/forums/thread/662466 for more details about status bar height.
|
|
14
|
-
const hasDynamicIsland = topInset > 50;
|
|
15
|
-
return hasDynamicIsland ? topInset - 5 : topInset;
|
|
16
|
-
} else if (Platform.OS === 'android') {
|
|
17
|
-
// On Android we should also rely on frame's y-axis position, as topInset is 0 on visible status bar.
|
|
18
|
-
return isStatusBarTranslucent ? topInset : dimensions.y;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return topInset;
|
|
22
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import AnimatedHeaderHeightContext from './AnimatedHeaderHeightContext';
|
|
4
|
-
|
|
5
|
-
export default function useAnimatedHeaderHeight() {
|
|
6
|
-
const animatedValue = React.useContext(AnimatedHeaderHeightContext);
|
|
7
|
-
|
|
8
|
-
if (animatedValue === undefined) {
|
|
9
|
-
throw new Error(
|
|
10
|
-
"Couldn't find the header height. Are you inside a screen in a navigator with a header?",
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return animatedValue;
|
|
15
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BackHandler, NativeEventSubscription } from 'react-native';
|
|
3
|
-
|
|
4
|
-
interface Args {
|
|
5
|
-
onBackPress: () => boolean;
|
|
6
|
-
isDisabled: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface UseBackPressSubscription {
|
|
10
|
-
handleAttached: () => void;
|
|
11
|
-
handleDetached: () => void;
|
|
12
|
-
createSubscription: () => void;
|
|
13
|
-
clearSubscription: () => void;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* This hook is an abstraction for keeping back press subscription
|
|
18
|
-
* logic in one place.
|
|
19
|
-
*/
|
|
20
|
-
export function useBackPressSubscription({
|
|
21
|
-
onBackPress,
|
|
22
|
-
isDisabled,
|
|
23
|
-
}: Args): UseBackPressSubscription {
|
|
24
|
-
const [isActive, setIsActive] = React.useState(false);
|
|
25
|
-
const subscription = React.useRef<NativeEventSubscription | undefined>();
|
|
26
|
-
|
|
27
|
-
const clearSubscription = React.useCallback((shouldSetActive = true) => {
|
|
28
|
-
subscription.current?.remove();
|
|
29
|
-
subscription.current = undefined;
|
|
30
|
-
if (shouldSetActive) setIsActive(false);
|
|
31
|
-
}, []);
|
|
32
|
-
|
|
33
|
-
const createSubscription = React.useCallback(() => {
|
|
34
|
-
if (!isDisabled) {
|
|
35
|
-
subscription.current?.remove();
|
|
36
|
-
subscription.current = BackHandler.addEventListener(
|
|
37
|
-
'hardwareBackPress',
|
|
38
|
-
onBackPress,
|
|
39
|
-
);
|
|
40
|
-
setIsActive(true);
|
|
41
|
-
}
|
|
42
|
-
}, [isDisabled, onBackPress]);
|
|
43
|
-
|
|
44
|
-
const handleAttached = React.useCallback(() => {
|
|
45
|
-
if (isActive) {
|
|
46
|
-
createSubscription();
|
|
47
|
-
}
|
|
48
|
-
}, [createSubscription, isActive]);
|
|
49
|
-
|
|
50
|
-
const handleDetached = React.useCallback(() => {
|
|
51
|
-
clearSubscription(false);
|
|
52
|
-
}, [clearSubscription]);
|
|
53
|
-
|
|
54
|
-
React.useEffect(() => {
|
|
55
|
-
if (isDisabled) {
|
|
56
|
-
clearSubscription();
|
|
57
|
-
}
|
|
58
|
-
}, [isDisabled, clearSubscription]);
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
handleAttached,
|
|
62
|
-
handleDetached,
|
|
63
|
-
createSubscription,
|
|
64
|
-
clearSubscription,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import HeaderHeightContext from './HeaderHeightContext';
|
|
4
|
-
|
|
5
|
-
export default function useHeaderHeight() {
|
|
6
|
-
const height = React.useContext(HeaderHeightContext);
|
|
7
|
-
|
|
8
|
-
if (height === undefined) {
|
|
9
|
-
throw new Error(
|
|
10
|
-
"Couldn't find the header height. Are you inside a screen in a navigator with a header?",
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return height;
|
|
15
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// @ts-ignore: No declaration available
|
|
2
|
-
|
|
3
|
-
import ReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes';
|
|
4
|
-
|
|
5
|
-
export function processFonts(
|
|
6
|
-
fontFamilies: (string | undefined)[],
|
|
7
|
-
): (string | undefined)[] {
|
|
8
|
-
// @ts-ignore: React Native types are incorrect here and don't consider fontFamily a style value
|
|
9
|
-
const fontFamilyProcessor = ReactNativeStyleAttributes.fontFamily?.process;
|
|
10
|
-
if (typeof fontFamilyProcessor === 'function') {
|
|
11
|
-
return fontFamilies.map(fontFamilyProcessor);
|
|
12
|
-
}
|
|
13
|
-
return fontFamilies;
|
|
14
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ScreenFooter from '../../components/ScreenFooter';
|
|
3
|
-
|
|
4
|
-
type FooterProps = {
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default function FooterComponent({ children }: FooterProps) {
|
|
9
|
-
return <ScreenFooter collapsable={false}>{children}</ScreenFooter>;
|
|
10
|
-
}
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Portions of this file are copyright (c) 2023 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* PORTIONS OF THIS FILE ARE AMAZON PROPRIETARY/CONFIDENTIAL. USE IS SUBJECT TO LICENSE TERMS.
|
|
5
|
-
*
|
|
6
|
-
* Amazon modifications are indicated by [amznmod_* comments].
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* Changelog:
|
|
11
|
-
* Set up react-native-screens package to build for Kepler
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
// amznmod_react - change imports to kepler packages
|
|
15
|
-
import { Route, useTheme } from '@amazon-devices/react-navigation__native';
|
|
16
|
-
import * as React from 'react';
|
|
17
|
-
import { Platform } from 'react-native';
|
|
18
|
-
import { SearchBarProps } from '../../types';
|
|
19
|
-
import {
|
|
20
|
-
isSearchBarAvailableForCurrentPlatform,
|
|
21
|
-
executeNativeBackPress,
|
|
22
|
-
} from '../../utils';
|
|
23
|
-
import {
|
|
24
|
-
ScreenStackHeaderBackButtonImage,
|
|
25
|
-
ScreenStackHeaderCenterView,
|
|
26
|
-
ScreenStackHeaderConfig,
|
|
27
|
-
ScreenStackHeaderLeftView,
|
|
28
|
-
ScreenStackHeaderRightView,
|
|
29
|
-
ScreenStackHeaderSearchBarView,
|
|
30
|
-
} from '../../components/ScreenStackHeaderConfig';
|
|
31
|
-
import SearchBar from '../../components/SearchBar';
|
|
32
|
-
import { NativeStackNavigationOptions } from '../types';
|
|
33
|
-
import { useBackPressSubscription } from '../utils/useBackPressSubscription';
|
|
34
|
-
import { processFonts } from './FontProcessor';
|
|
35
|
-
import warnOnce from 'warn-once';
|
|
36
|
-
|
|
37
|
-
type Props = NativeStackNavigationOptions & {
|
|
38
|
-
route: Route<string>;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default function HeaderConfig({
|
|
42
|
-
backButtonImage,
|
|
43
|
-
backButtonInCustomView,
|
|
44
|
-
direction,
|
|
45
|
-
disableBackButtonMenu,
|
|
46
|
-
backButtonDisplayMode = 'default',
|
|
47
|
-
headerBackTitle,
|
|
48
|
-
headerBackTitleStyle = {},
|
|
49
|
-
headerBackTitleVisible = true,
|
|
50
|
-
headerCenter,
|
|
51
|
-
headerHideBackButton,
|
|
52
|
-
headerHideShadow,
|
|
53
|
-
headerLargeStyle = {},
|
|
54
|
-
headerLargeTitle,
|
|
55
|
-
headerLargeTitleHideShadow,
|
|
56
|
-
headerLargeTitleStyle = {},
|
|
57
|
-
headerLeft,
|
|
58
|
-
headerRight,
|
|
59
|
-
headerShown,
|
|
60
|
-
headerStyle = {},
|
|
61
|
-
headerTintColor,
|
|
62
|
-
headerTitle,
|
|
63
|
-
headerTitleStyle = {},
|
|
64
|
-
headerTopInsetEnabled = true,
|
|
65
|
-
headerTranslucent,
|
|
66
|
-
route,
|
|
67
|
-
searchBar,
|
|
68
|
-
title,
|
|
69
|
-
}: Props): JSX.Element {
|
|
70
|
-
const { colors } = useTheme();
|
|
71
|
-
const tintColor = headerTintColor ?? colors.primary;
|
|
72
|
-
|
|
73
|
-
// We need to use back press subscription here to override back button behavior on JS side.
|
|
74
|
-
// Because screens are usually used with react-navigation and this library overrides back button
|
|
75
|
-
// we need to handle it first in case when search bar is open
|
|
76
|
-
const {
|
|
77
|
-
handleAttached,
|
|
78
|
-
handleDetached,
|
|
79
|
-
clearSubscription,
|
|
80
|
-
createSubscription,
|
|
81
|
-
} = useBackPressSubscription({
|
|
82
|
-
onBackPress: executeNativeBackPress,
|
|
83
|
-
isDisabled: !searchBar || !!searchBar.disableBackButtonOverride,
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
const [backTitleFontFamily, largeTitleFontFamily, titleFontFamily] =
|
|
87
|
-
processFonts([
|
|
88
|
-
headerBackTitleStyle.fontFamily,
|
|
89
|
-
headerLargeTitleStyle.fontFamily,
|
|
90
|
-
headerTitleStyle.fontFamily,
|
|
91
|
-
]);
|
|
92
|
-
|
|
93
|
-
// We want to clear clearSubscription only when components unmounts or search bar changes
|
|
94
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
95
|
-
React.useEffect(() => clearSubscription, [searchBar]);
|
|
96
|
-
|
|
97
|
-
const processedSearchBarOptions = React.useMemo(() => {
|
|
98
|
-
if (
|
|
99
|
-
Platform.OS === 'android' &&
|
|
100
|
-
searchBar &&
|
|
101
|
-
!searchBar.disableBackButtonOverride
|
|
102
|
-
) {
|
|
103
|
-
const onFocus: SearchBarProps['onFocus'] = (...args) => {
|
|
104
|
-
createSubscription();
|
|
105
|
-
searchBar.onFocus?.(...args);
|
|
106
|
-
};
|
|
107
|
-
const onClose: SearchBarProps['onClose'] = (...args) => {
|
|
108
|
-
clearSubscription();
|
|
109
|
-
searchBar.onClose?.(...args);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
return { ...searchBar, onFocus, onClose };
|
|
113
|
-
}
|
|
114
|
-
return searchBar;
|
|
115
|
-
}, [searchBar, createSubscription, clearSubscription]);
|
|
116
|
-
|
|
117
|
-
// @ts-ignore isVision is not yet in the type definitions (RN 0.74+)
|
|
118
|
-
const isVisionOS = Platform?.isVision;
|
|
119
|
-
|
|
120
|
-
warnOnce(
|
|
121
|
-
isVisionOS &&
|
|
122
|
-
(headerTitleStyle.color !== undefined || headerTintColor !== undefined),
|
|
123
|
-
'headerTitleStyle.color and headerTintColor are not supported on visionOS.',
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
return (
|
|
127
|
-
<ScreenStackHeaderConfig
|
|
128
|
-
backButtonInCustomView={backButtonInCustomView}
|
|
129
|
-
backgroundColor={
|
|
130
|
-
headerStyle.backgroundColor ? headerStyle.backgroundColor : colors.card
|
|
131
|
-
}
|
|
132
|
-
backTitle={headerBackTitle}
|
|
133
|
-
backTitleFontFamily={backTitleFontFamily}
|
|
134
|
-
backTitleFontSize={headerBackTitleStyle.fontSize}
|
|
135
|
-
backTitleVisible={headerBackTitleVisible}
|
|
136
|
-
blurEffect={headerStyle.blurEffect}
|
|
137
|
-
color={tintColor}
|
|
138
|
-
direction={direction}
|
|
139
|
-
disableBackButtonMenu={disableBackButtonMenu}
|
|
140
|
-
backButtonDisplayMode={backButtonDisplayMode}
|
|
141
|
-
hidden={headerShown === false}
|
|
142
|
-
hideBackButton={headerHideBackButton}
|
|
143
|
-
hideShadow={headerHideShadow}
|
|
144
|
-
largeTitle={headerLargeTitle}
|
|
145
|
-
largeTitleBackgroundColor={headerLargeStyle.backgroundColor}
|
|
146
|
-
largeTitleColor={headerLargeTitleStyle.color}
|
|
147
|
-
largeTitleFontFamily={largeTitleFontFamily}
|
|
148
|
-
largeTitleFontSize={headerLargeTitleStyle.fontSize}
|
|
149
|
-
largeTitleFontWeight={headerLargeTitleStyle.fontWeight}
|
|
150
|
-
largeTitleHideShadow={headerLargeTitleHideShadow}
|
|
151
|
-
title={
|
|
152
|
-
headerTitle !== undefined
|
|
153
|
-
? headerTitle
|
|
154
|
-
: title !== undefined
|
|
155
|
-
? title
|
|
156
|
-
: route.name
|
|
157
|
-
}
|
|
158
|
-
titleColor={
|
|
159
|
-
headerTitleStyle.color !== undefined
|
|
160
|
-
? headerTitleStyle.color
|
|
161
|
-
: headerTintColor !== undefined
|
|
162
|
-
? headerTintColor
|
|
163
|
-
: colors.text
|
|
164
|
-
}
|
|
165
|
-
titleFontFamily={titleFontFamily}
|
|
166
|
-
titleFontSize={headerTitleStyle.fontSize}
|
|
167
|
-
titleFontWeight={headerTitleStyle.fontWeight}
|
|
168
|
-
topInsetEnabled={headerTopInsetEnabled}
|
|
169
|
-
translucent={headerTranslucent === true}
|
|
170
|
-
onAttached={handleAttached}
|
|
171
|
-
onDetached={handleDetached}>
|
|
172
|
-
{headerRight !== undefined ? (
|
|
173
|
-
<ScreenStackHeaderRightView>
|
|
174
|
-
{headerRight({ tintColor })}
|
|
175
|
-
</ScreenStackHeaderRightView>
|
|
176
|
-
) : null}
|
|
177
|
-
{backButtonImage !== undefined ? (
|
|
178
|
-
<ScreenStackHeaderBackButtonImage
|
|
179
|
-
key="backImage"
|
|
180
|
-
source={backButtonImage}
|
|
181
|
-
/>
|
|
182
|
-
) : null}
|
|
183
|
-
{headerLeft !== undefined ? (
|
|
184
|
-
<ScreenStackHeaderLeftView>
|
|
185
|
-
{headerLeft({ tintColor })}
|
|
186
|
-
</ScreenStackHeaderLeftView>
|
|
187
|
-
) : null}
|
|
188
|
-
{headerCenter !== undefined ? (
|
|
189
|
-
<ScreenStackHeaderCenterView>
|
|
190
|
-
{headerCenter({ tintColor })}
|
|
191
|
-
</ScreenStackHeaderCenterView>
|
|
192
|
-
) : null}
|
|
193
|
-
{isSearchBarAvailableForCurrentPlatform &&
|
|
194
|
-
processedSearchBarOptions !== undefined ? (
|
|
195
|
-
<ScreenStackHeaderSearchBarView>
|
|
196
|
-
{/* @ts-ignore Skip incorrect error about incompatible ref types */}
|
|
197
|
-
<SearchBar {...processedSearchBarOptions} />
|
|
198
|
-
</ScreenStackHeaderSearchBarView>
|
|
199
|
-
) : null}
|
|
200
|
-
</ScreenStackHeaderConfig>
|
|
201
|
-
);
|
|
202
|
-
}
|