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 908 forks source link

Custom chrome tab instead of webview dialog #696

Open sangupandi opened 4 years ago

sangupandi commented 4 years ago

When initiating LoginManager.logInWithPermissions() , login request opening in Custom Chrome Tab instead of webview dialog. Is there a way to restrict, open only in Webview Dialog?

sangupandi commented 4 years ago

I have tried login behavior, but its not a proper solution. if (Platform.OS === "android") { LoginManager.setLoginBehavior("web_only") }

tingzhouu commented 4 years ago

I'm using v1.0.4 using setLoginBehavior method and it works. Initially I thought it was opening chrome on my android device, but I checked the app switcher and confirmed that I was still on my app.

For those who are wondering what other possible configurations there are, refer to the source code: node_modules/react-native-fbsdk/js/FBLoginManager.js. The source code snippet pasted below is taken from v1.0.4, I'm not sure if it has changed.

Android: 'native_with_fallback', 'native_only', 'web_only' iOS: 'browser'

export type LoginBehaviorAndroid =
  // Attempt login in using the Facebook App, and if that does not work fall back to web dialog auth.
  | 'native_with_fallback'
  // Only attempt to login using the Facebook App.
  | 'native_only'
  // Only the web dialog auth should be used.
  | 'web_only';
/**
 * Indicate how Facebook Login should be attempted on iOS.
 */
export type LoginBehaviorIOS =
  // Attempts log in through the Safari browser.
  // This is the only behavior supported by the native sdk.
  'browser';