私がしようとしているのは、アプリにサイドバーを置くことですが、I'm getting this weird errorです。 。iOSシミュレータでこの奇妙なエラーが発生するのはなぜですか?
オブジェクトが見つかりました(リアクト子として有効ではありません:キーを持つ オブジェクト(フレックス、backgroundColorのを})あなたが子供のコレクションをレンダリングするためのもの 場合、 ではなく配列を使用
に(Animatedlmplementation.jsで: 184q)図
AnimatedComponentでRCTViewで
(SidebarView.js 210で)(View.js時:133)
(index.ios.js時:48)SidebarViewで バーで
(index.ios.js時:65)
中:(2O3 SidebarView.jsで)ビューで AppContainer.jsのビューで:(133 View.jsで)
(RCTViewで
:(35 renderApplication.jsで)DAPPで
:(6Q index.ios.jsで)プロバイダ:98)
RCTViewで (View.js時:133)(AppContainer.js時:97)ビューで
私はreact-redux
<Provider/>
コンポーネントがその子の小道具は単一ReactElementことを期待していることを取得なぜ私は<Bar/>
と呼ばれる単一のコンポーネントにすべてをラップしました。
ここに私のコードです:
import React, { Component } from 'react';
import { AppRegistry, Text} from 'react-native';
import { Provider } from 'react-redux';
import Application from './pages/Application';
import store from './redux';
import api from './utilities/api';
import SideBar from 'react-native-sidebar';
export default class DApp extends Component {
constructor(props) {
super(props);
this.state = {
data: [],
isLoading: true
}
console.log("something");
}
componentWillMount() {
api.getData().then((res) => {
this.setState({
data: res.data
})
});
}
renderLeftSideBar() {
return(
<Text>Something here for left side bar!</Text>
);
}
renderRightSideBar() {
return(
<Text>Something here for right side bar!</Text>
);
}
renderContent() {
return(
<Text>The content!</Text>
);
}
render() {
const Bar =() => {
return(
<SideBar>
leftSideBar = {this.renderLeftSideBar()}
rightSideBar = {this.renderRightSideBar()}
style = {{flex: 1, backgroundColor: 'black'}}>{this.renderContent()}
<Application/>
</SideBar>
);
}
if(this.state.isLoading) {
console.log("The data is: " + this.state.data);
} else {
console.log("Else got executed");
}
return (
<Provider store={store}>
<Bar/>
</Provider>
);
}
}
AppRegistry.registerComponent('DApp',() => DApp);