react-native-macos 0.77.6 → 0.77.7
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/Blob/RCTBlobManager.h +0 -0
- package/Libraries/Blob/RCTBlobManager.mm +0 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +0 -0
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Network/RCTDataRequestHandler.mm +17 -3
- package/Libraries/Network/RCTFileRequestHandler.mm +17 -3
- package/Libraries/StyleSheet/normalizeColor.js +0 -0
- package/React/Base/RCTJavaScriptLoader.h +0 -0
- package/React/Base/RCTJavaScriptLoader.mm +0 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/DevSupport/RCTPausedInDebuggerOverlayController.mm +3 -5
- package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +18 -4
- package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +1 -4
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +22 -3
- package/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm +1 -1
- package/React/Fabric/Surface/RCTFabricSurface.mm +1 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +13 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.kt +3 -16
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.kt +13 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java +0 -3
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderRadiusStyle.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt +39 -0
- package/ReactCommon/React-FabricComponents.podspec +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/react/renderer/components/modal/CMakeLists.txt +4 -1
- package/ReactCommon/react/renderer/components/modal/ModalHostViewComponentDescriptor.h +3 -2
- package/ReactCommon/react/renderer/components/modal/ModalHostViewState.h +4 -12
- package/ReactCommon/react/renderer/components/modal/ModalHostViewUtils.h +2 -2
- package/ReactCommon/react/renderer/components/modal/ModalHostViewUtils.mm +1 -1
- package/ReactCommon/react/renderer/components/modal/platform/android/JReactModalHostView.h +38 -0
- package/ReactCommon/react/renderer/components/modal/platform/android/ModalHostViewUtils.cpp +18 -0
- package/ReactCommon/react/renderer/components/modal/platform/cxx/ModalHostViewUtils.cpp +17 -0
- package/ReactCommon/react/renderer/components/scrollview/ScrollEvent.cpp +33 -0
- package/ReactCommon/react/renderer/components/scrollview/ScrollEvent.h +17 -0
- package/ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.cpp +3 -2
- package/ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.h +2 -1
- package/ReactCommon/react/runtime/TimerManager.cpp +6 -4
- package/ReactCommon/react/runtime/TimerManager.h +3 -1
- package/ReactCommon/react/runtime/tests/cxx/ReactInstanceTest.cpp +9 -5
- package/local-cli/cli.js +0 -0
- package/package.json +12 -12
- package/scripts/cocoapods/autolinking.rb +206 -0
- package/scripts/cocoapods/autolinking_utils.rb +25 -0
- package/scripts/cocoapods/codegen.rb +59 -0
- package/scripts/cocoapods/codegen_script_phase_extractor.rb +13 -0
- package/scripts/cocoapods/codegen_utils.rb +389 -0
- package/scripts/cocoapods/fabric.rb +18 -0
- package/scripts/cocoapods/helpers.rb +150 -0
- package/scripts/cocoapods/jsengine.rb +33 -0
- package/scripts/cocoapods/local_podspec_patch.rb +51 -0
- package/scripts/cocoapods/new_architecture.rb +194 -0
- package/scripts/cocoapods/privacy_manifest_utils.rb +194 -0
- package/scripts/cocoapods/runtime.rb +18 -0
- package/scripts/cocoapods/spm.rb +94 -0
- package/scripts/cocoapods/utils.rb +729 -0
- package/scripts/codegen/codegen-utils.js +51 -0
- package/scripts/codegen/generate-artifacts-executor.js +982 -0
- package/scripts/codegen/generate-specs-cli-executor.js +128 -0
- package/scripts/codegen/templates/RCTAppDependencyProviderH.template +25 -0
- package/scripts/codegen/templates/RCTAppDependencyProviderMM.template +55 -0
- package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderH.template +18 -0
- package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderMM.template +33 -0
- package/scripts/codegen/templates/RCTThirdPartyComponentsProviderH.template +16 -0
- package/scripts/codegen/templates/RCTThirdPartyComponentsProviderMM.template +23 -0
- package/scripts/codegen/templates/ReactAppDependencyProvider.podspec.template +34 -0
- package/scripts/compose-source-maps.js +0 -0
- package/scripts/ios-configure-glog.sh +0 -0
- package/scripts/node-binary.sh +0 -0
- package/scripts/packager.sh +0 -0
- package/scripts/react-native-xcode.sh +0 -0
- package/scripts/react_native_pods_utils/script_phases.sh +0 -0
- package/scripts/xcode/ccache-clang++.sh +0 -0
- package/scripts/xcode/ccache-clang.sh +0 -0
- package/scripts/xcode/with-environment.sh +0 -0
- package/sdks/hermes-engine/hermes-engine.podspec +168 -0
- package/sdks/hermes-engine/hermes-utils.rb +341 -0
- package/sdks/hermes-engine/utils/build-apple-framework.sh +225 -0
- package/sdks/hermes-engine/utils/build-hermes-xcode.sh +100 -0
- package/sdks/hermes-engine/utils/build-hermesc-xcode.sh +18 -0
- package/sdks/hermes-engine/utils/build-ios-framework.sh +90 -0
- package/sdks/hermes-engine/utils/build-mac-framework.sh +22 -0
- package/sdks/hermes-engine/utils/copy-hermes-xcode.sh +7 -0
- package/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh +32 -0
- package/sdks/hermes-engine/utils/replace_hermes_version.js +106 -0
- package/scripts/featureflags/README.md +0 -156
- package/scripts/featureflags/index.js +0 -39
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
#import <React/RCTDataRequestHandler.h>
|
|
9
9
|
#import <ReactCommon/RCTTurboModule.h>
|
|
10
10
|
|
|
11
|
+
#import <mutex>
|
|
12
|
+
|
|
11
13
|
#import "RCTNetworkPlugins.h"
|
|
12
14
|
|
|
13
15
|
@interface RCTDataRequestHandler () <RCTTurboModule>
|
|
@@ -15,14 +17,22 @@
|
|
|
15
17
|
|
|
16
18
|
@implementation RCTDataRequestHandler {
|
|
17
19
|
NSOperationQueue *_queue;
|
|
20
|
+
std::mutex _operationHandlerMutexLock;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
RCT_EXPORT_MODULE()
|
|
21
24
|
|
|
22
25
|
- (void)invalidate
|
|
23
26
|
{
|
|
24
|
-
|
|
25
|
-
_queue
|
|
27
|
+
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
|
28
|
+
if (_queue) {
|
|
29
|
+
for (NSOperation *operation in _queue.operations) {
|
|
30
|
+
if (!operation.isCancelled && !operation.isFinished) {
|
|
31
|
+
[operation cancel];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
_queue = nil;
|
|
35
|
+
}
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
- (BOOL)canHandleRequest:(NSURLRequest *)request
|
|
@@ -32,6 +42,7 @@ RCT_EXPORT_MODULE()
|
|
|
32
42
|
|
|
33
43
|
- (NSOperation *)sendRequest:(NSURLRequest *)request withDelegate:(id<RCTURLRequestDelegate>)delegate
|
|
34
44
|
{
|
|
45
|
+
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
|
35
46
|
// Lazy setup
|
|
36
47
|
if (!_queue) {
|
|
37
48
|
_queue = [NSOperationQueue new];
|
|
@@ -73,7 +84,10 @@ RCT_EXPORT_MODULE()
|
|
|
73
84
|
|
|
74
85
|
- (void)cancelRequest:(NSOperation *)op
|
|
75
86
|
{
|
|
76
|
-
|
|
87
|
+
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
|
88
|
+
if (!op.isCancelled && !op.isFinished) {
|
|
89
|
+
[op cancel];
|
|
90
|
+
}
|
|
77
91
|
}
|
|
78
92
|
|
|
79
93
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
#import <React/RCTFileRequestHandler.h>
|
|
9
9
|
|
|
10
|
+
#import <mutex>
|
|
11
|
+
|
|
10
12
|
#if !TARGET_OS_OSX // [macOS]
|
|
11
13
|
#import <MobileCoreServices/MobileCoreServices.h>
|
|
12
14
|
#else // [macOS
|
|
@@ -23,14 +25,22 @@
|
|
|
23
25
|
|
|
24
26
|
@implementation RCTFileRequestHandler {
|
|
25
27
|
NSOperationQueue *_fileQueue;
|
|
28
|
+
std::mutex _operationHandlerMutexLock;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
RCT_EXPORT_MODULE()
|
|
29
32
|
|
|
30
33
|
- (void)invalidate
|
|
31
34
|
{
|
|
32
|
-
|
|
33
|
-
_fileQueue
|
|
35
|
+
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
|
36
|
+
if (_fileQueue) {
|
|
37
|
+
for (NSOperation *operation in _fileQueue.operations) {
|
|
38
|
+
if (!operation.isCancelled && !operation.isFinished) {
|
|
39
|
+
[operation cancel];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
_fileQueue = nil;
|
|
43
|
+
}
|
|
34
44
|
}
|
|
35
45
|
|
|
36
46
|
- (BOOL)canHandleRequest:(NSURLRequest *)request
|
|
@@ -40,6 +50,7 @@ RCT_EXPORT_MODULE()
|
|
|
40
50
|
|
|
41
51
|
- (NSOperation *)sendRequest:(NSURLRequest *)request withDelegate:(id<RCTURLRequestDelegate>)delegate
|
|
42
52
|
{
|
|
53
|
+
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
|
43
54
|
// Lazy setup
|
|
44
55
|
if (!_fileQueue) {
|
|
45
56
|
_fileQueue = [NSOperationQueue new];
|
|
@@ -91,7 +102,10 @@ RCT_EXPORT_MODULE()
|
|
|
91
102
|
|
|
92
103
|
- (void)cancelRequest:(NSOperation *)op
|
|
93
104
|
{
|
|
94
|
-
|
|
105
|
+
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
|
106
|
+
if (!op.isCancelled && !op.isFinished) {
|
|
107
|
+
[op cancel];
|
|
108
|
+
}
|
|
95
109
|
}
|
|
96
110
|
|
|
97
111
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -59,13 +59,11 @@
|
|
|
59
59
|
|
|
60
60
|
#if !TARGET_OS_OSX // [macOS]
|
|
61
61
|
UIButton *resumeButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
62
|
-
|
|
62
|
+
UIImage *image = [UIImage systemImageNamed:@"forward.frame.fill"];
|
|
63
|
+
[resumeButton setImage:image forState:UIControlStateNormal];
|
|
64
|
+
[resumeButton setImage:image forState:UIControlStateDisabled];
|
|
63
65
|
resumeButton.tintColor = [UIColor colorWithRed:0.37 green:0.37 blue:0.37 alpha:1];
|
|
64
66
|
|
|
65
|
-
resumeButton.configurationUpdateHandler = ^(UIButton *button) {
|
|
66
|
-
button.imageView.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
67
|
resumeButton.enabled = NO;
|
|
70
68
|
#else // [macOS
|
|
71
69
|
NSButton *resumeButton = [[NSButton alloc] init];
|
|
@@ -174,10 +174,24 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
|
|
|
174
174
|
|
|
175
175
|
- (void)mountChildComponentView:(RCTUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index // [macOS]
|
|
176
176
|
{
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
177
|
+
if (_adapter && index == _adapter.paperView.reactSubviews.count) {
|
|
178
|
+
// This is a new child view that is being added to the end of the children array.
|
|
179
|
+
// After the children is added, we need to call didUpdateReactSubviews to make sure that it is rendered.
|
|
180
|
+
// Without this change, the new child will not be rendered right away because the didUpdateReactSubviews is not
|
|
181
|
+
// called and the `finalizeUpdate` is not invoked.
|
|
182
|
+
if ([childComponentView isKindOfClass:[RCTLegacyViewManagerInteropComponentView class]]) {
|
|
183
|
+
RCTPlatformView *target = ((RCTLegacyViewManagerInteropComponentView *)childComponentView).contentView; // [macOS]
|
|
184
|
+
[_adapter.paperView insertReactSubview:target atIndex:index];
|
|
185
|
+
} else {
|
|
186
|
+
[_adapter.paperView insertReactSubview:childComponentView atIndex:index];
|
|
187
|
+
}
|
|
188
|
+
[_adapter.paperView didUpdateReactSubviews];
|
|
189
|
+
} else {
|
|
190
|
+
[_viewsToBeMounted addObject:@{
|
|
191
|
+
kRCTLegacyInteropChildIndexKey : [NSNumber numberWithInteger:index],
|
|
192
|
+
kRCTLegacyInteropChildComponentKey : childComponentView
|
|
193
|
+
}];
|
|
194
|
+
}
|
|
181
195
|
}
|
|
182
196
|
|
|
183
197
|
- (void)unmountChildComponentView:(RCTUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index // [macOS]
|
|
@@ -106,7 +106,6 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
|
|
|
106
106
|
BOOL _shouldAnimatePresentation;
|
|
107
107
|
BOOL _shouldPresent;
|
|
108
108
|
BOOL _isPresented;
|
|
109
|
-
RCTPlatformView *_modalContentsSnapshot; // [macOS]
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
#if !TARGET_OS_OSX // [macOS]
|
|
@@ -144,7 +143,6 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
|
|
|
144
143
|
animated:(BOOL)animated
|
|
145
144
|
completion:(void (^)(void))completion
|
|
146
145
|
{
|
|
147
|
-
_modalContentsSnapshot = [self.viewController.view snapshotViewAfterScreenUpdates:NO];
|
|
148
146
|
[modalViewController dismissViewControllerAnimated:animated completion:completion];
|
|
149
147
|
}
|
|
150
148
|
|
|
@@ -170,8 +168,7 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
|
|
|
170
168
|
_isPresented = NO;
|
|
171
169
|
// To animate dismissal of view controller, snapshot of
|
|
172
170
|
// view hierarchy needs to be added to the UIViewController.
|
|
173
|
-
RCTPlatformView *snapshot =
|
|
174
|
-
|
|
171
|
+
RCTPlatformView *snapshot = [self.viewController.view snapshotViewAfterScreenUpdates:NO]; // [macOS]
|
|
175
172
|
if (_shouldPresent) {
|
|
176
173
|
[self.viewController.view addSubview:snapshot];
|
|
177
174
|
}
|
|
@@ -580,6 +580,17 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
|
|
|
580
580
|
return metrics;
|
|
581
581
|
}
|
|
582
582
|
|
|
583
|
+
- (ScrollViewEventEmitter::EndDragMetrics)_scrollViewMetricsWithVelocity:(CGPoint)velocity
|
|
584
|
+
andTargetContentOffset:(CGPoint)targetContentOffset
|
|
585
|
+
{
|
|
586
|
+
ScrollViewEventEmitter::EndDragMetrics metrics = [self _scrollViewMetrics];
|
|
587
|
+
metrics.targetContentOffset.x = targetContentOffset.x;
|
|
588
|
+
metrics.targetContentOffset.y = targetContentOffset.y;
|
|
589
|
+
metrics.velocity.x = velocity.x;
|
|
590
|
+
metrics.velocity.y = velocity.y;
|
|
591
|
+
return metrics;
|
|
592
|
+
}
|
|
593
|
+
|
|
583
594
|
- (void)_updateStateWithContentOffset
|
|
584
595
|
{
|
|
585
596
|
if (!_state) {
|
|
@@ -638,6 +649,14 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
|
|
|
638
649
|
targetContentOffset->y = scrollView.contentOffset.y + travel * _endDraggingSensitivityMultiplier;
|
|
639
650
|
}
|
|
640
651
|
}
|
|
652
|
+
|
|
653
|
+
if (!_eventEmitter) {
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
auto metrics = [self _scrollViewMetricsWithVelocity:velocity andTargetContentOffset:*targetContentOffset];
|
|
658
|
+
|
|
659
|
+
static_cast<const ScrollViewEventEmitter &>(*_eventEmitter).onScrollEndDrag(metrics);
|
|
641
660
|
}
|
|
642
661
|
|
|
643
662
|
- (BOOL)touchesShouldCancelInContentView:(__unused RCTPlatformView *)view // [macOS]
|
|
@@ -709,8 +728,6 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
|
|
|
709
728
|
return;
|
|
710
729
|
}
|
|
711
730
|
|
|
712
|
-
static_cast<const ScrollViewEventEmitter &>(*_eventEmitter).onScrollEndDrag([self _scrollViewMetrics]);
|
|
713
|
-
|
|
714
731
|
[self _updateStateWithContentOffset];
|
|
715
732
|
|
|
716
733
|
if (!decelerate) {
|
|
@@ -815,7 +832,9 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
|
|
|
815
832
|
return;
|
|
816
833
|
}
|
|
817
834
|
|
|
818
|
-
|
|
835
|
+
auto metrics = [self _scrollViewMetricsWithVelocity:{} andTargetContentOffset:{}];
|
|
836
|
+
static_cast<const ScrollViewEventEmitter &>(*_eventEmitter).onScrollEndDrag(metrics);
|
|
837
|
+
|
|
819
838
|
[self _updateStateWithContentOffset];
|
|
820
839
|
}
|
|
821
840
|
|
|
@@ -65,7 +65,7 @@ using namespace facebook::react;
|
|
|
65
65
|
const auto &newSwitchProps = static_cast<const SwitchProps &>(*props);
|
|
66
66
|
|
|
67
67
|
// `value`
|
|
68
|
-
if (oldSwitchProps.value != newSwitchProps.value) {
|
|
68
|
+
if (!_isInitialValueSet || oldSwitchProps.value != newSwitchProps.value) {
|
|
69
69
|
BOOL shouldAnimate = _isInitialValueSet == YES;
|
|
70
70
|
[_switchView setOn:newSwitchProps.value animated:shouldAnimate];
|
|
71
71
|
}
|
|
@@ -145,6 +145,7 @@ using namespace facebook::react;
|
|
|
145
145
|
|
|
146
146
|
if (!_view) {
|
|
147
147
|
_view = [[RCTSurfaceView alloc] initWithSurface:(RCTSurface *)self];
|
|
148
|
+
[self _updateLayoutContext];
|
|
148
149
|
_touchHandler = [RCTSurfaceTouchHandler new];
|
|
149
150
|
[_touchHandler attachToView:_view];
|
|
150
151
|
}
|
|
@@ -1409,14 +1409,14 @@ public class ReactInstanceManager {
|
|
|
1409
1409
|
new RuntimeException(
|
|
1410
1410
|
"detachRootViewFromInstance called with ReactRootView with invalid id"));
|
|
1411
1411
|
}
|
|
1412
|
-
|
|
1413
|
-
clearReactRoot(reactRoot);
|
|
1414
1412
|
} else {
|
|
1415
1413
|
reactContext
|
|
1416
1414
|
.getCatalystInstance()
|
|
1417
1415
|
.getJSModule(AppRegistry.class)
|
|
1418
1416
|
.unmountApplicationComponentAtRootTag(reactRoot.getRootViewTag());
|
|
1419
1417
|
}
|
|
1418
|
+
|
|
1419
|
+
clearReactRoot(reactRoot);
|
|
1420
1420
|
}
|
|
1421
1421
|
|
|
1422
1422
|
@ThreadConfined(UI)
|
|
@@ -171,7 +171,7 @@ public class FabricUIManager
|
|
|
171
171
|
private final CopyOnWriteArrayList<UIManagerListener> mListeners = new CopyOnWriteArrayList<>();
|
|
172
172
|
|
|
173
173
|
private boolean mMountNotificationScheduled = false;
|
|
174
|
-
private
|
|
174
|
+
private List<Integer> mSurfaceIdsWithPendingMountNotification = new ArrayList<>();
|
|
175
175
|
|
|
176
176
|
@ThreadConfined(UI)
|
|
177
177
|
@NonNull
|
|
@@ -1261,12 +1261,15 @@ public class FabricUIManager
|
|
|
1261
1261
|
|
|
1262
1262
|
// Collect surface IDs for all the mount items
|
|
1263
1263
|
for (MountItem mountItem : mountItems) {
|
|
1264
|
-
if (mountItem != null
|
|
1265
|
-
|
|
1264
|
+
if (mountItem != null
|
|
1265
|
+
&& !mSurfaceIdsWithPendingMountNotification.contains(mountItem.getSurfaceId())) {
|
|
1266
|
+
mSurfaceIdsWithPendingMountNotification.add(mountItem.getSurfaceId());
|
|
1266
1267
|
}
|
|
1267
1268
|
}
|
|
1268
1269
|
|
|
1269
|
-
if (!mMountNotificationScheduled && !
|
|
1270
|
+
if (!mMountNotificationScheduled && !mSurfaceIdsWithPendingMountNotification.isEmpty()) {
|
|
1271
|
+
mMountNotificationScheduled = true;
|
|
1272
|
+
|
|
1270
1273
|
// Notify mount when the effects are visible and prevent mount hooks to
|
|
1271
1274
|
// delay paint.
|
|
1272
1275
|
UiThreadUtil.getUiThreadHandler()
|
|
@@ -1276,17 +1279,19 @@ public class FabricUIManager
|
|
|
1276
1279
|
public void run() {
|
|
1277
1280
|
mMountNotificationScheduled = false;
|
|
1278
1281
|
|
|
1282
|
+
// Create a copy in case mount hooks trigger more mutations
|
|
1283
|
+
final List<Integer> surfaceIdsToReportMount =
|
|
1284
|
+
mSurfaceIdsWithPendingMountNotification;
|
|
1285
|
+
mSurfaceIdsWithPendingMountNotification = new ArrayList<>();
|
|
1286
|
+
|
|
1279
1287
|
final @Nullable FabricUIManagerBinding binding = mBinding;
|
|
1280
1288
|
if (binding == null || mDestroyed) {
|
|
1281
|
-
mMountedSurfaceIds.clear();
|
|
1282
1289
|
return;
|
|
1283
1290
|
}
|
|
1284
1291
|
|
|
1285
|
-
for (int surfaceId :
|
|
1292
|
+
for (int surfaceId : surfaceIdsToReportMount) {
|
|
1286
1293
|
binding.reportMount(surfaceId);
|
|
1287
1294
|
}
|
|
1288
|
-
|
|
1289
|
-
mMountedSurfaceIds.clear();
|
|
1290
1295
|
}
|
|
1291
1296
|
});
|
|
1292
1297
|
}
|
|
@@ -13,8 +13,6 @@ import android.os.Build
|
|
|
13
13
|
import android.view.View
|
|
14
14
|
import android.view.WindowInsetsController
|
|
15
15
|
import android.view.WindowManager
|
|
16
|
-
import androidx.core.view.ViewCompat
|
|
17
|
-
import androidx.core.view.WindowInsetsCompat
|
|
18
16
|
import com.facebook.common.logging.FLog
|
|
19
17
|
import com.facebook.fbreact.specs.NativeStatusBarManagerAndroidSpec
|
|
20
18
|
import com.facebook.react.bridge.GuardedRunnable
|
|
@@ -23,6 +21,7 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
23
21
|
import com.facebook.react.bridge.UiThreadUtil
|
|
24
22
|
import com.facebook.react.common.ReactConstants
|
|
25
23
|
import com.facebook.react.module.annotations.ReactModule
|
|
24
|
+
import com.facebook.react.uimanager.DisplayMetricsHolder.getStatusBarHeightPx
|
|
26
25
|
import com.facebook.react.uimanager.PixelUtil
|
|
27
26
|
import com.facebook.react.views.view.setStatusBarTranslucency
|
|
28
27
|
import com.facebook.react.views.view.setStatusBarVisibility
|
|
@@ -34,29 +33,17 @@ public class StatusBarModule(reactContext: ReactApplicationContext?) :
|
|
|
34
33
|
|
|
35
34
|
@Suppress("DEPRECATION")
|
|
36
35
|
override fun getTypedExportedConstants(): Map<String, Any> {
|
|
36
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
37
37
|
val statusBarColor =
|
|
38
38
|
currentActivity?.window?.statusBarColor?.let { color ->
|
|
39
39
|
String.format("#%06X", 0xFFFFFF and color)
|
|
40
40
|
} ?: "black"
|
|
41
41
|
return mapOf(
|
|
42
|
-
HEIGHT_KEY to PixelUtil.toDIPFromPixel(getStatusBarHeightPx()),
|
|
42
|
+
HEIGHT_KEY to PixelUtil.toDIPFromPixel(getStatusBarHeightPx(currentActivity).toFloat()),
|
|
43
43
|
DEFAULT_BACKGROUND_COLOR_KEY to statusBarColor,
|
|
44
44
|
)
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
@Suppress("DEPRECATION")
|
|
48
|
-
private fun getStatusBarHeightPx(): Float {
|
|
49
|
-
val windowInsets =
|
|
50
|
-
currentActivity?.window?.decorView?.let(ViewCompat::getRootWindowInsets) ?: return 0f
|
|
51
|
-
return windowInsets
|
|
52
|
-
.getInsets(
|
|
53
|
-
WindowInsetsCompat.Type.statusBars() or
|
|
54
|
-
WindowInsetsCompat.Type.navigationBars() or
|
|
55
|
-
WindowInsetsCompat.Type.displayCutout())
|
|
56
|
-
.top
|
|
57
|
-
.toFloat()
|
|
58
|
-
}
|
|
59
|
-
|
|
60
47
|
@Suppress("DEPRECATION")
|
|
61
48
|
override fun setColor(colorDouble: Double, animated: Boolean) {
|
|
62
49
|
val color = colorDouble.toInt()
|
|
@@ -7,9 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
package com.facebook.react.uimanager
|
|
9
9
|
|
|
10
|
+
import android.app.Activity
|
|
10
11
|
import android.content.Context
|
|
11
12
|
import android.util.DisplayMetrics
|
|
12
13
|
import android.view.WindowManager
|
|
14
|
+
import androidx.core.view.ViewCompat
|
|
15
|
+
import androidx.core.view.WindowInsetsCompat
|
|
13
16
|
import com.facebook.react.bridge.WritableMap
|
|
14
17
|
import com.facebook.react.bridge.WritableNativeMap
|
|
15
18
|
|
|
@@ -99,4 +102,14 @@ public object DisplayMetricsHolder {
|
|
|
99
102
|
putDouble("fontScale", fontScale)
|
|
100
103
|
putDouble("densityDpi", displayMetrics.densityDpi.toDouble())
|
|
101
104
|
}
|
|
105
|
+
|
|
106
|
+
internal fun getStatusBarHeightPx(activity: Activity?): Int {
|
|
107
|
+
val windowInsets = activity?.window?.decorView?.let(ViewCompat::getRootWindowInsets) ?: return 0
|
|
108
|
+
return windowInsets
|
|
109
|
+
.getInsets(
|
|
110
|
+
WindowInsetsCompat.Type.statusBars() or
|
|
111
|
+
WindowInsetsCompat.Type.navigationBars() or
|
|
112
|
+
WindowInsetsCompat.Type.displayCutout())
|
|
113
|
+
.top
|
|
114
|
+
}
|
|
102
115
|
}
|
|
@@ -136,10 +136,10 @@ public data class BorderRadiusStyle(
|
|
|
136
136
|
(startStart ?: topStart ?: topLeft ?: uniform)?.resolve(width, height)
|
|
137
137
|
?: zeroRadii,
|
|
138
138
|
bottomLeft =
|
|
139
|
-
(endEnd ?:
|
|
139
|
+
(endEnd ?: bottomEnd ?: bottomRight ?: uniform)?.resolve(width, height)
|
|
140
140
|
?: zeroRadii,
|
|
141
141
|
bottomRight =
|
|
142
|
-
(startEnd ?:
|
|
142
|
+
(startEnd ?: bottomStart ?: bottomLeft ?: uniform)?.resolve(width, height)
|
|
143
143
|
?: zeroRadii,
|
|
144
144
|
width = width,
|
|
145
145
|
height = height,
|
|
@@ -37,6 +37,8 @@ import com.facebook.react.bridge.WritableNativeMap
|
|
|
37
37
|
import com.facebook.react.common.ReactConstants
|
|
38
38
|
import com.facebook.react.common.annotations.VisibleForTesting
|
|
39
39
|
import com.facebook.react.config.ReactFeatureFlags
|
|
40
|
+
import com.facebook.react.uimanager.DisplayMetricsHolder
|
|
41
|
+
import com.facebook.react.uimanager.DisplayMetricsHolder.getStatusBarHeightPx
|
|
40
42
|
import com.facebook.react.uimanager.JSPointerDispatcher
|
|
41
43
|
import com.facebook.react.uimanager.JSTouchDispatcher
|
|
42
44
|
import com.facebook.react.uimanager.PixelUtil.pxToDp
|
|
@@ -49,6 +51,7 @@ import com.facebook.react.views.common.ContextUtils
|
|
|
49
51
|
import com.facebook.react.views.view.ReactViewGroup
|
|
50
52
|
import com.facebook.react.views.view.setStatusBarTranslucency
|
|
51
53
|
import com.facebook.react.views.view.setSystemBarsTranslucency
|
|
54
|
+
import com.facebook.yoga.annotations.DoNotStrip
|
|
52
55
|
import java.util.Objects
|
|
53
56
|
|
|
54
57
|
/**
|
|
@@ -119,6 +122,7 @@ public class ReactModalHostView(context: ThemedReactContext) :
|
|
|
119
122
|
private var createNewDialog = false
|
|
120
123
|
|
|
121
124
|
init {
|
|
125
|
+
initStatusBarHeight(context)
|
|
122
126
|
dialogRootViewGroup = DialogRootViewGroup(context)
|
|
123
127
|
}
|
|
124
128
|
|
|
@@ -220,6 +224,15 @@ public class ReactModalHostView(context: ThemedReactContext) :
|
|
|
220
224
|
|
|
221
225
|
private fun getCurrentActivity(): Activity? = (context as ThemedReactContext).currentActivity
|
|
222
226
|
|
|
227
|
+
private fun isFlagSecureSet(activity: Activity?): Boolean {
|
|
228
|
+
if (activity == null) {
|
|
229
|
+
return false
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
val flags = activity.window.attributes.flags
|
|
233
|
+
return (flags and WindowManager.LayoutParams.FLAG_SECURE) != 0
|
|
234
|
+
}
|
|
235
|
+
|
|
223
236
|
/**
|
|
224
237
|
* showOrUpdate will display the Dialog. It is called by the manager once all properties are set
|
|
225
238
|
* because we need to know all of them before creating the Dialog. It is also smart during updates
|
|
@@ -293,6 +306,11 @@ public class ReactModalHostView(context: ThemedReactContext) :
|
|
|
293
306
|
if (hardwareAccelerated) {
|
|
294
307
|
newDialog.window?.addFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED)
|
|
295
308
|
}
|
|
309
|
+
val flagSecureSet = isFlagSecureSet(currentActivity)
|
|
310
|
+
if (flagSecureSet) {
|
|
311
|
+
newDialog.window?.setFlags(
|
|
312
|
+
WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
|
|
313
|
+
}
|
|
296
314
|
if (currentActivity?.isFinishing == false) {
|
|
297
315
|
newDialog.show()
|
|
298
316
|
updateSystemAppearance()
|
|
@@ -395,6 +413,26 @@ public class ReactModalHostView(context: ThemedReactContext) :
|
|
|
395
413
|
|
|
396
414
|
private companion object {
|
|
397
415
|
private const val TAG = "ReactModalHost"
|
|
416
|
+
|
|
417
|
+
// We store the status bar height to be able to properly position
|
|
418
|
+
// the modal on the first render.
|
|
419
|
+
private var statusBarHeight = 0
|
|
420
|
+
|
|
421
|
+
private fun initStatusBarHeight(reactContext: ReactContext) {
|
|
422
|
+
statusBarHeight = getStatusBarHeightPx(reactContext.currentActivity)
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
@JvmStatic
|
|
426
|
+
@DoNotStrip
|
|
427
|
+
private fun getScreenDisplayMetricsWithoutInsets(): Long {
|
|
428
|
+
val displayMetrics = DisplayMetricsHolder.getScreenDisplayMetrics()
|
|
429
|
+
return encodeFloatsToLong(
|
|
430
|
+
displayMetrics.widthPixels.toFloat().pxToDp(),
|
|
431
|
+
(displayMetrics.heightPixels - statusBarHeight).toFloat().pxToDp())
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
private fun encodeFloatsToLong(width: Float, height: Float): Long =
|
|
435
|
+
(width.toRawBits().toLong()) shl 32 or (height.toRawBits().toLong())
|
|
398
436
|
}
|
|
399
437
|
|
|
400
438
|
/**
|
|
@@ -410,6 +448,7 @@ public class ReactModalHostView(context: ThemedReactContext) :
|
|
|
410
448
|
*/
|
|
411
449
|
public class DialogRootViewGroup internal constructor(context: Context) :
|
|
412
450
|
ReactViewGroup(context), RootView {
|
|
451
|
+
|
|
413
452
|
internal var stateWrapper: StateWrapper? = null
|
|
414
453
|
internal var eventDispatcher: EventDispatcher? = null
|
|
415
454
|
|
|
@@ -112,7 +112,7 @@ Pod::Spec.new do |s|
|
|
|
112
112
|
ss.subspec "modal" do |sss|
|
|
113
113
|
sss.dependency folly_dep_name, folly_version
|
|
114
114
|
sss.compiler_flags = folly_compiler_flags
|
|
115
|
-
sss.source_files = "react/renderer/components/modal
|
|
115
|
+
sss.source_files = "react/renderer/components/modal/*.{m,mm,cpp,h}"
|
|
116
116
|
sss.exclude_files = "react/renderer/components/modal/tests"
|
|
117
117
|
sss.header_dir = "react/renderer/components/modal"
|
|
118
118
|
end
|
|
@@ -14,7 +14,10 @@ add_compile_options(
|
|
|
14
14
|
-Wpedantic
|
|
15
15
|
-DLOG_TAG=\"Fabric\")
|
|
16
16
|
|
|
17
|
-
file(GLOB rrc_modal_SRC CONFIGURE_DEPENDS
|
|
17
|
+
file(GLOB rrc_modal_SRC CONFIGURE_DEPENDS
|
|
18
|
+
*.cpp
|
|
19
|
+
platform/android/*.cpp)
|
|
20
|
+
|
|
18
21
|
add_library(rrc_modal STATIC ${rrc_modal_SRC})
|
|
19
22
|
|
|
20
23
|
target_include_directories(rrc_modal PUBLIC ${REACT_COMMON_DIR})
|
|
@@ -30,8 +30,9 @@ class ModalHostViewComponentDescriptor final
|
|
|
30
30
|
*shadowNode.getState())
|
|
31
31
|
.getData();
|
|
32
32
|
|
|
33
|
-
layoutableShadowNode.setSize(
|
|
34
|
-
|
|
33
|
+
layoutableShadowNode.setSize(Size{
|
|
34
|
+
.width = stateData.screenSize.width,
|
|
35
|
+
.height = stateData.screenSize.height});
|
|
35
36
|
layoutableShadowNode.setPositionType(YGPositionTypeAbsolute);
|
|
36
37
|
|
|
37
38
|
ConcreteComponentDescriptor::adopt(shadowNode);
|
|
@@ -9,15 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
#include <react/renderer/core/graphicsConversions.h>
|
|
11
11
|
#include <react/renderer/graphics/Float.h>
|
|
12
|
+
#include "ModalHostViewUtils.h"
|
|
12
13
|
|
|
13
14
|
#ifdef ANDROID
|
|
14
15
|
#include <folly/dynamic.h>
|
|
15
16
|
#endif
|
|
16
17
|
|
|
17
|
-
#if defined(__APPLE__) && TARGET_OS_IOS
|
|
18
|
-
#include "ModalHostViewUtils.h"
|
|
19
|
-
#endif
|
|
20
|
-
|
|
21
18
|
namespace facebook::react {
|
|
22
19
|
|
|
23
20
|
/*
|
|
@@ -27,12 +24,7 @@ class ModalHostViewState final {
|
|
|
27
24
|
public:
|
|
28
25
|
using Shared = std::shared_ptr<const ModalHostViewState>;
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
ModalHostViewState() : screenSize(RCTModalHostViewScreenSize()) {
|
|
32
|
-
#else
|
|
33
|
-
ModalHostViewState(){
|
|
34
|
-
#endif
|
|
35
|
-
};
|
|
27
|
+
ModalHostViewState() : screenSize(ModalHostViewScreenSize()) {}
|
|
36
28
|
ModalHostViewState(Size screenSize_) : screenSize(screenSize_){};
|
|
37
29
|
|
|
38
30
|
#ifdef ANDROID
|
|
@@ -40,8 +32,8 @@ class ModalHostViewState final {
|
|
|
40
32
|
const ModalHostViewState& previousState,
|
|
41
33
|
folly::dynamic data)
|
|
42
34
|
: screenSize(Size{
|
|
43
|
-
(Float)data["screenWidth"].getDouble(),
|
|
44
|
-
(Float)data["screenHeight"].getDouble()}){};
|
|
35
|
+
.width = (Float)data["screenWidth"].getDouble(),
|
|
36
|
+
.height = (Float)data["screenHeight"].getDouble()}){};
|
|
45
37
|
#endif
|
|
46
38
|
|
|
47
39
|
const Size screenSize{};
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
|
-
#include <react/renderer/
|
|
10
|
+
#include <react/renderer/graphics/Size.h>
|
|
11
11
|
|
|
12
12
|
namespace facebook::react {
|
|
13
13
|
|
|
14
|
-
Size
|
|
14
|
+
Size ModalHostViewScreenSize(void);
|
|
15
15
|
|
|
16
16
|
} // namespace facebook::react
|