react-native: invariant violation: Native component for RCTFBLoginButton does not exist this error is located at: in RCTFBLoginButton
Is this a bug report?
Yes I think this is a real BUG…
Have you read the Contributing Guidelines?
NO
Environment
OS: macOS Sierra 10.13.3
Node: ya8.9.4
Yarn: 1.3.2
npm: 5.6.0
Watchman: 4.9.0
Xcode: 9.2
Packages: (wanted => installed)
react-native: 0.53.0
react: 16.2.0
Target Platform: iOS (10.3)
Steps to Reproduce
(Write your steps here:)
-
react-native install react-native-fbsdk
and thenreact-native link react-native-fbsdk
-
Follow ALL STEPS from Quickstart IOS (⚠️ With-out the last STEP, becous the test of integration is with the
react-native-fbsdk
package)
3 . Then I put this code for testing my wonderful SDKLoginFacebook for React-Native.
import React from 'react';
import { StyleSheet, Alert, View } from 'react-native';
const FBSDK = require('react-native-fbsdk');
const {
LoginButton,
AccessToken
} = FBSDK;
export default class Login extends React.Component {
render() {
return (
<View>
<LoginButton
publishPermissions={["publish_actions"]}
onLoginFinished={
(error, result) => {
if (error) {
alert("login has error: " + result.error);
} else if (result.isCancelled) {
alert("login is cancelled.");
} else {
AccessToken.getCurrentAccessToken().then(
(data) => {
alert(data.accessToken.toString())
}
)
}
}
}
onLogoutFinished={() => alert("logout.")}/>
</View>
);
}
}
-
Ejecute
react-native run-ios
-
then, EXPLOTE with this error -->
invariant violation: Native component for RCTFBLoginButton does not exist this error is located at: in RCTFBLoginButton at FBLoginButton.js:112
NEED HELP!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 19
- Comments: 37
Hello there!
I don’t know why, but, I was try it agains and now works!!! 🎉 The only different that I have done:
reinstalling
react-native install react-native-fbsdk && react-native link react-native-fbsdk
follow the quicks steps from ios ⚠️ when tutorial tell you that modify your
AppDelegate.m
, please copy this ⬇️AppDelegate.m
LoginButton
fromreact-native-fbsdk
😄 🎉I think
react-native link
is really unstable 😔 In my case, many problems solved by linking manually I recommend to refer this explanationhttps://github.com/lakshmantgld/react-native-fbsdk-example/blob/master/readmeFiles/fbsdkXcode.md
But, just Ignore
react-native link react-native-fbsdk
in the explanation above. And addRCTFBSDK.xcodeproj
to your project’s Library andlibRCTBSDK.a
to project’sLink Binary With Libraries
Everything is done perfectly
I have
Invariant Violation: requireNativeComponent: "RCTFBLoginButton" was not found in the UIManager.
, I’ve tried a few ‘solutions’, not much result.Same crap. What a nightmare.
how do i solve this error?
Same problem in android =/
RN: 0.55.4 RNFSDK: ^0.7.0
@CarlosOrozc we don’t know bro, for that we are here jaja
Linking manually was the solution for me. Lately automatic linking has not worked too well on most libraries for some reason. Did exactly what heyman33 said and it worked immediately afterwards. It’s only two steps and it’s worth learning since it saves you a lot of time in many cases.
BTW: Then I had a crash as soon as I pressed the login button, and thanks to some other forum, I simply had to change “publishPermissions” to “readPermissions” in the LoginButton props.
quit the Metro Bundler, and
react-native run-ios
again@VGamezz19 I still don’t know what kind of black magic was that but I had the same issue, but following your steps, it’s really working know, after a week of researching and testing.
Thanks man
I’ve faced the same issue today.