![](/img/trans.png)
[英]react-native: ToolbarAndroid not displaying title when logo is used
[英]ToolbarAndroid is not displaying in react native
我正在学习react-native
编程,使用这个https://facebook.github.io/react-native/docs/toolbarandroid.html创建工具栏,但在我的情况下它没有被显示。 我无法理解我到底在做什么错误。
任何人都可以帮助我。
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);
这是一个已知问题。 解决方法是为 ToolbarAndroid 设置高度。
作为本机反应的新手,这是我迄今为止找到的最佳解决方案,希望它有所帮助。 https://github.com/react-native-community/toolbar-android
首先,添加npm install @react-native-community/toolbar-android --save
或者 yarn lover add yarn add @react-native-community/toolbar-android
其次,运行react-native start
命令。
三、运行react-native run-android
快乐编码:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.