3

i installed react-native-fbsdk-next on ios and it works fine, only on android the screen shows up to log in but does not call any other actions after that.

it just closes the webview

  • I added SHA1 signature to fb dev & package name

  • strings.xml (appid & client id)

  • manifest.xml

  • build.gradle (app)

    dependencies { implementation 'com.facebook.android:facebook-android-sdk:latest.release' implementation fileTree(dir: "libs", include: ["*.jar"]) //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" // From node_modules ... }

build.gradle (android)

buildscript {
    ext {
        ...
        googlePlayServicesAuthVersion = "19.2.0"
    }
    repositories {
        google()
        mavenCentral()
        jcenter()
    }

and this is where you click and in ios you login where as android it closes and does not call the callback facebook login view

For a workaround, i can login with

    <Button title={'Login with Facebook'} onPress={() => {
LoginManager.logInWithPermissions(["public_profile", "email"]).then(
function (result) {
if (result.isCancelled) {
alert("Login Cancelled " + JSON.stringify(result))
} else {
alert("Login success with  permisssions: " + result.grantedPermissions.toString());
alert("Login Success " + result.toString());
}
},
function (error) {
alert("Login failed with error: " + error);
}
)
}} />

but not

<LoginButton style={{paddingVertical: 25, width: '100%'}} 
          onLoginFinished={ 
            (error, result) => {
              console.log("FC");

              if (error) {
                console.log("login has error: " + result.error);
              } else if (result.isCancelled) {
                console.log("login is cancelled.");
              } else {
                // this.props.loading({showing: true, text: "loggin in"});
                AccessToken.getCurrentAccessToken().then(
                  (data) => {
                    getInfoFromToken(data.accessToken);
                  }
                )
                // this.props.loggedIn(true);
              }
            }
          }
          onLogoutFinished={() => {
            // this.props.userInfo(false)
            console.log('social button');
            }}/>

Thankyou

Ethan
  • 116
  • 8

0 Answers0