chore: sync latest stack

This commit is contained in:
Satyajit Sahoo
2020-11-10 21:10:31 +01:00
parent f10543f9fc
commit db24639445
8 changed files with 174 additions and 64 deletions

View File

@@ -45,7 +45,7 @@
"devDependencies": { "devDependencies": {
"@react-native-community/bob": "^0.16.2", "@react-native-community/bob": "^0.16.2",
"@react-native-community/masked-view": "0.1.10", "@react-native-community/masked-view": "0.1.10",
"@react-navigation/stack": "^5.12.3", "@react-navigation/stack": "^5.12.6",
"@types/color": "^3.0.1", "@types/color": "^3.0.1",
"@types/react": "^16.9.53", "@types/react": "^16.9.53",
"@types/react-native": "^0.63.30", "@types/react-native": "^0.63.30",

Binary file not shown.

View File

@@ -155,13 +155,18 @@ exports[`Nested navigators renders succesfully as direct child 1`] = `
onTransitionStart={[Function]} onTransitionStart={[Function]}
pointerEvents="box-none" pointerEvents="box-none"
style={ style={
Object { Array [
"bottom": 0, Object {
"left": 0, "overflow": undefined,
"position": "absolute", },
"right": 0, Object {
"top": 0, "bottom": 0,
} "left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
]
} }
transitionSpec={ transitionSpec={
Object { Object {
@@ -283,6 +288,112 @@ exports[`Nested navigators renders succesfully as direct child 1`] = `
} }
} }
> >
<View
pointerEvents="box-none"
style={
Object {
"zIndex": 1,
}
}
>
<View
accessibilityElementsHidden={false}
importantForAccessibility="auto"
onLayout={[Function]}
pointerEvents="box-none"
style={null}
>
<View
pointerEvents="box-none"
style={
Object {
"bottom": 0,
"left": 0,
"opacity": 1,
"position": "absolute",
"right": 0,
"top": 0,
"zIndex": 0,
}
}
>
<View
style={
Object {
"backgroundColor": "#fff",
"borderBottomColor": "#a7a7aa",
"flex": 1,
"shadowColor": "#a7a7aa",
"shadowOffset": Object {
"height": 0.5,
"width": 0,
},
"shadowOpacity": 0.85,
"shadowRadius": 0,
}
}
/>
</View>
<View
pointerEvents="box-none"
style={
Object {
"height": 44,
"maxHeight": undefined,
"minHeight": undefined,
"opacity": undefined,
"transform": undefined,
}
}
>
<View
pointerEvents="none"
style={
Object {
"height": 0,
}
}
/>
<View
pointerEvents="box-none"
style={
Object {
"alignItems": "center",
"flex": 1,
"flexDirection": "row",
"justifyContent": "center",
}
}
>
<View
pointerEvents="box-none"
style={
Object {
"marginHorizontal": 16,
"opacity": 1,
}
}
>
<Text
accessibilityRole="header"
aria-level="1"
numberOfLines={1}
onLayout={[Function]}
style={
Object {
"color": "rgba(0, 0, 0, 0.9)",
"fontSize": 17,
"fontWeight": "600",
}
}
>
Home
</Text>
</View>
</View>
</View>
</View>
</View>
<View <View
onLayout={[Function]} onLayout={[Function]}
style={ style={
@@ -324,13 +435,18 @@ exports[`Nested navigators renders succesfully as direct child 1`] = `
onTransitionStart={[Function]} onTransitionStart={[Function]}
pointerEvents="box-none" pointerEvents="box-none"
style={ style={
Object { Array [
"bottom": 0, Object {
"left": 0, "overflow": undefined,
"position": "absolute", },
"right": 0, Object {
"top": 0, "bottom": 0,
} "left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
]
} }
transitionSpec={ transitionSpec={
Object { Object {
@@ -365,7 +481,6 @@ exports[`Nested navigators renders succesfully as direct child 1`] = `
style={ style={
Object { Object {
"flex": 1, "flex": 1,
"marginTop": 0,
} }
} }
> >
@@ -454,19 +569,6 @@ exports[`Nested navigators renders succesfully as direct child 1`] = `
</View> </View>
</View> </View>
</View> </View>
<View
pointerEvents="box-none"
style={
Object {
"height": 44,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
"zIndex": 1,
}
}
/>
</View> </View>
</View> </View>
</View> </View>

View File

@@ -172,13 +172,18 @@ exports[`StackNavigator applies correct values when headerRight is present 1`] =
onTransitionStart={[Function]} onTransitionStart={[Function]}
pointerEvents="box-none" pointerEvents="box-none"
style={ style={
Object { Array [
"bottom": 0, Object {
"left": 0, "overflow": undefined,
"position": "absolute", },
"right": 0, Object {
"top": 0, "bottom": 0,
} "left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
]
} }
transitionSpec={ transitionSpec={
Object { Object {
@@ -460,13 +465,18 @@ exports[`StackNavigator renders successfully 1`] = `
onTransitionStart={[Function]} onTransitionStart={[Function]}
pointerEvents="box-none" pointerEvents="box-none"
style={ style={
Object { Array [
"bottom": 0, Object {
"left": 0, "overflow": undefined,
"position": "absolute", },
"right": 0, Object {
"top": 0, "bottom": 0,
} "left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
]
} }
transitionSpec={ transitionSpec={
Object { Object {

View File

@@ -10,7 +10,6 @@ import {
forNoAnimation, forNoAnimation,
forSlideRight, forSlideRight,
} from '../../TransitionConfigs/HeaderStyleInterpolators'; } from '../../TransitionConfigs/HeaderStyleInterpolators';
import HeaderShownContext from '../../utils/HeaderShownContext';
import PreviousSceneContext from '../../utils/PreviousSceneContext'; import PreviousSceneContext from '../../utils/PreviousSceneContext';
import type { import type {
Layout, Layout,
@@ -52,7 +51,6 @@ export default function HeaderContainer({
style, style,
}: Props) { }: Props) {
const focusedRoute = getFocusedRoute(); const focusedRoute = getFocusedRoute();
const isParentHeaderShown = React.useContext(HeaderShownContext);
const parentPreviousScene = React.useContext(PreviousSceneContext); const parentPreviousScene = React.useContext(PreviousSceneContext);
return ( return (
@@ -62,11 +60,8 @@ export default function HeaderContainer({
return null; return null;
} }
const { const { header, headerShown = true, headerTransparent } =
header, scene.descriptor.options || {};
headerShown = isParentHeaderShown === false,
headerTransparent,
} = scene.descriptor.options || {};
if (!headerShown) { if (!headerShown) {
return null; return null;
@@ -81,11 +76,10 @@ export default function HeaderContainer({
const previousScene = self[i - 1]; const previousScene = self[i - 1];
const nextScene = self[i + 1]; const nextScene = self[i + 1];
const { const { headerShown: previousHeaderShown = true } =
headerShown: previousHeaderShown = isParentHeaderShown === false, previousScene?.descriptor.options || {};
} = previousScene?.descriptor.options || {};
const { headerShown: nextHeaderShown = isParentHeaderShown === false } = const { headerShown: nextHeaderShown = true } =
nextScene?.descriptor.options || {}; nextScene?.descriptor.options || {};
const isHeaderStatic = const isHeaderStatic =

View File

@@ -217,7 +217,14 @@ function CardContainer({
pageOverflowEnabled={headerMode === 'screen' && mode === 'card'} pageOverflowEnabled={headerMode === 'screen' && mode === 'card'}
containerStyle={hasAbsoluteHeader ? { marginTop: headerHeight } : null} containerStyle={hasAbsoluteHeader ? { marginTop: headerHeight } : null}
contentStyle={[{ backgroundColor: colors.background }, cardStyle]} contentStyle={[{ backgroundColor: colors.background }, cardStyle]}
style={StyleSheet.absoluteFill} style={[
{
// This is necessary to avoid unfocused larger pages increasing scroll area
// The issue can be seen on the web when a smaller screen is pushed over a larger one
overflow: active ? undefined : 'hidden',
},
StyleSheet.absoluteFill,
]}
> >
<View style={styles.container}> <View style={styles.container}>
<View style={styles.scene}> <View style={styles.scene}>

View File

@@ -444,10 +444,7 @@ export default class CardStack extends React.Component<Props, State> {
? this.state.scenes.slice(-2).some((scene) => { ? this.state.scenes.slice(-2).some((scene) => {
const { descriptor } = scene; const { descriptor } = scene;
const options = descriptor ? descriptor.options : {}; const options = descriptor ? descriptor.options : {};
const { const { headerTransparent, headerShown = true } = options;
headerTransparent,
headerShown = isParentHeaderShown === false,
} = options;
if (headerTransparent || headerShown === false) { if (headerTransparent || headerShown === false) {
return true; return true;
@@ -539,7 +536,7 @@ export default class CardStack extends React.Component<Props, State> {
const { const {
safeAreaInsets, safeAreaInsets,
headerShown = isParentHeaderShown === false, headerShown = true,
headerTransparent, headerTransparent,
cardShadowEnabled, cardShadowEnabled,
cardOverlayEnabled, cardOverlayEnabled,

View File

@@ -4179,10 +4179,10 @@
resolved "https://registry.yarnpkg.com/@react-native-community/masked-view/-/masked-view-0.1.10.tgz#5dda643e19e587793bc2034dd9bf7398ad43d401" resolved "https://registry.yarnpkg.com/@react-native-community/masked-view/-/masked-view-0.1.10.tgz#5dda643e19e587793bc2034dd9bf7398ad43d401"
integrity sha512-rk4sWFsmtOw8oyx8SD3KSvawwaK7gRBSEIy2TAwURyGt+3TizssXP1r8nx3zY+R7v2vYYHXZ+k2/GULAT/bcaQ== integrity sha512-rk4sWFsmtOw8oyx8SD3KSvawwaK7gRBSEIy2TAwURyGt+3TizssXP1r8nx3zY+R7v2vYYHXZ+k2/GULAT/bcaQ==
"@react-navigation/stack@^5.12.3": "@react-navigation/stack@^5.12.6":
version "5.12.3" version "5.12.6"
resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.12.3.tgz#a9ad55b9ab8c2337a6298e92d5c38dc376cdfe83" resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.12.6.tgz#a6f2caf66da78ad2afa80f7a960c36db6b83bcff"
integrity sha512-qJBX6+3JKFi252b/98eijCM2yB+t5GVvZjod3lWpl+44By5EAo4gMGlAVTXbLBLqDEE+LDtHRFE3AMt1IjLVmw== integrity sha512-pf9AigAIVtCQuCpZAZqBux4kNqQwj98ngvd6JEryFrqTQ1CYsUH6jfpQE7SKyHggVRFSQVMf24aCgwtRixBvjw==
dependencies: dependencies:
color "^3.1.3" color "^3.1.3"
react-native-iphone-x-helper "^1.3.0" react-native-iphone-x-helper "^1.3.0"