android - ToolbarAndroid 未显示在 React Native 中

标签 android 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);

enter image description here

最佳答案

这是一个 known issue .解决方法是为您的 ToolbarAndroid 设置高度。

关于android - ToolbarAndroid 未显示在 React Native 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41821699/

相关文章:

android - React Native 将 apk 文件的大小增加了 6.5 MB

java - 在android中创建带有进度条的自定义对话框屏幕

java - 隐藏 TextView 直到按下 Button

firebase - 如何组合两个 Redux Firebase Cloud Firestore 查询?

react-native - 如何处理 safeAreaView + React Navigation?

react-native - 如何使用 React Native 聆听物理按钮?

android - 如何新鲜导航到特定屏幕?

Android 用户界面问题。实现指导

android - 删除 fragment 后内存未释放

Android RadiGroup允许多选