const Drawer = () => {
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
const toggleDrawer = () => {
setIsDrawerOpen(!isDrawerOpen);
};
const closeDrawer = () => {
setIsDrawerOpen(false);
};
return (
<View style={styles.container}>
{!isDrawerOpen ? (
<Button title="Toggle Drawer" onPress={toggleDrawer} />
) : (
<Button title="Close Drawer" onPress={closeDrawer} />
)}
<Drawer
isOpen={isDrawerOpen}
onClose={closeDrawer}
backgroundColor="black"
>
<Text>Drawer Content</Text>
<Text>Drawer Content</Text>
<Text>Drawer Content</Text>
<Text>Drawer Content</Text>
<Text>Drawer Content</Text>
<Text>Drawer Content</Text>
</Drawer>
</View>
);
};
const styles = StyleSheet.create({
container: {
alignItems: "center",
justifyContent: "center",
},
});
export default Drawer;