mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
import * as React from 'react';
|
|
import { Text, View } from 'react-native';
|
|
import DrawerLayout from 'react-native-drawer-layout';
|
|
|
|
interface DrawerTestState {
|
|
open: boolean;
|
|
}
|
|
|
|
class DrawerTest extends React.Component<{}, DrawerTestState> {
|
|
state: DrawerTestState = {
|
|
open: false
|
|
};
|
|
|
|
private readonly onOpen = () => this.setState({ open: true });
|
|
|
|
private readonly onClose = () => this.setState({ open: false });
|
|
|
|
private readonly renderNavigationView = () => (
|
|
<View>
|
|
<Text>Drawer content</Text>
|
|
</View>
|
|
)
|
|
|
|
render() {
|
|
return (
|
|
<DrawerLayout
|
|
drawerPosition="left"
|
|
drawerWidth={200}
|
|
onDrawerOpen={this.onOpen}
|
|
onDrawerClose={this.onClose}
|
|
renderNavigationView={this.renderNavigationView}
|
|
>
|
|
<View>
|
|
<Text>Screen content</Text>
|
|
<Text>
|
|
{
|
|
DrawerLayout.positions.Left
|
|
}
|
|
</Text>
|
|
<Text>
|
|
{
|
|
DrawerLayout.positions.Right
|
|
}
|
|
</Text>
|
|
</View>
|
|
</DrawerLayout>
|
|
);
|
|
}
|
|
}
|