1import * as React from 'react';
2import { DrawerLayoutAndroid, Text, View, Platform } from 'react-native';
3
4import TitleSwitch from '../components/TitledSwitch';
5
6export default function DrawerLayoutAndroidScreen() {
7  const [isRight, setRight] = React.useState(false);
8
9  const renderNavigationView = () => (
10    <View
11      style={{
12        flex: 1,
13        backgroundColor: '#fff',
14        alignItems: 'center',
15        justifyContent: 'center',
16      }}>
17      <Text>DrawerLayoutAndroid</Text>
18    </View>
19  );
20
21  return Platform.OS === 'android' ? (
22    <DrawerLayoutAndroid
23      drawerWidth={300}
24      drawerPosition={isRight ? 'right' : 'left'}
25      renderNavigationView={renderNavigationView}>
26      <View style={{ flex: 1, padding: 16 }}>
27        <TitleSwitch title="Is Right" value={isRight} setValue={setRight} />
28        <Text>Pull from the {isRight ? 'right' : 'left'}</Text>
29      </View>
30    </DrawerLayoutAndroid>
31  ) : (
32    <View
33      style={{
34        flex: 1,
35        backgroundColor: '#fff',
36        alignItems: 'center',
37        justifyContent: 'center',
38      }}>
39      <Text>Only available on Android</Text>
40    </View>
41  );
42}
43
44DrawerLayoutAndroidScreen.navigationOptions = {
45  title: 'DrawerLayoutAndroid',
46};
47