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      // @ts-ignore
25      drawerPosition={isRight ? 'right' : 'left'}
26      renderNavigationView={renderNavigationView}>
27      <View style={{ flex: 1, padding: 16 }}>
28        <TitleSwitch title="Is Right" value={isRight} setValue={setRight} />
29        <Text>Pull from the {isRight ? 'right' : 'left'}</Text>
30      </View>
31    </DrawerLayoutAndroid>
32  ) : (
33    <View
34      style={{
35        flex: 1,
36        backgroundColor: '#fff',
37        alignItems: 'center',
38        justifyContent: 'center',
39      }}>
40      <Text>Only available on Android</Text>
41    </View>
42  );
43}
44
45DrawerLayoutAndroidScreen.navigationOptions = {
46  title: 'DrawerLayoutAndroid',
47};
48