react-native-macos 0.0.0-dd6d6b77d → 0.0.0-ddcc38f1b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/WebSocket/RCTSRWebSocket.m +23 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/Views/ScrollView/MacOS/RCTScrollContentLocalData.h +2 -2
- package/React/Views/ScrollView/MacOS/RCTScrollContentLocalData.m +4 -4
- package/React/Views/ScrollView/RCTScrollContentView.m +10 -24
- package/React/Views/ScrollView/RCTScrollView.m +1 -5
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +27 -15
- package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java +12 -0
- package/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java +6 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/package.json +1 -1
- package/template/ios/HelloWorld.xcodeproj/project.pbxproj +2 -0
- package/template/package.json +1 -1
|
@@ -540,10 +540,33 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
|
|
540
540
|
// ]TODO(macOS ISS#2323203)
|
|
541
541
|
}
|
|
542
542
|
|
|
543
|
+
// [TODO(macOS GH#774)
|
|
544
|
+
// We've seen a rare ASan crash where _inputStream seems to be invalid. This is just a safety check.
|
|
545
|
+
#if DEBUG
|
|
546
|
+
[self _validateStream:_outputStream name:@"_outputStream"];
|
|
547
|
+
[self _validateStream:_inputStream name:@"_inputStream"];
|
|
548
|
+
#endif
|
|
549
|
+
// ]TODO(macOS GH#774)
|
|
550
|
+
|
|
543
551
|
[_outputStream open];
|
|
544
552
|
[_inputStream open];
|
|
545
553
|
}
|
|
546
554
|
|
|
555
|
+
// [TODO(macOS GH#774)
|
|
556
|
+
#if DEBUG
|
|
557
|
+
- (void)_validateStream:(NSStream *)stream name:(NSString *)name {
|
|
558
|
+
NSStreamStatus status = stream.streamStatus;
|
|
559
|
+
if (status != NSStreamStatusNotOpen) {
|
|
560
|
+
RCTLogWarn(@"%@ was already opened, why are we opening it again? status=%@", name, @(status));
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
if (stream.delegate == nil) {
|
|
564
|
+
RCTLogError(@"%@'s delegate is nil, did we clean it up too early?", name);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
#endif
|
|
568
|
+
// ]TODO(macOS GH#774)
|
|
569
|
+
|
|
547
570
|
- (void)scheduleInRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode
|
|
548
571
|
{
|
|
549
572
|
[_outputStream scheduleInRunLoop:aRunLoop forMode:mode];
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -14,8 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
14
14
|
@property (nonatomic, assign) CGFloat horizontalScrollerHeight;
|
|
15
15
|
@property (nonatomic, assign) CGFloat verticalScrollerWidth;
|
|
16
16
|
|
|
17
|
-
- (instancetype)
|
|
18
|
-
|
|
17
|
+
- (instancetype)initWithVerticalScrollerWidth:(CGFloat)verticalScrollerWidth
|
|
18
|
+
horizontalScrollerHeight:(CGFloat)horizontalScrollerHeight;
|
|
19
19
|
|
|
20
20
|
@end
|
|
21
21
|
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
@implementation RCTScrollContentLocalData
|
|
11
11
|
|
|
12
|
-
- (instancetype)
|
|
13
|
-
|
|
12
|
+
- (instancetype)initWithVerticalScrollerWidth:(CGFloat)verticalScrollerWidth
|
|
13
|
+
horizontalScrollerHeight:(CGFloat)horizontalScrollerHeight;
|
|
14
14
|
{
|
|
15
15
|
if (self = [super init]) {
|
|
16
|
-
_verticalScrollerWidth =
|
|
17
|
-
_horizontalScrollerHeight =
|
|
16
|
+
_verticalScrollerWidth = verticalScrollerWidth;
|
|
17
|
+
_horizontalScrollerHeight = horizontalScrollerHeight;
|
|
18
18
|
}
|
|
19
19
|
return self;
|
|
20
20
|
}
|
|
@@ -18,15 +18,11 @@
|
|
|
18
18
|
#import "RCTScrollView.h"
|
|
19
19
|
|
|
20
20
|
@implementation RCTScrollContentView
|
|
21
|
-
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
22
|
-
{
|
|
23
|
-
BOOL _hasHorizontalScroller;
|
|
24
|
-
BOOL _hasVerticalScroller;
|
|
25
|
-
}
|
|
26
|
-
#endif // ]TODO(macOS GH#774)
|
|
27
21
|
|
|
28
22
|
- (void)reactSetFrame:(CGRect)frame
|
|
29
23
|
{
|
|
24
|
+
[super reactSetFrame:frame];
|
|
25
|
+
|
|
30
26
|
#if !TARGET_OS_OSX // TODO(macOS GH#774)
|
|
31
27
|
RCTScrollView *scrollView = (RCTScrollView *)self.superview.superview;
|
|
32
28
|
#else // [TODO(macOS GH#774)
|
|
@@ -34,8 +30,6 @@
|
|
|
34
30
|
RCTScrollView *scrollView = (RCTScrollView *)self.superview.superview.superview;
|
|
35
31
|
#endif // ]TODO(macOS GH#774)
|
|
36
32
|
|
|
37
|
-
[super reactSetFrame:frame];
|
|
38
|
-
|
|
39
33
|
if (!scrollView) {
|
|
40
34
|
return;
|
|
41
35
|
}
|
|
@@ -43,7 +37,6 @@
|
|
|
43
37
|
RCTAssert([scrollView isKindOfClass:[RCTScrollView class]], @"Unexpected view hierarchy of RCTScrollView component.");
|
|
44
38
|
|
|
45
39
|
[scrollView updateContentSizeIfNeeded];
|
|
46
|
-
|
|
47
40
|
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
48
41
|
// On macOS scroll indicators may float over the content view like they do in iOS
|
|
49
42
|
// or depending on system preferences they may be outside of the content view
|
|
@@ -52,21 +45,14 @@
|
|
|
52
45
|
// the contents will overflow causing the scroll indicators to appear unnecessarily.
|
|
53
46
|
NSScrollView *platformScrollView = [scrollView scrollView];
|
|
54
47
|
if ([platformScrollView scrollerStyle] == NSScrollerStyleLegacy) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
RCTScrollContentLocalData *localData =
|
|
65
|
-
[[RCTScrollContentLocalData alloc]
|
|
66
|
-
initWithVerticalScroller:[platformScrollView verticalScroller]
|
|
67
|
-
horizontalScroller:[platformScrollView horizontalScroller]];
|
|
68
|
-
[[[scrollView bridge] uiManager] setLocalData:localData forView:self];
|
|
69
|
-
}
|
|
48
|
+
CGFloat horizontalScrollerHeight = [platformScrollView hasHorizontalScroller] ? NSHeight([[platformScrollView horizontalScroller] frame]) : 0;
|
|
49
|
+
CGFloat verticalScrollerWidth = [platformScrollView hasVerticalScroller] ? NSWidth([[platformScrollView verticalScroller] frame]) : 0;
|
|
50
|
+
|
|
51
|
+
RCTScrollContentLocalData *localData =
|
|
52
|
+
[[RCTScrollContentLocalData alloc]
|
|
53
|
+
initWithVerticalScrollerWidth:horizontalScrollerHeight
|
|
54
|
+
horizontalScrollerHeight:verticalScrollerWidth];
|
|
55
|
+
[[[scrollView bridge] uiManager] setLocalData:localData forView:self];
|
|
70
56
|
}
|
|
71
57
|
#endif // ]TODO(macOS GH#774)
|
|
72
58
|
}
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
self.scrollEnabled = YES;
|
|
57
57
|
self.hasHorizontalScroller = YES;
|
|
58
58
|
self.hasVerticalScroller = YES;
|
|
59
|
+
self.autohidesScrollers = YES;
|
|
59
60
|
self.panGestureRecognizer = [[NSPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleCustomPan:)];
|
|
60
61
|
#else // ]TODO(macOS GH#774)
|
|
61
62
|
[self.panGestureRecognizer addTarget:self action:@selector(handleCustomPan:)];
|
|
@@ -642,11 +643,6 @@ static inline void RCTApplyTransformationAccordingLayoutDirection(
|
|
|
642
643
|
[self react_updateClippedSubviewsWithClipRect:clipRect relativeToView:clipView];
|
|
643
644
|
_lastClippedToRect = bounds;
|
|
644
645
|
}
|
|
645
|
-
|
|
646
|
-
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
647
|
-
[[self scrollView] setHasHorizontalScroller:[self isHorizontal:_scrollView]];
|
|
648
|
-
[[self scrollView] setHasVerticalScroller:[self isVertical:_scrollView]];
|
|
649
|
-
#endif // ]TODO(macOS GH#774)
|
|
650
646
|
}
|
|
651
647
|
|
|
652
648
|
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
@@ -156,12 +156,14 @@ public class ReactInstanceManager {
|
|
|
156
156
|
/* accessed from any thread */
|
|
157
157
|
private final JavaScriptExecutorFactory mJavaScriptExecutorFactory;
|
|
158
158
|
|
|
159
|
+
// See {@code ReactInstanceManagerBuilder} for description of all flags here.
|
|
159
160
|
private @Nullable List<String> mViewManagerNames = null;
|
|
160
161
|
private final @Nullable JSBundleLoader mBundleLoader;
|
|
161
162
|
private final @Nullable String mJSMainModulePath; /* path to JS bundle root on Metro */
|
|
162
163
|
private final List<ReactPackage> mPackages;
|
|
163
164
|
private final DevSupportManager mDevSupportManager;
|
|
164
165
|
private final boolean mUseDeveloperSupport;
|
|
166
|
+
private final boolean mRequireActivity;
|
|
165
167
|
private @Nullable ComponentNameResolverManager mComponentNameResolverManager;
|
|
166
168
|
private @Nullable RuntimeSchedulerManager mRuntimeSchedulerManager;
|
|
167
169
|
private final @Nullable NotThreadSafeBridgeIdleDebugListener mBridgeIdleDebugListener;
|
|
@@ -216,6 +218,7 @@ public class ReactInstanceManager {
|
|
|
216
218
|
@Nullable String jsMainModulePath,
|
|
217
219
|
List<ReactPackage> packages,
|
|
218
220
|
boolean useDeveloperSupport,
|
|
221
|
+
boolean requireActivity,
|
|
219
222
|
@Nullable NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener,
|
|
220
223
|
LifecycleState initialLifecycleState,
|
|
221
224
|
@Nullable UIImplementationProvider mUIImplementationProvider,
|
|
@@ -233,6 +236,7 @@ public class ReactInstanceManager {
|
|
|
233
236
|
|
|
234
237
|
DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(applicationContext);
|
|
235
238
|
|
|
239
|
+
// See {@code ReactInstanceManagerBuilder} for description of all flags here.
|
|
236
240
|
mApplicationContext = applicationContext;
|
|
237
241
|
mCurrentActivity = currentActivity;
|
|
238
242
|
mDefaultBackButtonImpl = defaultHardwareBackBtnHandler;
|
|
@@ -241,6 +245,7 @@ public class ReactInstanceManager {
|
|
|
241
245
|
mJSMainModulePath = jsMainModulePath;
|
|
242
246
|
mPackages = new ArrayList<>();
|
|
243
247
|
mUseDeveloperSupport = useDeveloperSupport;
|
|
248
|
+
mRequireActivity = requireActivity;
|
|
244
249
|
Systrace.beginSection(
|
|
245
250
|
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "ReactInstanceManager.initDevSupportManager");
|
|
246
251
|
mDevSupportManager =
|
|
@@ -558,16 +563,20 @@ public class ReactInstanceManager {
|
|
|
558
563
|
* @param activity the activity being paused
|
|
559
564
|
*/
|
|
560
565
|
@ThreadConfined(UI)
|
|
561
|
-
public void onHostPause(Activity activity) {
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
566
|
+
public void onHostPause(@Nullable Activity activity) {
|
|
567
|
+
if (mRequireActivity) {
|
|
568
|
+
Assertions.assertCondition(mCurrentActivity != null);
|
|
569
|
+
}
|
|
570
|
+
if (mCurrentActivity != null) {
|
|
571
|
+
Assertions.assertCondition(
|
|
572
|
+
activity == mCurrentActivity,
|
|
573
|
+
"Pausing an activity that is not the current activity, this is incorrect! "
|
|
574
|
+
+ "Current activity: "
|
|
575
|
+
+ mCurrentActivity.getClass().getSimpleName()
|
|
576
|
+
+ " "
|
|
577
|
+
+ "Paused activity: "
|
|
578
|
+
+ activity.getClass().getSimpleName());
|
|
579
|
+
}
|
|
571
580
|
onHostPause();
|
|
572
581
|
}
|
|
573
582
|
|
|
@@ -583,7 +592,8 @@ public class ReactInstanceManager {
|
|
|
583
592
|
* this instance of {@link ReactInstanceManager}.
|
|
584
593
|
*/
|
|
585
594
|
@ThreadConfined(UI)
|
|
586
|
-
public void onHostResume(
|
|
595
|
+
public void onHostResume(
|
|
596
|
+
@Nullable Activity activity, DefaultHardwareBackBtnHandler defaultBackButtonImpl) {
|
|
587
597
|
UiThreadUtil.assertOnUiThread();
|
|
588
598
|
|
|
589
599
|
mDefaultBackButtonImpl = defaultBackButtonImpl;
|
|
@@ -592,7 +602,7 @@ public class ReactInstanceManager {
|
|
|
592
602
|
|
|
593
603
|
/** Use this method when the activity resumes. */
|
|
594
604
|
@ThreadConfined(UI)
|
|
595
|
-
public void onHostResume(Activity activity) {
|
|
605
|
+
public void onHostResume(@Nullable Activity activity) {
|
|
596
606
|
UiThreadUtil.assertOnUiThread();
|
|
597
607
|
|
|
598
608
|
mCurrentActivity = activity;
|
|
@@ -631,8 +641,8 @@ public class ReactInstanceManager {
|
|
|
631
641
|
// activity is attached to window, we can enable dev support immediately
|
|
632
642
|
mDevSupportManager.setDevSupportEnabled(true);
|
|
633
643
|
}
|
|
634
|
-
} else {
|
|
635
|
-
// there is no activity, we can enable dev support
|
|
644
|
+
} else if (!mRequireActivity) {
|
|
645
|
+
// there is no activity, but we can enable dev support
|
|
636
646
|
mDevSupportManager.setDevSupportEnabled(true);
|
|
637
647
|
}
|
|
638
648
|
}
|
|
@@ -666,7 +676,9 @@ public class ReactInstanceManager {
|
|
|
666
676
|
* @param activity the activity being destroyed
|
|
667
677
|
*/
|
|
668
678
|
@ThreadConfined(UI)
|
|
669
|
-
public void onHostDestroy(Activity activity) {
|
|
679
|
+
public void onHostDestroy(@Nullable Activity activity) {
|
|
680
|
+
// In some cases, Activity may (correctly) be null.
|
|
681
|
+
// See mRequireActivity flag.
|
|
670
682
|
if (activity == mCurrentActivity) {
|
|
671
683
|
onHostDestroy();
|
|
672
684
|
}
|
|
@@ -45,6 +45,7 @@ public class ReactInstanceManagerBuilder {
|
|
|
45
45
|
private @Nullable NotThreadSafeBridgeIdleDebugListener mBridgeIdleDebugListener;
|
|
46
46
|
private @Nullable Application mApplication;
|
|
47
47
|
private boolean mUseDeveloperSupport;
|
|
48
|
+
private boolean mRequireActivity;
|
|
48
49
|
private @Nullable LifecycleState mInitialLifecycleState;
|
|
49
50
|
private @Nullable UIImplementationProvider mUIImplementationProvider;
|
|
50
51
|
private @Nullable NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler;
|
|
@@ -171,6 +172,16 @@ public class ReactInstanceManagerBuilder {
|
|
|
171
172
|
return this;
|
|
172
173
|
}
|
|
173
174
|
|
|
175
|
+
/**
|
|
176
|
+
* When {@code false}, indicates that correct usage of React Native will NOT involve an Activity.
|
|
177
|
+
* For the vast majority of Android apps in the ecosystem, this will not need to change. Unless
|
|
178
|
+
* you really know what you're doing, you should probably not change this!
|
|
179
|
+
*/
|
|
180
|
+
public ReactInstanceManagerBuilder setRequireActivity(boolean requireActivity) {
|
|
181
|
+
mRequireActivity = requireActivity;
|
|
182
|
+
return this;
|
|
183
|
+
}
|
|
184
|
+
|
|
174
185
|
/**
|
|
175
186
|
* Sets the initial lifecycle state of the host. For example, if the host is already resumed at
|
|
176
187
|
* creation time, we wouldn't expect an onResume call until we get an onPause call.
|
|
@@ -283,6 +294,7 @@ public class ReactInstanceManagerBuilder {
|
|
|
283
294
|
mJSMainModulePath,
|
|
284
295
|
mPackages,
|
|
285
296
|
mUseDeveloperSupport,
|
|
297
|
+
mRequireActivity,
|
|
286
298
|
mBridgeIdleDebugListener,
|
|
287
299
|
Assertions.assertNotNull(mInitialLifecycleState, "Initial lifecycle state was not set"),
|
|
288
300
|
mUIImplementationProvider,
|
|
@@ -68,6 +68,7 @@ public abstract class ReactNativeHost {
|
|
|
68
68
|
.setApplication(mApplication)
|
|
69
69
|
.setJSMainModulePath(getJSMainModuleName())
|
|
70
70
|
.setUseDeveloperSupport(getUseDeveloperSupport())
|
|
71
|
+
.setRequireActivity(getShouldRequireActivity())
|
|
71
72
|
.setRedBoxHandler(getRedBoxHandler())
|
|
72
73
|
.setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
|
|
73
74
|
.setUIImplementationProvider(getUIImplementationProvider())
|
|
@@ -124,6 +125,11 @@ public abstract class ReactNativeHost {
|
|
|
124
125
|
return null;
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
/** Returns whether or not to treat it as normal if Activity is null. */
|
|
129
|
+
public boolean getShouldRequireActivity() {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
|
|
127
133
|
/**
|
|
128
134
|
* Returns the name of the main module. Determines the URL used to fetch the JS bundle from Metro.
|
|
129
135
|
* It is only used when dev support is enabled. This is the first file to be executed once the
|
package/package.json
CHANGED
|
@@ -439,6 +439,7 @@
|
|
|
439
439
|
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
|
|
440
440
|
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
|
|
441
441
|
"\"$(inherited)\"",
|
|
442
|
+
"\"$(SDKROOT)/usr/lib/swift\"",
|
|
442
443
|
);
|
|
443
444
|
MTL_ENABLE_DEBUG_INFO = YES;
|
|
444
445
|
ONLY_ACTIVE_ARCH = YES;
|
|
@@ -497,6 +498,7 @@
|
|
|
497
498
|
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
|
|
498
499
|
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
|
|
499
500
|
"\"$(inherited)\"",
|
|
501
|
+
"\"$(SDKROOT)/usr/lib/swift\"",
|
|
500
502
|
);
|
|
501
503
|
MTL_ENABLE_DEBUG_INFO = NO;
|
|
502
504
|
SDKROOT = iphoneos;
|