How can I replace screen with React Navigation for React Native
Now I'm a newbie I can't understand about getStateForAction now I have params on Screen 1 and Navigate to Screen 2 with passing params username with basic Navigate it's nested screen 1 > 2 on stack
But I need to replace screen 1 with screen 2 after screen 2 it's on active (replace like ActionConst.REPLACE on router flux) and sending params on a new way
Can someone guide me thank you.
screen 1
onPress = () => {
this.props.navigation.navigate('Sc2', {username: this.state.username});
}
Screen 2
componentWillMount() {
const {state} = this.props.navigation;
console.log(state.params.username);
}
---------------
Router
export const LoginNavStack = StackNavigator({
Sc1: {
screen: Sc1
},
Sc2: {
screen: Sc2,
},
});