我想实现 Instagram 登录。但是当我安装react-native-instagram-login npm并放置此代码时
import InstagramLogin from 'react-native-instagram-login';
<InstagramLogin
ref={ref => (this.instagramLogin = ref)}
appId='your-app-id'
appSecret='your-app-secret'
redirectUrl='your-redirect-Url'
scopes={['user_profile', 'user_media']}
onLoginSuccess={this.setIgToken}
onLoginFailure={(data) => console.log(data)}
/>
运行这段代码,得到一个错误 - 1.Invariant Violation:当 instagram 在 React Native 中登录时,尝试注册两个同名 RNCWebview 的视图 2.Module AppRegistry未注册可调用模块(调用runApplication)
如何消除这个错误。 这里是package.json
"dependencies": {
"@react-native-community/cookies": "^5.0.1",
"@react-native-community/masked-view": "^0.1.10",
"@react-native-community/viewpager": "^5.0.11",
"@react-native-google-signin/google-signin": "^6.0.0",
"firebase": "^8.6.0",
"html-entities": "^1.3.1",
"lottie-react-native": "^3.5.0",
"native-base": "^2.13.12",
"react": "^17.0.2",
"react-dom": "^16.13.1",
"react-native": "0.63.2",
"react-native-agora": "^3.2.2",
"react-native-animated-loader": "0.0.8",
"react-native-awesome-alerts": "^1.3.3",
"react-native-banner-carousel": "^1.0.3",
"react-native-checkbox-heaven": "^0.1.6",
"react-native-datepicker": "^1.7.2",
"react-native-document-picker": "^5.0.3",
"react-native-fbsdk-next": "^4.1.0",
"react-native-gesture-handler": "^1.7.0",
"react-native-get-random-values": "^1.6.0",
"react-native-gifted-chat": "^0.16.3",
"react-native-image-view": "^2.1.9",
"react-native-image-viewing": "^0.2.0",
"react-native-image-zoom-viewer": "^3.0.1",
"react-native-instagram-login": "^2.0.4",
"react-native-keyboard-aware-scrollview": "^2.1.0",
"react-native-linear-gradient": "^2.5.6",
"react-native-login-twitter": "^3.0.4",
"react-native-material-dropdown": "^0.11.1",
"react-native-media-controls": "^2.3.0",
"react-native-pager-view": "^5.1.6",
"react-native-reanimated": "^1.12.0",
"react-native-render-html": "^4.2.3",
"react-native-responsive-dimensions": "^3.1.1",
"react-native-safe-area-context": "^3.1.4",
"react-native-screens": "^2.10.1",
"react-native-share": "^3.7.0",
"react-native-shimmer-placeholder": "^1.0.36",
"react-native-splash-screen": "^3.2.0",
"react-native-star-rating": "^1.1.0",
"react-native-tab-view": "^2.15.2",
"react-native-thumbnail-video": "^0.1.2",
"react-native-vector-icons": "^7.0.0",
"react-native-video": "^5.1.1",
"react-native-video-controls": "^2.7.1",
"react-native-web": "^0.13.6",
"react-native-webview": "^11.6.2",
"react-navigation": "^4.4.0",
"react-navigation-drawer": "^2.5.0",
"react-navigation-stack": "^2.8.2",
"react-navigation-tabs": "^2.9.0",
"react-redux": "^7.2.1",
"redux": "^4.0.5",
"uuid": "^8.3.2"
},
删除“react-native-instagram-login”中的“react-native-webview”
rm -rf node_modules/react-native-instagram-login/node_modules/react-native-webview
因为重复的“react-native-webview”
奔跑
npm ls react-native-webview
该软件包可能已被另一个软件包安装,在我的情况下是[电子邮件受保护]
所以我删除了我的react-native-webview并重新安装了确切的版本 flutterwave-react-native
在package.json中,只需配置:
{
"scripts": {
"postinstall": "rm -rf node_modules/react-native-instagram-login/node_modules/react-native-webview",
}
}
我不断收到这样的错误: Instagram 保持注销状态