-
Notifications
You must be signed in to change notification settings - Fork 2
/
App.js
44 lines (39 loc) · 1.03 KB
/
App.js
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
import React from 'react';
import {View, Text} from 'react-native';
import {createAppContainer} from 'react-navigation';
import {createStackNavigator} from 'react-navigation-stack';
import exampleList from './exampleList';
import {ScrollView, TouchableOpacity} from 'react-native-gesture-handler';
const examples = exampleList();
function HomeScreen({navigation}) {
return (
<ScrollView>
{examples.map(({name, version}) => (
<View key={name}>
<TouchableOpacity onPress={() => navigation.navigate(name)}>
<Text>Package: {name}</Text>
<Text>Version: {version}</Text>
</TouchableOpacity>
</View>
))}
</ScrollView>
);
}
const AppNavigator = createStackNavigator(
examples.reduce(
(acc, {name, screen}) => {
console.log({screen});
acc[name] = {
screen: screen.default,
};
return acc;
},
{
Home: {
screen: HomeScreen,
},
},
),
);
const App = createAppContainer(AppNavigator);
export default App;