Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 工具栏不渲染_React Native - Fatal编程技术网

React native 工具栏不渲染

React native 工具栏不渲染,react-native,React Native,我正在尝试在我的React原生项目上使用Android 但是工具栏没有被渲染。我遗漏了什么吗 以下是片段: toolbar.js import React, { Component } from 'react'; import { View, Text, ToolbarAndroid, StyleSheet } from 'react-native'; import Icon from 'react-native-vector-icons/Ionicons

我正在尝试在我的React原生项目上使用Android

但是工具栏没有被渲染。我遗漏了什么吗

以下是片段:

toolbar.js

import React, {
    Component
} from 'react';
import {
    View,
    Text,
    ToolbarAndroid,
    StyleSheet
} from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';

export default class Toolbar extends Component {
    render() {
        return(
            <Icon.ToolbarAndroid
                title = {this.props.title}
                titleColor = 'black'
                navIconName = "android-menu"
                style = {styles.toolbar}
            />
        );
    }
}

const styles = StyleSheet.create({
    toolbar: {
        backgroundColor: 'firebrick',
        height: 56
    }
});

这是此类组件的工作示例(但不同):


{this.props.title}

您必须将子视图传递给Android。也不支持使用诸如
firebase
之类的颜色名称。

这是此类组件的工作示例(但不同):


{this.props.title}
您必须将子视图传递给Android。也不支持使用诸如
firebase
之类的颜色名称

const styles = StyleSheet.create({
    toolbar: {
        backgroundColor: 'firebrick',
        height: 56,
        width: 300
    }
});
<ToolbarAndroid
  title = {this.props.title}
  titleColor = 'black'
  navIconName = "android-menu"
>
  <View style={styles.toolbar}>
    <Text>{this.props.title}</Text>
  </View>
</ToolbarAndroid>