React Native 版本 0.13.1 TabBar 图标不显示

React Native Version 0.13.1 TabBar Icons Not Showing

似乎本机 tabBar 图标没有显示,包也没有与应用程序集成。我不确定问题出在哪里,这是我的代码:

'use strict';

var React = require('react-native');
var Featured = require('./App/Components/Featured');
var Search = require('./App/Components/Search');

var {
    AppRegistry,
    TabBarIOS,
    Component
   } = React;

class BookSearch extends Component {

    constructor(props) {
        super(props);
        this.state = {
            selectedTab: 'featured'
        };
    }

    render() {
        return (
            <TabBarIOS selectedTab={this.state.selectedTab}>
                <TabBarIOS.Item
                    selected={this.state.selectedTab === 'featured'}
                    icon={{uri:'featured'}}
                    onPress={() => {
                        this.setState({
                            selectedTab: 'featured'
                        });
                    }}>
                    <Featured/>
                </TabBarIOS.Item>
                <TabBarIOS.Item
                    selected={this.state.selectedTab === 'search'}
                    icon={{uri:'search'}}
                    onPress={() => {
                        this.setState({
                            selectedTab: 'search'
                        });
                    }}>
                    <Search/>
                </TabBarIOS.Item>
            </TabBarIOS>
        );
    }
}

AppRegistry.registerComponent('BookSearch', () => BookSearch);

但这里是模拟器:

模拟器可以正确更改选项卡,但选项卡图标根本不显示。如果可能,希望得到任何帮助!

我运行遇到了类似的问题。您是否将 RCTImage 子规范添加到您的 podfile 中?

参见:https://facebook.github.io/react-native/docs/embedded-app-ios.html#install-react-native-using-cocoapods

# Depending on how your project is organized, your node_modules directory may be
# somewhere else; tell CocoaPods where you've installed react-native from npm
pod 'React', :path => '../node_modules/react-native', :subspecs => [
  'Core',
  'RCTImage',
  'RCTNetwork',
  'RCTText',
  'RCTWebSocket',
  # Add any other subspecs you want to use in your project
]