Reputation: 459
I am trying to call authentication action after the user has entered home screen.I'm using react-native router-flux for that with onEnter callback.
I can not do it inside my scenes, so I'm doing it dynamically with Action.refresh and passing props.
Problem is that onEnter gets called multiple times.
Is there any other way to know when the user entered home component so I can do authentication?
Here is scene :
<Scene
key="Home"
component={Home}
onEnter={this.props.param1}
/>
Bellow is Home component, I'm using alert just for debugging purpose:
class Home extends Component {
constructor(props) {
super(props);
}
componentWillReceiveProps(props) {
Actions.refresh({param1: () => alert('testing testing testing')})
}
Upvotes: 1
Views: 539