首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >反应-本机-instagram-登录抛出不变违规

反应-本机-instagram-登录抛出不变违规
EN

Stack Overflow用户
提问于 2021-07-08 05:23:34
回答 1查看 235关注 0票数 0

我已经尝试使用react本机-instagram-登录在我的应用程序中集成instagram登录,它目前的抛出错误,我已经做了下面的更改,使它工作也试图遵循一个特定的解决方案在链接,但似乎没有工作,任何帮助将不胜感激。

代码语言:javascript
复制
 ERROR  Invariant Violation: View config getter callback for component `RCTModalHostView` must be a function (received `undefined`).

This error is located at:
in RCTModalHostView (at Modal.js:258)
in Modal (at Instagram.js:119)
in Test(at Instagram.js:44)
in RCTView (at View.js:34)
in View (at Instagram.js:25)
in Test(at SceneView.tsx:122)
...
ERROR  Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
in WebView (at Instagram.js:99)
in RCTView (at Instagram.js:126)
in RCTView (at Instagram.js:125)
in RCTView (at AppContainer.js:101)
in RCTView (at AppContainer.js:119)
in AppContainer (at Modal.js:250)
in RCTView (at Modal.js:271)
in RCTModalHostView (at Modal.js:258)
in Modal (at Instagram.js:119)
in Test(at Instagram.js:44)
in RCTView (at View.js:34)
in View (at Instagram.js:25)
in Test(at SceneView.tsx:122)
...

package.json

代码语言:javascript
复制
{
 "name": "ui",
 "version": "0.0.1",
 "private": true,
 "scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
 },
"dependencies": {
"@react-native-async-storage/async-storage": "^1.15.5",
"@react-native-community/datetimepicker": "^3.5.2",
"@react-native-community/masked-view": "^0.1.11",
"@react-native-cookies/cookies": "^6.0.8",
"@react-navigation/drawer": "^5.12.5",
"@react-navigation/native": "^5.9.4",
"@react-navigation/stack": "^5.14.5",
"react": "17.0.1",
"react-native": "0.64.2",
"react-native-animatable": "^1.3.3",
"react-native-calendars": "^1.1264.0",
"react-native-dropdown-autocomplete-textinput": "^1.0.1",
"react-native-gesture-handler": "^1.10.3",
"react-native-image-crop-picker": "^0.36.2",
"react-native-instagram-login": "^2.0.4",
"react-native-linear-gradient": "^2.5.6",
"react-native-modal-datetime-picker": "^10.0.0",
"react-native-paper": "^4.9.2",
"react-native-reanimated": "^2.2.0",
"react-native-safe-area-context": "^3.2.0",
"react-native-screens": "^3.4.0",
"react-native-searchable-dropdown": "^1.1.3",
"react-native-vector-icons": "^8.1.0",
"react-native-webview": "^11.6.5",
"toggle-switch-react-native": "^3.2.0"
},
"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/runtime": "^7.14.6",
"@react-native-community/eslint-config": "^3.0.0",
"babel-jest": "^27.0.5",
"eslint": "^7.29.0",
"jest": "^27.0.5",
"metro-react-native-babel-preset": "^0.66.0",
"react-test-renderer": "17.0.1"
},
"jest": {
"preset": "react-native"
 }
 }

Test.js

代码语言:javascript
复制
  ...
  const Test= ({navigation}) =>{
  const[token,setToken]=useState('');
  setIgToken = (data) => {
    console.log('data', data)
    this.setToken({ token: data.access_token })
  };

  return(
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
    <TouchableOpacity
      style={styles.btn}
      onPress={() => this.instagramLogin.show()}>
      <Text style={{ color: 'white', textAlign: 'center' }}>Login now</Text>
    </TouchableOpacity>
    <TouchableOpacity
      style={[styles.btn, { marginTop: 10, backgroundColor: 'green' }]}
      onPress={() => clear()}>
      <Text style={{ color: 'white', textAlign: 'center' }}>Logout</Text>
    </TouchableOpacity>
    <Text style={{ margin: 10 }}>Token: {token}</Text>
   
    <InstagramLogin
      ref={ref => (this.instagramLogin = ref)}
      appId='appId'
      appSecret='appSecret'
      redirectUrl='redirectUrl'
      scopes={['publish_video',    'pages_show_list','instagram_basic','instagram_content_publish','pages_read_engagement']}
      onLoginSuccess={this.setIgToken}
      onLoginFailure={(data) => console.log(data)}
    />
  </View>
 );
 };
EN

回答 1

Stack Overflow用户

发布于 2021-07-10 18:47:35

我有一个2部分的问题。

  1. 多反应webview是一个问题,因此删除instagram日志中的问题,如stackoverflow.com. log /a/67917642/8704042
  2. 面对连接问题,因为我的模拟器无法访问互联网。在我的例子中,它原来是我的开发环境(Windows)被破坏了,在修复它开始工作时(操作系统重新格式化为我工作)。但是我也看到过其他人通过vpn设置检查它,在我的情况下,我一直收到一个错误,比如“呃.无法得到IP”。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68296055

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档