0

I am using the React Native FBSDK to handle Facebook authentication within my React Native application. I would like to use my own loading spinner, however LoginManager.logInWithReadPermissions() seems to include a loading spinner already. Is there any way in which I can disable this?

Related questions seem to involve setting android:theme="@android:style/Theme.NoDisplay" on activity tags in the AndroidManifest. The React Native FBSDK got me to include:

<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id" />

inside the AndroidManifest. I don't believe it would make sense to attach an android:theme attribute to this tag (I have tried this irrespectively, and did not reach the desired outcome).

I have tried adding the following activity tag:

<activity android:name="com.facebook.FacebookAcitivity" android:theme="@android:style/Theme.NoDisplay" tools:replace="android:theme" />

to my Android Manifest, in addition to adding the following attribute:

xmlns:tools="http://schemas.android.com/tools"

to my manifest tag. This results in the application crashing instantaneously, upon clicking the button which invokes LoginManager.logInWithReadPermissions().

When I run adb logcat, the following error message is present in the stacktrace:

AndroidRuntime: java.lang.IllegalStateException: Activity {com.<my-company-name>.<my-project-name>/com.facebook.FacebookActivity} did not call finish() prior to onResume() completing

Changing the value which I pass into android:theme to @android:style/Theme.Translucent.NoTitleBar prevents my application from crashing. It also changes the styling of the loading icon, but does not hide it.

Charles Salmon
  • 467
  • 3
  • 12
  • 1
    There should still be an `activity` tag with `android:name="com.facebook.FacebookActivity"` in your `AndroidManifest`. Did you try adding that theme attribute you mentioned there? You wouldn't need it on all `activity` tags, just that one. – Ben Kane Mar 22 '18 at 22:24
  • The `activity` tag is not present (I believe FBSDK handles this). I've tried adding this, but have encountered further problems. I've updated my question to specify what I have attempted. – Charles Salmon Mar 22 '18 at 22:50
  • Did you run `react-native install react-native-fbsdk` and `react-native link react-native-fbsdk`? I've used the RN FBSDK before and the tag is in my manifest. Maybe that's not how it works anymore – Ben Kane Mar 22 '18 at 22:54
  • I did indeed. I followed the Installation instructions specified on the RN FBSDK GitHub page. – Charles Salmon Mar 22 '18 at 22:56
  • I've managed to isolate the problem to using `Theme.NoDisplay`, and have added additional detail to the question to reflect this. – Charles Salmon Mar 22 '18 at 23:01

1 Answers1

1

This question evolved to the point that this answer became applicable.

That is, to disable Facebook's loading spinner when using react-native-fbsdk:

  • Add xmlns:tools="http://schemas.android.com/tools" to the manifest tag in AndroidManifest.
  • Add <activity android:name="com.facebook.FacebookAcitivity" android:theme="@style/FullyTranslucent" tools:replace="android:theme" /> to the application node.
  • Add the styles specified in the aforementioned answer to /android/app/src/main/res/values/styles.xml.
Charles Salmon
  • 467
  • 3
  • 12
  • I'm using FBSDK 0.8.0, I added all and it doesn't work, the spinner dialog appear when I use LoginManager. – CampDev Dec 28 '18 at 17:06