-
-
Notifications
You must be signed in to change notification settings - Fork 643
Expand file tree
/
Copy pathstack-v4-orientation.tsx
More file actions
57 lines (50 loc) · 1.46 KB
/
stack-v4-orientation.tsx
File metadata and controls
57 lines (50 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { SettingsPicker } from '@apps/shared/SettingsPicker';
import React from 'react';
import { ScrollView } from 'react-native';
import useStackConfigState from '@apps/tests/shared/hooks/stack-config';
import {
createAutoConfiguredStack,
findStackScreenOptions,
} from '@apps/tests/shared/stack';
import type { ScenarioDescription } from '@apps/tests/shared/helpers';
import { createScenario } from '@apps/tests/shared/helpers';
const scenarioDescription: ScenarioDescription = {
name: 'Orientation',
key: 'stack-v4-orientation',
platforms: ['ios', 'android'],
};
type StackParamList = {
Screen1: undefined;
};
export function ConfigScreen() {
const [config, dispatch] = useStackConfigState<StackParamList>();
return (
<ScrollView style={{ padding: 40 }}>
<SettingsPicker
label="orientation"
items={['portrait', 'landscape', 'undefined']}
value={
findStackScreenOptions(config, 'Screen1')?.orientation ?? 'undefined'
}
onValueChange={value =>
dispatch({
type: 'screen',
name: 'Screen1',
config: { orientation: value === 'undefined' ? undefined : value },
})
}
/>
</ScrollView>
);
}
const Stack = createAutoConfiguredStack<StackParamList>({
Screen1: ConfigScreen,
});
export function App() {
return (
<Stack.Provider>
<Stack.Autoconfig />
</Stack.Provider>
);
}
export default createScenario(App, scenarioDescription);