我想要做的是在我的應用程序中放置一個側欄,但是I'm getting this weird error。爲什麼我在iOS模擬器中出現這個奇怪的錯誤?
對象是不是一個做出反應的孩子有效(發現: 對象與鍵(彎曲,的backgroundColor})如果 你的意思是使孩子們的集合, 使用不是數組
英寸。視圖(在Animatedlmplementation.js: 184q)
在AnimatedComponent(在SidebarView.js 210)
在RCTView (在View.js:133)
在視圖(在SidebarView.js:2O3)
在SidebarView (在index.ios.js:48)
在酒吧 (在index.ios.js:65)
在提供商(在index.ios.js:6Q)
在DAPP (在renderApplication.js:35)
在RCTView (在View.js:133)
在View (在AppContainer.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);