forked from vonovak/react-navigation-header-buttons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHomeScreen.tsx
43 lines (41 loc) · 1.66 KB
/
HomeScreen.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
41
42
43
import React, { useContext } from 'react';
import { Text, View, ScrollView } from 'react-native';
import { Button } from './PaddedButton';
import { ThemeContext } from '../ThemeProvider';
export function HomeScreen({ navigation }) {
React.useLayoutEffect(() => {
navigation.setOptions({
title: 'Header Buttons demo',
headerLargeTitle: true,
});
}, [navigation]);
const _navigateTo = (destinationScreen: string) => {
navigation.navigate(destinationScreen);
};
const { toggleTheme } = useContext(ThemeContext);
return (
<View style={{ flex: 1 }}>
<ScrollView>
<Text style={{ margin: 15 }}>Explore possible usages with:</Text>
<Button onPress={() => _navigateTo('UsageWithIcons')} title="Vector icons" />
<Button onPress={() => _navigateTo('UsageWithOverflow')} title="Default overflow menu" />
<Button
onPress={() => _navigateTo('UsageWithCustomOverflow')}
title="Custom overflow menu action"
/>
<Button
onPress={() => _navigateTo('UsageWithOverflowComplex')}
title="Overflow menu - all handlers"
/>
<Button
onPress={() => _navigateTo('UsageDifferentFontFamilies')}
title="Different font families in one menu"
/>
<Button onPress={() => _navigateTo('UsageDisabled')} title="Disabled state" />
<Button onPress={() => _navigateTo('UsageLeft')} title="On the left side of header" />
<Button onPress={() => _navigateTo('UsageCustom')} title="Custom elements" />
<Button onPress={toggleTheme} title="Toggle Theme (ripple, text and icon color changes)" />
</ScrollView>
</View>
);
}