_react3.default.createref不是函数。('_react2.default.createRef()'_ react2.default.createRef未定义

问题描述 投票:7回答:2

无法通过Instagram登录我的应用程序。我正在使用react-native instagram软件包,但我面临的问题是_react3.default.creteRef()不是函数。请参阅附件

enter image description here环境:

Packages: (wanted => installed)
  react: 16.2.0 => 16.2.0
  react-native: ^0.53.3 => 0.53.3

Xcode: Xcode 10.1 Build version 10B61
npm: 5.6.0
OS: macOS 10.14.2
Node: 9.4.0
react-native react-native-instagram-login
2个回答
2
投票

尝试改变,

ref='ins'

ref={instance=>this.instagramRef=instance}

并使用refs作为this.instagramRef.someFunc()而不是this.refs.ins.someFunc()

并且不要忘记在构造函数中设置this.instagramRef=null

如果使用的话,删除所有createRef()。并改为这种方法


2
投票

您正在使用旧版本的反应。在React 16.3.0中添加了createRef API,您使用的是16.2.0。发行说明here

似乎这个新的API是从你的一个依赖项中调用的,因为stacktrace提到了Instagram.js,你需要更新React,或者更改或降级该依赖项。

© www.soinside.com 2019 - 2024. All rights reserved.