-
-
Notifications
You must be signed in to change notification settings - Fork 99
/
Copy pathindex.tsx
40 lines (35 loc) · 1.12 KB
/
index.tsx
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
import { ScreenNames } from '../../../constants/screenNames';
import React, { useCallback } from 'react';
import { ScrollView } from 'react-native-gesture-handler';
import ExampleLink from './components/ExampleLink';
import { examples } from './constants';
import { StyleSheet } from 'react-native';
import type { StackScreenProps } from '@react-navigation/stack';
import type { RootStackParamList } from '../../../navigation/RootStack';
const styles = StyleSheet.create({
scrollViewContainer: {
paddingVertical: 10,
paddingHorizontal: 8,
},
});
type Props = StackScreenProps<RootStackParamList>;
const ExampleMain = ({ navigation }: Props) => {
const onExamplePress = useCallback(
(info: ScreenNames) =>
navigation.navigate(ScreenNames.EXAMPLES_STACK, { screen: info }),
[]
);
return (
<ScrollView contentContainerStyle={styles.scrollViewContainer}>
{examples.map((example, index) => (
<ExampleLink
key={example.title}
onPress={onExamplePress}
index={index + 1}
{...example}
/>
))}
</ScrollView>
);
};
export default ExampleMain;