我正在学习 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);
最佳答案
这是一个 known issue .解决方法是为您的 ToolbarAndroid 设置高度。
关于android - ToolbarAndroid 未显示在 React Native 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41821699/