[英]ToolbarAndroid is not displaying in react native
I am learning react-native
programming, creating toolbar using this https://facebook.github.io/react-native/docs/toolbarandroid.html but in my case it is not being showed.我正在学习
react-native
编程,使用这个https://facebook.github.io/react-native/docs/toolbarandroid.html创建工具栏,但在我的情况下它没有被显示。 I could not understand what exactly mistake I am doing.我无法理解我到底在做什么错误。
Can anyone help me for this.任何人都可以帮助我。
import React, { Component } from 'react';
import { AppRegistry, Text, View, TextInput, TouchableOpacity, ToolbarAndroid } from 'react-native';
import { ToolBar } from 'react-native-material-design';
class LoginComponent extends Component {
render() {
return (
<View style={{flex: 1, flexDirection: 'column', margin:10}}>
<ToolbarAndroid title="Login" titleColor="black"/>
<TextInput style={{height: 40, borderColor:'gray', borderWidth: .5}}
placeholder="Email address" underlineColorAndroid='transparent'/>
<TextInput style={{height: 40, borderColor:'gray', borderWidth: .5}}
placeholder="Password" secureTextEntry={true} underlineColorAndroid='transparent'/>
<TouchableOpacity style={{ height: 40, marginTop: 10 , backgroundColor: '#2E8B57'}}>
<Text style={{color: 'white', textAlign: 'center', marginTop: 10, fontWeight: 'bold'}}>LOG IN</Text>
</TouchableOpacity>
</View>
);
}
}
AppRegistry.registerComponent('Myntra', () => LoginComponent);
This is a known issue .这是一个已知问题。 A workaround is set a height for your ToolbarAndroid.
解决方法是为 ToolbarAndroid 设置高度。
As im new to react-native, this is the best solution i found so far, hope it helps.作为本机反应的新手,这是我迄今为止找到的最佳解决方案,希望它有所帮助。 https://github.com/react-native-community/toolbar-android
https://github.com/react-native-community/toolbar-android
First, add npm install @react-native-community/toolbar-android --save
or yarn lover add yarn add @react-native-community/toolbar-android
首先,添加
npm install @react-native-community/toolbar-android --save
或者 yarn lover add yarn add @react-native-community/toolbar-android
Second, Run react-native start
command.其次,运行
react-native start
命令。
Third, Run react-native run-android
三、运行
react-native run-android
Happy coding :)快乐编码:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.