which method is called when the screen is displayed from the navigation stack in react native

try NavigationEvent in react-navigation https://reactnavigation.org/docs/navigation-events/

class Profile extends React.Component {
  componentDidMount() {
    this._unsubscribe = navigation.addListener('focus', () => {
      // do something
      this.emailInput.focus()
    });
  }

  componentWillUnmount() {
    this._unsubscribe();
  }

  render() {
      <View>
        <TextInput ref={ref => { this.emailInput = ref; }}/>
      <View/>
  }
}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top