Gerard Taub
Gerard Taub

Reputation: 177

How to call Actions.xxx in functions binded to onPress event in 'react-native-router-flux'

I'm using RN0.24 and flux3.26. RN version may be out-dated but the Actions.xxx works fine when I'm using onPress={Actions.xxx} However once I put it into functions like onPress={this.function} and in function i do function(event){ Actions.xxx; } then it's not working can anyone help with this?

Upvotes: 0

Views: 912

Answers (1)

Grace Han
Grace Han

Reputation: 26

This is a this issue, I think you can try:

render() {
    const login = () => { Action.login() }
    return (
      <View style={styles.container}>
        <Text style={styles.welcome} onPress={ login }>
          Go to Login
        </Text>
      </View>
    );
  }
}

Hope this can he helpful.

Upvotes: 1

Related Questions