mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
//xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/devloading:devloadingAndroid (#43975)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43975 Changelog: [Internal] Reviewed By: cortinico Differential Revision: D55725612 fbshipit-source-id: b597e906c8e2cdb571c8882e82083626a74a6d70
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5b77df0199
commit
026361ddb4
@@ -3237,12 +3237,17 @@ public class com/facebook/react/modules/deviceinfo/DeviceInfoModule : com/facebo
|
||||
public fun onHostResume ()V
|
||||
}
|
||||
|
||||
public class com/facebook/react/modules/devloading/DevLoadingModule : com/facebook/fbreact/specs/NativeDevLoadingViewSpec {
|
||||
public final class com/facebook/react/modules/devloading/DevLoadingModule : com/facebook/fbreact/specs/NativeDevLoadingViewSpec {
|
||||
public static final field Companion Lcom/facebook/react/modules/devloading/DevLoadingModule$Companion;
|
||||
public static final field NAME Ljava/lang/String;
|
||||
public fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;)V
|
||||
public fun hide ()V
|
||||
public fun showMessage (Ljava/lang/String;Ljava/lang/Double;Ljava/lang/Double;)V
|
||||
}
|
||||
|
||||
public final class com/facebook/react/modules/devloading/DevLoadingModule$Companion {
|
||||
}
|
||||
|
||||
public final class com/facebook/react/modules/devtoolssettings/DevToolsSettingsManagerModule : com/facebook/fbreact/specs/NativeDevToolsSettingsManagerSpec {
|
||||
public fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;)V
|
||||
public fun getConsolePatchSettings ()Ljava/lang/String;
|
||||
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.modules.devloading;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.fbreact.specs.NativeDevLoadingViewSpec;
|
||||
import com.facebook.react.bridge.JSExceptionHandler;
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.devsupport.DevSupportManagerBase;
|
||||
import com.facebook.react.devsupport.interfaces.DevLoadingViewManager;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
|
||||
/** {@link NativeModule} that allows JS to show dev loading view. */
|
||||
@ReactModule(name = NativeDevLoadingViewSpec.NAME)
|
||||
public class DevLoadingModule extends NativeDevLoadingViewSpec {
|
||||
|
||||
private final JSExceptionHandler mJSExceptionHandler;
|
||||
private @Nullable DevLoadingViewManager mDevLoadingViewManager;
|
||||
|
||||
public DevLoadingModule(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
mJSExceptionHandler = reactContext.getJSExceptionHandler();
|
||||
if (mJSExceptionHandler != null && mJSExceptionHandler instanceof DevSupportManagerBase) {
|
||||
mDevLoadingViewManager =
|
||||
((DevSupportManagerBase) mJSExceptionHandler).getDevLoadingViewManager();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMessage(final String message, final Double color, final Double backgroundColor) {
|
||||
|
||||
UiThreadUtil.runOnUiThread(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mDevLoadingViewManager != null) {
|
||||
mDevLoadingViewManager.showMessage(message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
|
||||
UiThreadUtil.runOnUiThread(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mDevLoadingViewManager != null) {
|
||||
mDevLoadingViewManager.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.modules.devloading
|
||||
|
||||
import com.facebook.fbreact.specs.NativeDevLoadingViewSpec
|
||||
import com.facebook.react.bridge.JSExceptionHandler
|
||||
import com.facebook.react.bridge.NativeModule
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.bridge.UiThreadUtil
|
||||
import com.facebook.react.devsupport.DevSupportManagerBase
|
||||
import com.facebook.react.devsupport.interfaces.DevLoadingViewManager
|
||||
import com.facebook.react.module.annotations.ReactModule
|
||||
|
||||
/** [NativeModule] that allows JS to show dev loading view. */
|
||||
@ReactModule(name = NativeDevLoadingViewSpec.NAME)
|
||||
public class DevLoadingModule(reactContext: ReactApplicationContext) :
|
||||
NativeDevLoadingViewSpec(reactContext) {
|
||||
|
||||
private val jsExceptionHandler: JSExceptionHandler? = reactContext.jsExceptionHandler
|
||||
private var devLoadingViewManager: DevLoadingViewManager? = null
|
||||
|
||||
init {
|
||||
if (jsExceptionHandler != null && jsExceptionHandler is DevSupportManagerBase) {
|
||||
devLoadingViewManager = jsExceptionHandler.devLoadingViewManager
|
||||
}
|
||||
}
|
||||
|
||||
public override fun showMessage(message: String, color: Double?, backgroundColor: Double?) {
|
||||
UiThreadUtil.runOnUiThread(Runnable { devLoadingViewManager?.showMessage(message) })
|
||||
}
|
||||
|
||||
public override fun hide() {
|
||||
UiThreadUtil.runOnUiThread(Runnable { devLoadingViewManager?.hide() })
|
||||
}
|
||||
|
||||
public companion object {
|
||||
public const val NAME: String = NativeDevLoadingViewSpec.NAME
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user