Reputation: 193
I am trying to use one of the libraries quoted above, react-native-splash-screen and react-navigation. I get this
.
The code is follows:
index.android.js
import { AppRegistry } from 'react-native';
import App from './app/index';
AppRegistry.registerComponent('RecallNotes', () => App);
index.js
import React, { Component } from 'react';
import Root from 'config/router';
import {
View,
} from 'react-native';
import SplashScreen from 'react-native-smart-splash-screen';
export default class App extends Component {
componentDidMount () {
//SplashScreen.close(SplashScreen.animationType.scale, 850, 500)
SplashScreen.close({
animationType: SplashScreen.animationType.scale,
duration: 850,
delay: 500,
})
}
render() {
return <Root />;
}
}
router.js
import React from 'react';
import { StackNavigator } from 'react-navigation';
import DeckView from 'screens/deckview';
export const Root = StackNavigator({
Home: {
screen: DeckView
},
},{
mode: 'modal',
headerMode: 'none',
});
deckview.js
import React, { Component } from 'react';
import {
View,
Text
} from 'react-native';
/*
* DeckView class
* This is the component of the deck image
*/
export default class DeckView extends Component{
render(){
return(
<View>
<Text>Welcome to React Native!</Text>
</View>
);
}
}
My question is this: Do I have to use a StackNavigator for my entire navigation for my app or can I keep this above code, after fixing this code? Thanks.
Upvotes: 1
Views: 2360
Reputation: 980
in index.js, change:
import Root from 'config/router';
to:
import { Root } from 'config/router';
since you are not exporting a default from router.js
Upvotes: 2