侧栏的React-Native按钮

时间:2018-09-07 11:08:32

标签: react-native react-navigation

我是React-Native的初学者,在为侧栏创建按钮时遇到一些问题。由于navigationOptions不起作用,我只是不知道如何将按钮链接到侧栏。我使用import React, { Component } from 'react'; import { AppRegistry, Image, Button, TouchableOpacity } from 'react-native'; import {Platform, StyleSheet, Text,Script, View, NavigatorIOS, ImageBackground, Dimensions, TouchableHighlight} from 'react-native'; import { StackNavigator } from 'react-navigation'; class App extends Component<{}> { constructor(props) { super(props); } render() { return ( <View> <View style={styles.container}> <TouchableOpacity onPress={()=>{this.props.navigation.navigate('DrawerOpen')}}> <Image source={require("./resources/robot.png")} style = {styles.imageButton}/> </TouchableOpacity> </View> </View> ); App.navigationOptions = { drawer: { icon: () => ( <Image style={[styles.tabIcon, {tintColor: 'black'}]} /> )} }; } } export default App 来构造抽屉,并且侧边栏工作得很好,但是没有按钮滑动就不方便了。请给我一些建议。

SELECT

0 个答案:

没有答案