facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 906 forks source link

Android Login is navigation to another webView instead of showing the modal in the actual Screen #759

Closed felire closed 4 years ago

felire commented 4 years ago

🐛 Bug Report

I integrated the sdk without problems but I don't know what is going on on android. When I click on the Login Button, it navigate to a WebView, instead of showing the typical modal in the screen (I don't have Facebook installed).

To Reproduce

Install and configure the last version of react-native-fbsdk

This is the code of my AndroidManifest.xml:

<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/FACEBOOK_APP_ID"/> 
      <activity android:name="com.facebook.FacebookActivity" android:configChanges= "keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/app_name" /> 
      <activity android:name="com.facebook.CustomTabActivity" android:exported="true"> 
        <intent-filter> 
          <action android:name="android.intent.action.VIEW" /> 
          <category android:name="android.intent.category.DEFAULT" /> 
          <category android:name="android.intent.category.BROWSABLE" /> 
          <data android:scheme="@string/FACEBOOK_BUNDLE_SCHEME" /> 
        </intent-filter> 
      </activity>

Expected Behavior

I want the modal appear in my actual screen

Current Behavior

incorrect webview

Code Example

I'm just integrating so I used the LoginButton from the Readme:

<LoginButton
              onLoginFinished={(error, result) => {
                if (error) {
                  console.log(`login has error: ${result.error}`);
                } else if (result.isCancelled) {
                  console.log('login is cancelled.');
                } else {
                  AccessToken.getCurrentAccessToken().then(data => {
                    console.tron.log(data.accessToken.toString());
                  });
                }
              }}
              onLogoutFinished={() => console.tron.log('logout.')}
            />

Environment

react-native: 0.62.2 react-native-fbsdk: ^2.0.0

felire commented 4 years ago

Any idea what could be?

battulasaivinesh commented 4 years ago
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/FACEBOOK_APP_ID"/> 
      <activity android:name="com.facebook.FacebookActivity" android:configChanges= "keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/app_name" /> 
      <activity android:enabled="false" android:name="com.facebook.CustomTabActivity" android:exported="true"> 
        <intent-filter> 
          <action android:name="android.intent.action.VIEW" /> 
          <category android:name="android.intent.category.DEFAULT" /> 
          <category android:name="android.intent.category.BROWSABLE" /> 
          <data android:scheme="@string/FACEBOOK_BUNDLE_SCHEME" /> 
        </intent-filter> 
      </activity>

The trick is to Add android:enabled="false" to com.facebook.CustomTabActivity Activity

felire commented 4 years ago

Thanks! It works!