小编Jar*_*son的帖子

ToolBarAndroid无法在ReactNative中渲染

我正在尝试在我的React原生视图上渲染一个基本的Android工具栏,我遇到了麻烦.使用我当前的代码,它运行正常(没有错误或任何东西),但工具栏不存在.关于我做错了什么的任何建议?提前致谢!

    'use strict';
    const React = require('react-native');
    const MaterialKit = require('react-native-material-kit');
    const {
      AppRegistry,
      DrawerLayoutAndroid,
      StyleSheet,
      Text,
      View,
      ToolbarAndroid,
    } = React;

    const DRAWER_REF = 'drawer';

    const OpenLightApp = React.createClass({
      render: function() {
        const navigationView = (
          <View style={{flex: 1, backgroundColor: '#88D8EC'}}>
            <Text style={{margin: 10, fontSize: 15, textAlign: 'left'}}>Drawer Item</Text>
          </View>
        );

        return (

          <DrawerLayoutAndroid
            drawerWidth={300}
            ref={DRAWER_REF}
            drawerPosition={DrawerLayoutAndroid.positions.Left}
            renderNavigationView={() => navigationView}>
            <View style={styles.container}>
            <ToolbarAndroid
              navIcon={require('image!hamburger')}
              title="OpenLight"
              titleColor="black"
              style={styles.toolbar}
              onIconClicked={() => this.refs[DRAWER_REF].openDrawer()} />
              <Text style={styles.welcome}>
                Example Text
              </Text>
              <Text style={styles.instructions}>
                To …
Run Code Online (Sandbox Code Playgroud)

javascript android react-native

10
推荐指数
3
解决办法
9331
查看次数

标签 统计

android ×1

javascript ×1

react-native ×1