Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How to use MyDrawer function?

$
0
0

[My Drawer function wasnt working, so i tried to add onPress={() => navigation.openDrawer() function to see if it works, but it seems that the function "openDrwaer" doesnt exist, even when it is in the documentaion of @react-navigation/drawer][1]

import {useNavigation} from '@react-navigation/native';import React from 'react';import Icon from 'react-native-vector-icons/Feather';import {Button, Container} from './styles';import {createDrawerNavigator} from '@react-navigation/drawer';import SignIn from '../../pages/SignIn';const Drawer = createDrawerNavigator();function MyDrawer() {  return (<Drawer.Navigator><Drawer.Screen name="log-out" component={SignIn} /></Drawer.Navigator>  );}const Header: React.FC = () => {  const navigation = useNavigation();  return (<Container><MyDrawer /><Button onPress={navigation.goBack}><Icon name="arrow-left" size={30} /></Button><Button onPress={() => navigation.openDrawer()} ><Icon name="menu" size={30} /></Button></Container>  );};export default Header;

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>