React native React Native:未处理的承诺拒绝,提供的参数无效

React native React Native:未处理的承诺拒绝,提供的参数无效,react-native,React Native,我遇到了一个问题,我调用一个方法并传递它的参数,然后我收到一个错误,按钮后面的操作会自动运行 这是我的渲染: render() { return (<View style={styles.container}> <Card> <CardSection> <Button accessibilityLabel='Click this button to find somewhere

我遇到了一个问题,我调用一个方法并传递它的参数,然后我收到一个错误,按钮后面的操作会自动运行

这是我的渲染:

render() {
    return (<View style={styles.container}>
      <Card>
        <CardSection>
          <Button
          accessibilityLabel='Click this button to find somewhere you and your friend can meet'
          onPress={this.handleGetDirections(this.state.lat1, this.state.lng1, this.state.lat2, this.state.lng2)}
          >
            Get Directions
          </Button>
        </CardSection>
      </Card>
    </View>);
  }
难道我不应该将状态作为参数传递给函数吗?

来自,
onPress
需要一个处理程序

应该是:

onPress={()=>this.handleGetDirections(this.state.lat1, this.state.lng1, this.state.lat2, this.state.lng2)}

handleGetDirections
返回什么?非常感谢。这很有效。非常感谢你的帮助。
onPress={()=>this.handleGetDirections(this.state.lat1, this.state.lng1, this.state.lat2, this.state.lng2)}