使用 React Native FBSDK 在 Android 上禁用加载 Spinner [英] Disable Loading Spinner on Android Using React Native FBSDK
问题描述
我正在使用 React Native FBSDK 在我的 React Native 中处理 Facebook 身份验证应用.我想使用我自己的加载微调器,但是 LoginManager.logInWithReadPermissions()
似乎已经包含一个加载微调器.有什么办法可以禁用它吗?
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?
相关问题似乎涉及在 AndroidManifest 中的 activity
标签上设置 android:theme="@android:style/Theme.NoDisplay"
.React Native FBSDK 让我加入:
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"/>
在 AndroidManifest 中.我认为将 android:theme
属性附加到这个标签是没有意义的(我已经尝试过这个,但没有达到预期的结果).
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).
我尝试添加以下 activity
标签:
I have tried adding the following activity
tag:
<activity android:name="com.facebook.FacebookAcitivity" android:theme="@android:style/Theme.NoDisplay" tools:replace="android:theme"/>
到我的Android Manifest,除了添加以下属性:
to my Android Manifest, in addition to adding the following attribute:
xmlns:tools="http://schemas.android.com/tools"
到我的 manifest
标签.这会导致应用程序在单击调用 LoginManager.logInWithReadPermissions()
的按钮时立即崩溃.
to my manifest
tag. This results in the application crashing instantaneously, upon clicking the button which invokes LoginManager.logInWithReadPermissions()
.
当我运行 adb logcat
时,堆栈跟踪中出现以下错误消息:
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} 没有在之前调用 finish()onResume() 完成
将我传递给 android:theme
的值更改为 @android:style/Theme.Translucent.NoTitleBar
可防止我的应用程序崩溃.它还改变了加载图标的样式,但不会隐藏它.
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.
推荐答案
这个问题演变成这个答案变得适用.
This question evolved to the point that this answer became applicable.
即在使用 react-native-fbsdk 时禁用 Facebook 的加载微调器:
That is, to disable Facebook's loading spinner when using react-native-fbsdk:
- 将
xmlns:tools="http://schemas.android.com/tools"
添加到 AndroidManifest 中的manifest
标签. - 将
<activity android:name="com.facebook.FacebookAcitivity" android:theme="@style/FullyTranslucent" tools:replace="android:theme"/>
添加到 <代码>应用程序代码>节点. - 将上述答案中指定的样式添加到
/android/app/src/main/res/values/styles.xml
.
- Add
xmlns:tools="http://schemas.android.com/tools"
to themanifest
tag in AndroidManifest. - Add
<activity android:name="com.facebook.FacebookAcitivity" android:theme="@style/FullyTranslucent" tools:replace="android:theme" />
to theapplication
node. - Add the styles specified in the aforementioned answer to
/android/app/src/main/res/values/styles.xml
.
这篇关于使用 React Native FBSDK 在 Android 上禁用加载 Spinner的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!