Skip to content

Commit 1ad0862

Browse files
RSNarafacebook-github-bot
authored andcommitted
Revert D16969764: Make RCTDevLoadingView TurboModule-compatible
Differential Revision: D16969764 Original commit changeset: 47e6682eea3f fbshipit-source-id: d95b76eb8e57bbaff840b3d85f3745b13d622ce0
1 parent 93b892c commit 1ad0862

10 files changed

Lines changed: 27 additions & 77 deletions

File tree

Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,8 +848,8 @@ namespace facebook {
848848
@protocol NativeDevLoadingViewSpec <RCTBridgeModule, RCTTurboModule>
849849

850850
- (void)showMessage:(NSString *)message
851-
color:(NSNumber *)color
852-
backgroundColor:(NSNumber *)backgroundColor;
851+
color:(NSDictionary *)color
852+
backgroundColor:(NSDictionary *)backgroundColor;
853853
- (void)hide;
854854

855855
@end

Libraries/Utilities/NativeDevLoadingView.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
1616
export interface Spec extends TurboModule {
1717
+showMessage: (
1818
message: string,
19-
color: ?number,
20-
backgroundColor: ?number,
19+
color: Object,
20+
backgroundColor: Object,
2121
) => void;
2222
+hide: () => void;
2323
}

React/CoreModules/BUCK

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ rn_apple_library(
105105
) + react_module_plugin_providers(
106106
name = "WebSocketModule",
107107
native_class_func = "RCTWebSocketModuleCls",
108-
) + react_module_plugin_providers(
109-
name = "DevLoadingView",
110-
native_class_func = "RCTDevLoadingViewCls",
111108
),
112109
plugins_header = "FBCoreModulesPlugins.h",
113110
preprocessor_flags = OBJC_ARC_PREPROCESSOR_FLAGS + get_debug_preprocessor_flags() + rn_extra_build_flags() + [

React/CoreModules/CoreModulesPlugins.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ Class RCTRedBoxCls(void) __attribute__((used));
5151
Class RCTTVNavigationEventEmitterCls(void) __attribute__((used));
5252
Class RCTWebSocketExecutorCls(void) __attribute__((used));
5353
Class RCTWebSocketModuleCls(void) __attribute__((used));
54-
Class RCTDevLoadingViewCls(void) __attribute__((used));
5554

5655
#ifdef __cplusplus
5756
}

React/CoreModules/CoreModulesPlugins.mm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ Class RCTCoreModulesClassProvider(const char *name) {
4040
{"TVNavigationEventEmitter", RCTTVNavigationEventEmitterCls},
4141
{"WebSocketExecutor", RCTWebSocketExecutorCls},
4242
{"WebSocketModule", RCTWebSocketModuleCls},
43-
{"DevLoadingView", RCTDevLoadingViewCls},
4443
};
4544

4645
auto p = sCoreModuleClassMap.find(name);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@
66
*/
77

88
#import <UIKit/UIKit.h>
9+
910
#import <React/RCTBridgeModule.h>
1011

1112
@class RCTLoadingProgress;
1213

1314
@interface RCTDevLoadingView : NSObject <RCTBridgeModule>
15+
16+
+ (void)setEnabled:(BOOL)enabled;
17+
- (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(UIColor *)backgroundColor;
18+
- (void)showWithURL:(NSURL *)URL;
1419
- (void)updateProgress:(RCTLoadingProgress *)progress;
20+
- (void)hide;
21+
1522
@end
Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,14 @@
1010
#import <QuartzCore/QuartzCore.h>
1111

1212
#import <React/RCTBridge.h>
13-
#import <React/RCTConvert.h>
1413
#import <React/RCTDefines.h>
15-
#import <React/RCTDevLoadingViewSetEnabled.h>
1614
#import <React/RCTModalHostViewController.h>
1715
#import <React/RCTUtils.h>
18-
#import <FBReactNativeSpec/FBReactNativeSpec.h>
19-
20-
#import "CoreModulesPlugins.h"
21-
22-
using namespace facebook::react;
23-
24-
@interface RCTDevLoadingView () <NativeDevLoadingViewSpec>
25-
@end
2616

2717
#if RCT_DEV | RCT_ENABLE_LOADING_VIEW
2818

19+
static BOOL isEnabled = YES;
20+
2921
@implementation RCTDevLoadingView
3022
{
3123
UIWindow *_window;
@@ -37,6 +29,11 @@ @implementation RCTDevLoadingView
3729

3830
RCT_EXPORT_MODULE()
3931

32+
+ (void)setEnabled:(BOOL)enabled
33+
{
34+
isEnabled = enabled;
35+
}
36+
4037
+ (BOOL)requiresMainQueueSetup
4138
{
4239
return YES;
@@ -60,14 +57,9 @@ - (void)setBridge:(RCTBridge *)bridge
6057
}
6158
}
6259

63-
RCT_EXPORT_METHOD(showMessage:(NSString *)message color:(NSNumber *)color backgroundColor:(NSNumber *)backgroundColor)
64-
{
65-
[self showMessage:message withColor:[RCTConvert UIColor:color] andBackgroundColor:[RCTConvert UIColor:backgroundColor]];
66-
}
67-
68-
-(void)showMessage:(NSString *)message withColor:(UIColor *)color andBackgroundColor:(UIColor *)backgroundColor
60+
RCT_EXPORT_METHOD(showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(UIColor *)backgroundColor)
6961
{
70-
if (!RCTDevLoadingViewGetEnabled()) {
62+
if (!isEnabled) {
7163
return;
7264
}
7365

@@ -107,7 +99,7 @@ -(void)showMessage:(NSString *)message withColor:(UIColor *)color andBackgroundC
10799

108100
RCT_EXPORT_METHOD(hide)
109101
{
110-
if (!RCTDevLoadingViewGetEnabled()) {
102+
if (!isEnabled) {
111103
return;
112104
}
113105

@@ -149,8 +141,8 @@ - (void)showWithURL:(NSURL *)URL
149141
}
150142

151143
[self showMessage:message
152-
withColor:color
153-
andBackgroundColor:backgroundColor];
144+
color:color
145+
backgroundColor:backgroundColor];
154146
}
155147

156148
- (void)updateProgress:(RCTLoadingProgress *)progress
@@ -163,31 +155,19 @@ - (void)updateProgress:(RCTLoadingProgress *)progress
163155
});
164156
}
165157

166-
- (std::shared_ptr<TurboModule>)getTurboModuleWithJsInvoker:(std::shared_ptr<CallInvoker>)jsInvoker
167-
{
168-
return std::make_shared<NativeDevLoadingViewSpecJSI>(self, jsInvoker);
169-
}
170-
171158
@end
172159

173160
#else
174161

175162
@implementation RCTDevLoadingView
176163

177164
+ (NSString *)moduleName { return nil; }
178-
- (void)showMessage:(NSString *)message color:(NSNumber *)color backgroundColor:(NSNumber *)backgroundColor { }
165+
+ (void)setEnabled:(BOOL)enabled { }
166+
- (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(UIColor *)backgroundColor { }
179167
- (void)showWithURL:(NSURL *)URL { }
180168
- (void)updateProgress:(RCTLoadingProgress *)progress { }
181169
- (void)hide { }
182-
- (std::shared_ptr<TurboModule>)getTurboModuleWithJsInvoker:(std::shared_ptr<CallInvoker>)jsInvoker
183-
{
184-
return std::make_shared<NativeDevLoadingViewSpecJSI>(self, jsInvoker);
185-
}
186170

187171
@end
188172

189173
#endif
190-
191-
Class RCTDevLoadingViewCls(void) {
192-
return RCTDevLoadingView.class;
193-
}

React/DevSupport/RCTDevLoadingViewSetEnabled.h

Lines changed: 0 additions & 11 deletions
This file was deleted.

React/DevSupport/RCTDevLoadingViewSetEnabled.m

Lines changed: 0 additions & 22 deletions
This file was deleted.

ReactAndroid/src/main/java/com/facebook/fbreact/specs/NativeDevLoadingViewSpec.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.facebook.react.bridge.ReactContextBaseJavaModule;
1717
import com.facebook.react.bridge.ReactMethod;
1818
import com.facebook.react.bridge.ReactModuleWithSpec;
19+
import com.facebook.react.bridge.ReadableMap;
1920
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
2021

2122
public abstract class NativeDevLoadingViewSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule {
@@ -27,5 +28,5 @@ public NativeDevLoadingViewSpec(ReactApplicationContext reactContext) {
2728
public abstract void hide();
2829

2930
@ReactMethod
30-
public abstract void showMessage(String message, Double color, Double backgroundColor);
31+
public abstract void showMessage(String message, ReadableMap color, ReadableMap backgroundColor);
3132
}

0 commit comments

Comments
 (0)