Android standalone menu button with React native -
i need make standalone (without additional bars or else) menu button in react native (v 0.47.2) android app:
on touch has open side menu:
which component need use?
you using react-navigation
. use stacknavigator
. stacknavigator
can set headers
. in header
, there prop
can pass icon
(or component
). here example:
// other imports import icon "react-native-vector-icons/ionicons"; import { platform, } "react-native"; const menubutton = ({ navigate }) => { return ( <icon name={platform.os === "ios" ? "ios-menu-outline" : "md-menu"} onpress={() => navigate("draweropen")} /> ) } stacknavigator({ notifications: { screen: example, navigationoptions: ({ navigation }) => ({ headerleft: <menubutton {...navigation} />, }), },
the headerleft
(or headerright
) can used case (documentation). here pass <menubutton />
component. can set color of stacknavigator
s header
backgroundcolor
of app, or transparent
. way, there won`t visible, menu button.
of yourse need stack stacknavigator
in drawernavigator
onpress={() => navigate("draweropen")}
work. in drawernavigator
can use contentcomponent
pass custom component, contains menu.
here more complex setup http://rationalappdev.com/cross-platform-navigation-in-react-native/
Comments
Post a Comment