Skip to content
This repository was archived by the owner on Nov 3, 2025. It is now read-only.

Commit ca5a3ed

Browse files
committed
🚧 (example/App) add menu to choose example
1 parent 4b475e9 commit ca5a3ed

1 file changed

Lines changed: 40 additions & 2 deletions

File tree

example/src/App.tsx

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,50 @@
11
import React, { Component } from 'react';
22
import { SignIn } from './canals/SignIn';
33
import { FullScreenPortal } from 'react-gondola';
4+
import { View, TouchableOpacity, Text } from 'react-native';
5+
6+
interface State {
7+
example: null | 'SignIn' | 'Instagram';
8+
}
9+
10+
const EXAMPLES = { SignIn, Instagram: SignIn };
11+
12+
export default class App extends Component<{}, State> {
13+
state: State = {
14+
example: null,
15+
};
416

5-
export default class App extends Component<{}> {
617
render() {
18+
if (!this.state.example) {
19+
return (
20+
<View style={{ alignItems: 'center', flex: 1, justifyContent: 'center' }}>
21+
{Object.keys(EXAMPLES).map(example => (
22+
<TouchableOpacity
23+
key={example}
24+
onPress={() => {
25+
// @ts-ignore
26+
this.setState({ example });
27+
}}
28+
style={{
29+
paddingHorizontal: 16,
30+
paddingVertical: 8,
31+
backgroundColor: 'cyan',
32+
borderRadius: 4,
33+
marginTop: 8,
34+
}}
35+
>
36+
<Text>{example}</Text>
37+
</TouchableOpacity>
38+
))}
39+
</View>
40+
);
41+
}
42+
43+
const Example = EXAMPLES[this.state.example];
44+
745
return (
846
<FullScreenPortal>
9-
<SignIn />
47+
<Example />
1048
</FullScreenPortal>
1149
);
1250
}

0 commit comments

Comments
 (0)