I'm running into some weird behaviors when trying to implement the Navigators from React-Navigation.
When trying out the simple "hello world" from https://reactnavigation.org/docs/en/hello-react-navigation.html...
import React from 'react';
import { View, Text } from 'react-native';
import { createStackNavigator } from 'react-navigation';
class HomeScreen extends React.Component {
render() {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Home Screen</Text>
</View>
);
}
}
export default createStackNavigator({
Home: {
screen: HomeScreen,
},
});
I get this error:
Invariant Violation: 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 'SceneView'.
The strange part is that while using the StackNavigator (and TabNavigator) give me the Invariant Violation, using a DrawerNavigator does not!
This common fix (removing the braces in the import) gives a new error:
Object is not a function
I'm new to React-Native and not sure how to dive deeper into this problem, any help is appreciated!
-----Edit-----
I've downgraded my version of react-navigation to v1.5.5 and the original StackNavigator component works, so perhaps it's a compatibility issue with v2.0.1 and my environment.