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": {
"@react-native-community/bob": "^0.16.2",
"@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/react": "^16.9.53",
"@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]}
pointerEvents="box-none"
style={
Object {
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
}
Array [
Object {
"overflow": undefined,
},
Object {
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
]
}
transitionSpec={
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
onLayout={[Function]}
style={
@@ -324,13 +435,18 @@ exports[`Nested navigators renders succesfully as direct child 1`] = `
onTransitionStart={[Function]}
pointerEvents="box-none"
style={
Object {
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
}
Array [
Object {
"overflow": undefined,
},
Object {
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
]
}
transitionSpec={
Object {
@@ -365,7 +481,6 @@ exports[`Nested navigators renders succesfully as direct child 1`] = `
style={
Object {
"flex": 1,
"marginTop": 0,
}
}
>
@@ -454,19 +569,6 @@ exports[`Nested navigators renders succesfully as direct child 1`] = `
</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 File

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

View File

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

View File

@@ -217,7 +217,14 @@ function CardContainer({
pageOverflowEnabled={headerMode === 'screen' && mode === 'card'}
containerStyle={hasAbsoluteHeader ? { marginTop: headerHeight } : null}
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.scene}>

View File

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