无法读取未定义的 属性 'navigation' - 本机反应

Cannot read property 'navigation' of undefined - react native

我正在开发一个 React Native 应用程序。在该应用程序中,当我调用以下函数时出现错误

Cannot read property 'navigation' of undefined

      handleForgotPassword = (email) => {
        firebase.auth().sendPasswordResetEmail(email)
        .then(function (user) {
          console.log("Inner");
          this.props.navigation.navigate("Login") //not working
        }).catch(function (e) {
          console.log(e)
        })

      }

但在同一页面上,我使用以下代码并且运行良好。

<TouchableOpacity onPress={() => this.props.navigation.navigate("Login")}> //but this is working
      <Image  source={require('../src/Assets/close.png')} />
      </TouchableOpacity> 

谁能告诉我问题是什么

匿名函数有它自己的上下文(这就是导航未定义的原因)...但是箭头函数自动绑定到它的父函数

       firebase.auth().sendPasswordResetEmail(email)
        .then((user) =>  {
          console.log("Inner");
          this.props.navigation.navigate("Login") // Will work
        })