Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of SceneContainer
.
Can you help me? @jlebensold
` import React,{Component} from 'react'
import {connect} from 'react-redux'
import {ActionCreators} from '../actions'
import {bindActionCreators} from 'redux'
import Home from './Home'
import SubCategories from './SubCategories'
import {
Animated,
StyleSheet,
View,
NavigationExperimental
} from 'react-native';
const {
PropTypes: NavigationPropTypes,
StateUtils: NavigationStateUtils,
Card: NavigationCard,
Transitioner: NavigationTransitioner,
} = NavigationExperimental;
const {
PagerPanResponder: NavigationPagerPanResponder,
PagerStyleInterpolator: NavigationPagerStyleInterpolator,
} = NavigationCard;
class AppContainer extends Component{
constructor(props) {
super(props);
this._render = this._render.bind(this);
this._renderScene = this._renderScene.bind(this);
}
render(){
console.log(this.props);
return
}
_render(transitionProps) {
const scenes = transitionProps.scenes.map((scene) => {
const sceneProps = {
...transitionProps,
scene,
};
return this._renderScene(sceneProps);
});
return (
<View style={ { flex: 1 } }>
{scenes}
);
}
_renderScene(sceneProps){
return <SceneContainer {...sceneProps} key={sceneProps.scene.key}/>
}
}
class SceneContainer extends Component {
render(){
const style = [
styles.scene,
NavigationPagerStyleInterpolator.forHorizontal(this.props),
]
let Scene = null;
if(this.props.scene.route.key === 'Home') { Scene = Home }
if(this.props.scene.route.key === 'SubCategories') { Scene = SubCategories }
return(
<Animated.View style={style}>
<Scene {...this.props} style={style} />
</Animated.View>
);
}
}
const styles = StyleSheet.create({
scene:{
flex:1,
position:'absolute',
bottom:0,
top:0,
left:0,
right:0,
}
})
function mapStateToProps(state) {
return {
navigationState: state.navigationState
};
}
function mapDispatchToProps(dispatch) {
return bindActionCreators(ActionCreators, dispatch);
}
export default connect(mapStateToProps, mapDispatchToProps)(AppContainer);
`