gpt4 book ai didi

ios - React Native 版本 0.13.1 TabBar 图标不显示

转载 作者:行者123 更新时间:2023-11-28 19:43:45 28 4
gpt4 key购买 nike

似乎原生 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);

但这是模拟器:

enter image description here

模拟器正确地更改了选项卡,但选项卡图标根本不显示。如果可能的话,我很乐意提供任何帮助!

最佳答案

我遇到了类似的问题。您是否将 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
]

关于ios - React Native 版本 0.13.1 TabBar 图标不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33315021/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com