Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 51 additions & 21 deletions apps/src/tests/Test3336.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ import { Spacer } from '../shared';
import Colors from '../shared/styling/Colors';
import { Edge, SafeAreaView } from 'react-native-screens/experimental';

/**
* Changelog:
*
* #3503 - Add toggle for `sheetShouldOverflowTopInset` - allowing testing SAV integration with FormSheet that overlaps top inset.
* If `sheetShouldOverflowTopInset` is true - FormSheet with max detent should overflow the content with system bars, unless
* SafeAreaView insets are enabled.
* #3435 - Add example for testing pressables when TextInput changed Sheet translation on keyboard appear/disappear
* #3336 - Add example covering all FormSheet detents - SAV pairs
*
*/

type StackParamList = {
Main: undefined;
FormSheetWithFitToContents: undefined;
Expand All @@ -45,10 +56,12 @@ const Stack = createNativeStackNavigator<StackParamList>();
type MainProps = {
navigation: NativeStackNavigationProp<StackParamList, 'Main'>;
useSafeArea: boolean;
shouldOverflowTopInset: boolean;
edges: Partial<Record<Edge, boolean>>;
toggleSafeArea: () => void;
toggleTopEdge: () => void;
toggleBottomEdge: () => void;
toggleOverflowTopInset: () => void;
};

const EXAMPLES = [
Expand All @@ -71,16 +84,18 @@ const EXAMPLES = [
'Partially covered status bar (TextInput)',
'FormSheetOverStatusBarWithTextInput',
],
['Pressable & TextInput', 'FormSheetTextInputAndPressable']
['Pressable & TextInput', 'FormSheetTextInputAndPressable'],
];

function Main({
navigation,
useSafeArea,
shouldOverflowTopInset,
edges,
toggleSafeArea,
toggleTopEdge,
toggleBottomEdge,
toggleOverflowTopInset,
}: MainProps) {
return (
<View style={{ flex: 1, padding: 16 }}>
Expand All @@ -91,6 +106,9 @@ function Main({
[Android] Edges, top: {edges.top ? 'enabled' : 'disabled'}, bottom:{' '}
{edges.bottom ? 'enabled' : 'disabled'}
</Text>
<Text style={{ fontSize: 20, marginVertical: 4 }}>
sheetShouldOverflowTopInset: {shouldOverflowTopInset ? 'true' : 'false'}
</Text>
<View style={{ marginVertical: 4 }}>
<Button onPress={toggleSafeArea} title="Toggle SAV" />
</View>
Expand All @@ -100,6 +118,12 @@ function Main({
<View style={{ marginVertical: 4 }}>
<Button onPress={toggleBottomEdge} title="Toggle bottom edge" />
</View>
<View style={{ marginVertical: 4 }}>
<Button
onPress={toggleOverflowTopInset}
title="Toggle overflow top inset"
/>
</View>
<View
style={{
width: '100%',
Expand All @@ -124,15 +148,17 @@ function Main({
);
}

const formSheetBaseOptions: NativeStackNavigationOptions = {
const getFormSheetBaseOptions = (
shouldOverflowTopInset: boolean,
): NativeStackNavigationOptions => ({
presentation: 'formSheet',
animation: 'slide_from_bottom',
headerShown: false,
contentStyle: {
backgroundColor: Colors.GreenLight100,
},
// TODO(@t0maboro) - add `sheetShouldOverflowTopInset` prop here when possible
};
sheetShouldOverflowTopInset: shouldOverflowTopInset,
});

function PressableBase() {
return (
Expand Down Expand Up @@ -241,11 +267,13 @@ export default function App() {
top: true,
bottom: true,
});
const [shouldOverflowTopInset, setShouldOverflowTopInset] = useState(false);
const toggleSafeArea = () => setUseSafeArea(prev => !prev);
const toggleTopEdge = () =>
setSafeAreaEdges(prev => ({ ...prev, top: !prev.top }));
const toggleBottomEdge = () =>
setSafeAreaEdges(prev => ({ ...prev, bottom: !prev.bottom }));
const toggleOverflowTopInset = () => setShouldOverflowTopInset(prev => !prev);

return (
<NavigationContainer>
Expand All @@ -257,10 +285,12 @@ export default function App() {
<Main
navigation={navigation}
useSafeArea={useSafeArea}
shouldOverflowTopInset={shouldOverflowTopInset}
edges={safeAreaEdges}
toggleSafeArea={toggleSafeArea}
toggleTopEdge={toggleTopEdge}
toggleBottomEdge={toggleBottomEdge}
toggleOverflowTopInset={toggleOverflowTopInset}
/>
)}
/>
Expand All @@ -275,7 +305,7 @@ export default function App() {
},
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: 'fitToContents',
}}
/>
Expand All @@ -287,7 +317,7 @@ export default function App() {
safeAreaEdges,
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: [0.2],
}}
/>
Expand All @@ -299,7 +329,7 @@ export default function App() {
safeAreaEdges,
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: [0.5],
}}
/>
Expand All @@ -311,7 +341,7 @@ export default function App() {
safeAreaEdges,
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: [0.8],
}}
/>
Expand All @@ -323,7 +353,7 @@ export default function App() {
safeAreaEdges,
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: [0.3, 0.6],
}}
/>
Expand All @@ -335,7 +365,7 @@ export default function App() {
safeAreaEdges,
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: [0.3, 0.6, 0.9],
}}
/>
Expand All @@ -347,7 +377,7 @@ export default function App() {
safeAreaEdges,
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: [1.0],
}}
/>
Expand All @@ -359,7 +389,7 @@ export default function App() {
safeAreaEdges,
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: [0.99],
}}
/>
Expand All @@ -374,7 +404,7 @@ export default function App() {
},
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: 'fitToContents',
}}
/>
Expand All @@ -386,7 +416,7 @@ export default function App() {
safeAreaEdges,
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: [0.2],
}}
/>
Expand All @@ -398,7 +428,7 @@ export default function App() {
safeAreaEdges,
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: [0.5],
}}
/>
Expand All @@ -410,7 +440,7 @@ export default function App() {
safeAreaEdges,
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: [0.8],
}}
/>
Expand All @@ -422,7 +452,7 @@ export default function App() {
safeAreaEdges,
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: [0.3, 0.6],
}}
/>
Expand All @@ -434,7 +464,7 @@ export default function App() {
safeAreaEdges,
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: [0.3, 0.6, 0.9],
}}
/>
Expand All @@ -446,7 +476,7 @@ export default function App() {
safeAreaEdges,
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: [1.0],
}}
/>
Expand All @@ -458,7 +488,7 @@ export default function App() {
safeAreaEdges,
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: [0.99],
}}
/>
Expand All @@ -470,7 +500,7 @@ export default function App() {
safeAreaEdges,
)}
options={{
...formSheetBaseOptions,
...getFormSheetBaseOptions(shouldOverflowTopInset),
sheetAllowedDetents: [0.5],
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion react-navigation
Submodule react-navigation updated 77 files
+942 −0 .yarn/releases/yarn-4.10.3.cjs
+0 −948 .yarn/releases/yarn-4.9.1.cjs
+1 −1 .yarnrc.yml
+3 −2 example/App.tsx
+1 −0 example/e2e/maestro/auth-flow.yml
+1 −0 example/e2e/maestro/bottom-tabs.yml
+1 −0 example/e2e/maestro/drawer-view.yml
+1 −0 example/e2e/maestro/dynamic-tabs.yml
+1 −0 example/e2e/maestro/full-history-tabs.yml
+1 −0 example/e2e/maestro/link-component.yml
+1 −0 example/e2e/maestro/master-detail.yml
+1 −0 example/e2e/maestro/material-top-tabs.yml
+1 −0 example/e2e/maestro/mixed-header-mode.yml
+1 −0 example/e2e/maestro/mixed-native-stack.yml
+1 −0 example/e2e/maestro/mixed-stack.yml
+1 −0 example/e2e/maestro/modal-stack.yml
+1 −0 example/e2e/maestro/native-stack-header-customization.yml
+1 −0 example/e2e/maestro/native-stack-prevent-remove.yml
+1 −0 example/e2e/maestro/native-stack.yml
+1 −0 example/e2e/maestro/navigator-layout.yml
+1 −0 example/e2e/maestro/screen-layout.yml
+1 −0 example/e2e/maestro/simple-stack.yml
+1 −0 example/e2e/maestro/stack-header-customization.yml
+1 −0 example/e2e/maestro/stack-preload-flow.yml
+1 −0 example/e2e/maestro/stack-prevent-remove.yml
+1 −0 example/e2e/maestro/stack-transparent.yml
+1 −0 example/e2e/maestro/static-screen.yml
+1 −0 example/e2e/maestro/tab-preload-flow.yml
+1 −0 example/e2e/maestro/tab-view.yml
+3 −1 example/e2e/tests/maestro.test.ts
+28 −28 example/package.json
+5 −0 example/src/Screens/FullHistoryTabs.tsx
+67 −1 example/src/Screens/NativeBottomTabs.native.tsx
+79 −0 example/src/Screens/NativeStack.tsx
+1 −0 example/src/assets.d.ts
+3 −0 example/src/index.tsx
+0 −6 jest/setup.js
+3 −0 lefthook.yml
+6 −7 package.json
+13 −0 packages/bottom-tabs/CHANGELOG.md
+10 −10 packages/bottom-tabs/package.json
+10 −2 packages/bottom-tabs/src/unstable/NativeBottomTabView.native.tsx
+4 −36 packages/bottom-tabs/src/unstable/NativeScreen/NativeScreen.tsx
+56 −0 packages/bottom-tabs/src/unstable/NativeScreen/types.ts
+15 −4 packages/bottom-tabs/src/unstable/NativeScreen/useHeaderConfig.tsx
+1 −0 packages/bottom-tabs/src/unstable/index.tsx
+22 −2 packages/bottom-tabs/src/unstable/types.tsx
+4 −0 packages/core/CHANGELOG.md
+7 −7 packages/core/package.json
+4 −0 packages/devtools/CHANGELOG.md
+4 −4 packages/devtools/package.json
+4 −0 packages/drawer/CHANGELOG.md
+12 −14 packages/drawer/package.json
+5 −0 packages/drawer/src/__tests__/index.test.tsx
+4 −0 packages/elements/CHANGELOG.md
+7 −8 packages/elements/package.json
+8 −0 packages/material-top-tabs/CHANGELOG.md
+11 −12 packages/material-top-tabs/package.json
+14 −0 packages/native-stack/CHANGELOG.md
+9 −10 packages/native-stack/package.json
+72 −0 packages/native-stack/src/types.tsx
+73 −58 packages/native-stack/src/views/NativeStackView.native.tsx
+19 −5 packages/native-stack/src/views/useHeaderConfigProps.tsx
+4 −0 packages/native/CHANGELOG.md
+9 −9 packages/native/package.json
+4 −0 packages/react-native-drawer-layout/CHANGELOG.md
+7 −7 packages/react-native-drawer-layout/package.json
+4 −4 packages/react-native-drawer-layout/src/views/Drawer.tsx
+10 −0 packages/react-native-tab-view/CHANGELOG.md
+8 −8 packages/react-native-tab-view/package.json
+1 −1 packages/react-native-tab-view/src/PanResponderAdapter.tsx
+4 −0 packages/routers/CHANGELOG.md
+3 −3 packages/routers/package.json
+4 −0 packages/stack/CHANGELOG.md
+11 −11 packages/stack/package.json
+2 −0 packages/stack/src/__tests__/index.test.tsx
+1,064 −1,188 yarn.lock
Loading