react-native-macos 0.0.0-96be39d8c → 0.0.0-96f71c939
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/Components/ScrollView/ScrollView.js +11 -45
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/TextInput.js +79 -1
- package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
- package/Libraries/Components/View/ViewPropTypes.js +10 -6
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Image/RCTImageView.mm +14 -10
- package/Libraries/Lists/FlatList.js +25 -2
- package/Libraries/Lists/VirtualizedList.js +118 -113
- package/Libraries/Lists/VirtualizedSectionList.js +9 -5
- package/Libraries/Text/BaseText/RCTBaseTextViewManager.m +1 -0
- package/Libraries/Text/RCTTextAttributes.h +2 -0
- package/Libraries/Text/RCTTextAttributes.m +9 -0
- package/Libraries/Text/Text/RCTDynamicTypeRamp.h +40 -0
- package/Libraries/Text/Text/RCTDynamicTypeRamp.m +77 -0
- package/Libraries/Text/Text/RCTTextView.m +123 -54
- package/Libraries/Text/Text.js +0 -8
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.h +8 -0
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m +57 -4
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m +13 -0
- package/Libraries/Text/TextInput/Multiline/RCTUITextView.h +2 -1
- package/Libraries/Text/TextInput/Multiline/RCTUITextView.m +69 -2
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h +7 -1
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +12 -3
- package/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +1 -0
- package/Libraries/Text/TextInput/RCTBaseTextInputView.h +4 -1
- package/Libraries/Text/TextInput/RCTBaseTextInputView.m +97 -2
- package/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m +6 -1
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.m +40 -0
- package/Libraries/Text/TextNativeComponent.js +2 -0
- package/Libraries/Text/TextProps.js +29 -0
- package/Libraries/Types/CoreEventTypes.js +0 -1
- package/React/Base/RCTAssert.h +30 -15
- package/React/Base/RCTAssert.m +59 -19
- package/React/Base/RCTBridge.m +5 -3
- package/React/Base/RCTConstants.h +6 -0
- package/React/Base/RCTConstants.m +15 -0
- package/React/Base/RCTConvert.m +7 -4
- package/React/Base/RCTEventDispatcherProtocol.h +5 -0
- package/React/Base/RCTTouchHandler.m +4 -0
- package/React/Base/RCTUIKit.h +8 -13
- package/React/Base/RCTUtils.m +6 -3
- package/React/Base/RCTVersion.m +1 -1
- package/React/Base/macOS/RCTUIKit.m +33 -0
- package/React/CoreModules/RCTEventDispatcher.mm +6 -1
- package/React/CoreModules/RCTPerfMonitor.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.h +1 -0
- package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +69 -19
- package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +2 -1
- package/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm +0 -1
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +35 -9
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +9 -1
- package/React/Fabric/Mounting/RCTComponentViewFactory.mm +12 -3
- package/React/Fabric/Mounting/RCTMountingManager.h +1 -1
- package/React/Fabric/Mounting/RCTMountingManager.mm +11 -9
- package/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.h +5 -3
- package/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.mm +10 -8
- package/React/Fabric/Mounting/RCTMountingTransactionObserving.h +5 -3
- package/React/Fabric/RCTConversions.h +9 -1
- package/React/Fabric/RCTLocalizationProvider.mm +10 -4
- package/React/Fabric/RCTScheduler.h +7 -0
- package/React/Fabric/RCTScheduler.mm +15 -0
- package/React/Fabric/RCTSurfacePresenter.h +2 -0
- package/React/Fabric/RCTSurfacePresenter.mm +45 -21
- package/React/Fabric/RCTSurfaceTouchHandler.mm +0 -1
- package/React/Modules/RCTUIManager.m +4 -2
- package/React/React-RCTFabric.podspec +1 -1
- package/React/Views/RCTActivityIndicatorView.m +2 -1
- package/React/Views/RCTView.h +1 -0
- package/React/Views/RCTView.m +51 -17
- package/React/Views/RCTViewKeyboardEvent.m +9 -1
- package/React/Views/RCTViewManager.m +5 -14
- package/React/Views/ScrollView/RCTScrollContentView.h +4 -0
- package/React/Views/ScrollView/RCTScrollContentView.m +6 -0
- package/React/Views/ScrollView/RCTScrollContentViewManager.m +2 -0
- package/React/Views/ScrollView/RCTScrollView.h +2 -1
- package/React/Views/ScrollView/RCTScrollView.m +65 -63
- package/React/Views/ScrollView/RCTScrollViewManager.m +1 -1
- package/React/Views/UIView+React.h +2 -0
- package/React/Views/UIView+React.m +22 -13
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactCommon/React-Fabric.podspec +1 -1
- package/ReactCommon/React-rncore.podspec +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/react/debug/react_native_assert.h +1 -1
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm +5 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm +4 -2
- package/ReactCommon/react/renderer/core/EventDispatcher.cpp +21 -0
- package/ReactCommon/react/renderer/core/EventDispatcher.h +15 -0
- package/ReactCommon/react/renderer/core/EventListener.cpp +39 -0
- package/ReactCommon/react/renderer/core/EventListener.h +44 -0
- package/ReactCommon/react/renderer/graphics/React-graphics.podspec +1 -1
- package/ReactCommon/react/renderer/mounting/StubViewTree.cpp +1 -1
- package/ReactCommon/react/renderer/mounting/TelemetryController.cpp +6 -9
- package/ReactCommon/react/renderer/mounting/TelemetryController.h +7 -7
- package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp +3 -2
- package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.h +7 -1
- package/ReactCommon/react/renderer/scheduler/Scheduler.cpp +18 -0
- package/ReactCommon/react/renderer/scheduler/Scheduler.h +9 -0
- package/ReactCommon/react/utils/ManagedObjectWrapper.h +1 -1
- package/ReactCommon/react/utils/ManagedObjectWrapper.mm +1 -3
- package/package.json +1 -1
- package/scripts/generate-artifacts.js +21 -17
- package/scripts/react_native_pods.rb +0 -3
- package/template/Gemfile.lock +4 -4
- package/template/package.json +1 -1
- package/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.cpp +0 -12
- package/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.h +0 -32
- package/third-party-podspecs/boost-for-react-native.podspec +0 -20
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
#import <react/renderer/componentregistry/ComponentDescriptorFactory.h>
|
|
12
12
|
#import <react/renderer/core/ComponentDescriptor.h>
|
|
13
|
+
#import <react/renderer/core/EventListener.h>
|
|
13
14
|
#import <react/renderer/core/LayoutConstraints.h>
|
|
14
15
|
#import <react/renderer/core/LayoutContext.h>
|
|
15
16
|
#import <react/renderer/mounting/MountingCoordinator.h>
|
|
16
17
|
#import <react/renderer/scheduler/SchedulerToolbox.h>
|
|
17
18
|
#import <react/renderer/scheduler/SurfaceHandler.h>
|
|
19
|
+
#import <react/renderer/uimanager/UIManager.h>
|
|
18
20
|
#import <react/utils/ContextContainer.h>
|
|
19
21
|
|
|
20
22
|
NS_ASSUME_NONNULL_BEGIN
|
|
@@ -47,6 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
47
49
|
@interface RCTScheduler : NSObject
|
|
48
50
|
|
|
49
51
|
@property (atomic, weak, nullable) id<RCTSchedulerDelegate> delegate;
|
|
52
|
+
@property (readonly) std::shared_ptr<facebook::react::UIManager> const uiManager;
|
|
50
53
|
|
|
51
54
|
- (instancetype)initWithToolbox:(facebook::react::SchedulerToolbox)toolbox;
|
|
52
55
|
|
|
@@ -64,6 +67,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
64
67
|
|
|
65
68
|
- (void)animationTick;
|
|
66
69
|
|
|
70
|
+
- (void)addEventListener:(std::shared_ptr<facebook::react::EventListener> const &)listener;
|
|
71
|
+
|
|
72
|
+
- (void)removeEventListener:(std::shared_ptr<facebook::react::EventListener> const &)listener;
|
|
73
|
+
|
|
67
74
|
@end
|
|
68
75
|
|
|
69
76
|
NS_ASSUME_NONNULL_END
|
|
@@ -193,4 +193,19 @@ class LayoutAnimationDelegateProxy : public LayoutAnimationStatusDelegate, publi
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
+
- (void)addEventListener:(std::shared_ptr<EventListener> const &)listener
|
|
197
|
+
{
|
|
198
|
+
return _scheduler->addEventListener(listener);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
- (void)removeEventListener:(std::shared_ptr<EventListener> const &)listener
|
|
202
|
+
{
|
|
203
|
+
return _scheduler->removeEventListener(listener);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
- (std::shared_ptr<facebook::react::UIManager> const)uiManager
|
|
207
|
+
{
|
|
208
|
+
return _scheduler->getUIManager();
|
|
209
|
+
}
|
|
210
|
+
|
|
196
211
|
@end
|
|
@@ -19,6 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
19
19
|
@class RCTFabricSurface;
|
|
20
20
|
@class RCTImageLoader;
|
|
21
21
|
@class RCTMountingManager;
|
|
22
|
+
@class RCTScheduler;
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Coordinates presenting of React Native Surfaces and represents application
|
|
@@ -53,6 +54,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
53
54
|
- (void)unregisterSurface:(RCTFabricSurface *)surface;
|
|
54
55
|
|
|
55
56
|
@property (readonly) RCTMountingManager *mountingManager;
|
|
57
|
+
@property (readonly, nullable) RCTScheduler *scheduler;
|
|
56
58
|
|
|
57
59
|
- (nullable RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag;
|
|
58
60
|
|
|
@@ -80,9 +80,7 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|
|
80
80
|
RuntimeExecutor _runtimeExecutor; // Protected by `_schedulerLifeCycleMutex`.
|
|
81
81
|
|
|
82
82
|
butter::shared_mutex _observerListMutex;
|
|
83
|
-
|
|
84
|
-
RCTImageLoader *_imageLoader;
|
|
85
|
-
RuntimeExecutor _runtimeExecutor;
|
|
83
|
+
std::vector<__weak id<RCTSurfacePresenterObserver>> _observers; // Protected by `_observerListMutex`.
|
|
86
84
|
}
|
|
87
85
|
|
|
88
86
|
- (instancetype)initWithContextContainer:(ContextContainer::Shared)contextContainer
|
|
@@ -98,8 +96,6 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|
|
98
96
|
_mountingManager.contextContainer = contextContainer;
|
|
99
97
|
_mountingManager.delegate = self;
|
|
100
98
|
|
|
101
|
-
_observers = [NSMutableArray array];
|
|
102
|
-
|
|
103
99
|
_scheduler = [self _createScheduler];
|
|
104
100
|
}
|
|
105
101
|
|
|
@@ -111,7 +107,7 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|
|
111
107
|
return _mountingManager;
|
|
112
108
|
}
|
|
113
109
|
|
|
114
|
-
- (RCTScheduler *_Nullable)
|
|
110
|
+
- (RCTScheduler *_Nullable)scheduler
|
|
115
111
|
{
|
|
116
112
|
std::lock_guard<std::mutex> lock(_schedulerAccessMutex);
|
|
117
113
|
return _scheduler;
|
|
@@ -147,7 +143,7 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|
|
147
143
|
- (void)registerSurface:(RCTFabricSurface *)surface
|
|
148
144
|
{
|
|
149
145
|
[_surfaceRegistry registerSurface:surface];
|
|
150
|
-
RCTScheduler *scheduler = [self
|
|
146
|
+
RCTScheduler *scheduler = [self scheduler];
|
|
151
147
|
if (scheduler) {
|
|
152
148
|
[scheduler registerSurface:surface.surfaceHandler];
|
|
153
149
|
}
|
|
@@ -155,7 +151,7 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|
|
155
151
|
|
|
156
152
|
- (void)unregisterSurface:(RCTFabricSurface *)surface
|
|
157
153
|
{
|
|
158
|
-
RCTScheduler *scheduler = [self
|
|
154
|
+
RCTScheduler *scheduler = [self scheduler];
|
|
159
155
|
if (scheduler) {
|
|
160
156
|
[scheduler unregisterSurface:surface.surfaceHandler];
|
|
161
157
|
}
|
|
@@ -176,7 +172,7 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|
|
176
172
|
|
|
177
173
|
- (BOOL)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag props:(NSDictionary *)props
|
|
178
174
|
{
|
|
179
|
-
RCTScheduler *scheduler = [self
|
|
175
|
+
RCTScheduler *scheduler = [self scheduler];
|
|
180
176
|
if (!scheduler) {
|
|
181
177
|
return NO;
|
|
182
178
|
}
|
|
@@ -200,7 +196,7 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|
|
200
196
|
|
|
201
197
|
- (void)setupAnimationDriverWithSurfaceHandler:(facebook::react::SurfaceHandler const &)surfaceHandler
|
|
202
198
|
{
|
|
203
|
-
[[self
|
|
199
|
+
[[self scheduler] setupAnimationDriver:surfaceHandler];
|
|
204
200
|
}
|
|
205
201
|
|
|
206
202
|
- (BOOL)suspend
|
|
@@ -257,6 +253,10 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|
|
257
253
|
RCTExperimentSetPreemptiveViewAllocationDisabled(YES);
|
|
258
254
|
}
|
|
259
255
|
|
|
256
|
+
if (reactNativeConfig && reactNativeConfig->getBool("rn_convergence:dispatch_pointer_events")) {
|
|
257
|
+
RCTSetDispatchW3CPointerEvents(YES);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
260
|
auto componentRegistryFactory =
|
|
261
261
|
[factory = wrapManagedObject(_mountingManager.componentViewRegistry.componentViewFactory)](
|
|
262
262
|
EventDispatcher::Weak const &eventDispatcher, ContextContainer::Shared const &contextContainer) {
|
|
@@ -342,7 +342,7 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|
|
342
342
|
NSString *commandStr = [[NSString alloc] initWithUTF8String:commandName.c_str()];
|
|
343
343
|
NSArray *argsArray = convertFollyDynamicToId(args);
|
|
344
344
|
|
|
345
|
-
[
|
|
345
|
+
[_mountingManager dispatchCommand:tag commandName:commandStr args:argsArray];
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
- (void)schedulerDidSendAccessibilityEvent:(const facebook::react::ShadowView &)shadowView
|
|
@@ -351,28 +351,30 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|
|
351
351
|
ReactTag tag = shadowView.tag;
|
|
352
352
|
NSString *eventTypeStr = [[NSString alloc] initWithUTF8String:eventType.c_str()];
|
|
353
353
|
|
|
354
|
-
[
|
|
354
|
+
[_mountingManager sendAccessibilityEvent:tag eventType:eventTypeStr];
|
|
355
355
|
}
|
|
356
356
|
|
|
357
357
|
- (void)schedulerDidSetIsJSResponder:(BOOL)isJSResponder
|
|
358
358
|
blockNativeResponder:(BOOL)blockNativeResponder
|
|
359
359
|
forShadowView:(facebook::react::ShadowView const &)shadowView;
|
|
360
360
|
{
|
|
361
|
-
[
|
|
362
|
-
blockNativeResponder:blockNativeResponder
|
|
363
|
-
forShadowView:shadowView];
|
|
361
|
+
[_mountingManager setIsJSResponder:isJSResponder blockNativeResponder:blockNativeResponder forShadowView:shadowView];
|
|
364
362
|
}
|
|
365
363
|
|
|
366
364
|
- (void)addObserver:(id<RCTSurfacePresenterObserver>)observer
|
|
367
365
|
{
|
|
368
366
|
std::unique_lock<butter::shared_mutex> lock(_observerListMutex);
|
|
369
|
-
|
|
367
|
+
_observers.push_back(observer);
|
|
370
368
|
}
|
|
371
369
|
|
|
372
370
|
- (void)removeObserver:(id<RCTSurfacePresenterObserver>)observer
|
|
373
371
|
{
|
|
374
372
|
std::unique_lock<butter::shared_mutex> lock(_observerListMutex);
|
|
375
|
-
|
|
373
|
+
std::vector<__weak id<RCTSurfacePresenterObserver>>::const_iterator it =
|
|
374
|
+
std::find(_observers.begin(), _observers.end(), observer);
|
|
375
|
+
if (it != _observers.end()) {
|
|
376
|
+
_observers.erase(it);
|
|
377
|
+
}
|
|
376
378
|
}
|
|
377
379
|
|
|
378
380
|
#pragma mark - RCTMountingManagerDelegate
|
|
@@ -381,8 +383,13 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|
|
381
383
|
{
|
|
382
384
|
RCTAssertMainQueue();
|
|
383
385
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
+
NSArray<id<RCTSurfacePresenterObserver>> *observersCopy;
|
|
387
|
+
{
|
|
388
|
+
std::shared_lock<butter::shared_mutex> lock(_observerListMutex);
|
|
389
|
+
observersCopy = [self _getObservers];
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
for (id<RCTSurfacePresenterObserver> observer in observersCopy) {
|
|
386
393
|
if ([observer respondsToSelector:@selector(willMountComponentsWithRootTag:)]) {
|
|
387
394
|
[observer willMountComponentsWithRootTag:rootTag];
|
|
388
395
|
}
|
|
@@ -393,12 +400,29 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|
|
393
400
|
{
|
|
394
401
|
RCTAssertMainQueue();
|
|
395
402
|
|
|
396
|
-
|
|
397
|
-
|
|
403
|
+
NSArray<id<RCTSurfacePresenterObserver>> *observersCopy;
|
|
404
|
+
{
|
|
405
|
+
std::shared_lock<butter::shared_mutex> lock(_observerListMutex);
|
|
406
|
+
observersCopy = [self _getObservers];
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
for (id<RCTSurfacePresenterObserver> observer in observersCopy) {
|
|
398
410
|
if ([observer respondsToSelector:@selector(didMountComponentsWithRootTag:)]) {
|
|
399
411
|
[observer didMountComponentsWithRootTag:rootTag];
|
|
400
412
|
}
|
|
401
413
|
}
|
|
402
414
|
}
|
|
403
415
|
|
|
416
|
+
- (NSArray<id<RCTSurfacePresenterObserver>> *)_getObservers
|
|
417
|
+
{
|
|
418
|
+
NSMutableArray<id<RCTSurfacePresenterObserver>> *observersCopy = [NSMutableArray new];
|
|
419
|
+
for (id<RCTSurfacePresenterObserver> observer : _observers) {
|
|
420
|
+
if (observer) {
|
|
421
|
+
[observersCopy addObject:observer];
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
return observersCopy;
|
|
426
|
+
}
|
|
427
|
+
|
|
404
428
|
@end
|
|
@@ -156,7 +156,8 @@ RCT_EXPORT_MODULE()
|
|
|
156
156
|
|
|
157
157
|
- (void)setBridge:(RCTBridge *)bridge
|
|
158
158
|
{
|
|
159
|
-
|
|
159
|
+
RCTEnforceNewArchitectureValidation(
|
|
160
|
+
RCTNotAllowedInBridgeless, self, @"RCTUIManager must not be initialized for the new architecture");
|
|
160
161
|
|
|
161
162
|
RCTAssert(_bridge == nil, @"Should not re-use same UIManager instance");
|
|
162
163
|
_bridge = bridge;
|
|
@@ -332,12 +333,13 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation)
|
|
|
332
333
|
_viewRegistry[reactTag] = rootView;
|
|
333
334
|
|
|
334
335
|
// Register shadow view
|
|
336
|
+
RCTRootShadowView *shadowView = [RCTRootShadowView new]; // TODO(macOS GH#774) - do this early to prevent RCTI18nUtil deadlock
|
|
337
|
+
|
|
335
338
|
RCTExecuteOnUIManagerQueue(^{
|
|
336
339
|
if (!self->_viewRegistry) {
|
|
337
340
|
return;
|
|
338
341
|
}
|
|
339
342
|
|
|
340
|
-
RCTRootShadowView *shadowView = [RCTRootShadowView new];
|
|
341
343
|
shadowView.availableSize = availableSize;
|
|
342
344
|
shadowView.reactTag = reactTag;
|
|
343
345
|
shadowView.viewName = NSStringFromClass([rootView class]);
|
|
@@ -28,7 +28,7 @@ Pod::Spec.new do |s|
|
|
|
28
28
|
s.homepage = "https://reactnative.dev/"
|
|
29
29
|
s.license = package["license"]
|
|
30
30
|
s.author = "Facebook, Inc. and its affiliates"
|
|
31
|
-
s.platforms = { :ios => "11.0" }
|
|
31
|
+
s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#774)
|
|
32
32
|
s.source = source
|
|
33
33
|
s.source_files = "Fabric/**/*.{c,h,m,mm,S,cpp}"
|
|
34
34
|
s.exclude_files = "**/tests/*",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
#import "RCTActivityIndicatorView.h"
|
|
9
9
|
|
|
10
10
|
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
11
|
-
#import <
|
|
11
|
+
#import <CoreImage/CIFilter.h>
|
|
12
|
+
#import <CoreImage/CIVector.h>
|
|
12
13
|
|
|
13
14
|
@interface RCTActivityIndicatorView ()
|
|
14
15
|
@property (nonatomic, readwrite, getter=isAnimating) BOOL animating;
|
package/React/Views/RCTView.h
CHANGED
|
@@ -31,6 +31,7 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait;
|
|
|
31
31
|
- (BOOL)resignFirstResponder;
|
|
32
32
|
|
|
33
33
|
#if TARGET_OS_OSX
|
|
34
|
+
- (NSDictionary*)dataTransferInfoFromPasteboard:(NSPasteboard*)pasteboard;
|
|
34
35
|
- (BOOL)handleKeyboardEvent:(NSEvent *)event;
|
|
35
36
|
#endif
|
|
36
37
|
// ]TODO(OSS Candidate ISS#2710739)
|
package/React/Views/RCTView.m
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
#import "RCTView.h"
|
|
9
9
|
|
|
10
|
-
#import <QuartzCore/QuartzCore.h>
|
|
10
|
+
#import <QuartzCore/QuartzCore.h>
|
|
11
11
|
|
|
12
12
|
#import "RCTAutoInsetsProtocol.h"
|
|
13
13
|
#import "RCTBorderDrawing.h"
|
|
@@ -779,6 +779,9 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
|
|
|
779
779
|
name:NSViewBoundsDidChangeNotification
|
|
780
780
|
object:[[self enclosingScrollView] contentView]];
|
|
781
781
|
}
|
|
782
|
+
|
|
783
|
+
[self reactViewDidMoveToWindow]; // TODO(macOS GH#1412)
|
|
784
|
+
|
|
782
785
|
[super viewDidMoveToWindow];
|
|
783
786
|
}
|
|
784
787
|
|
|
@@ -1437,9 +1440,14 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1437
1440
|
}
|
|
1438
1441
|
}
|
|
1439
1442
|
|
|
1443
|
+
- (BOOL)needsPanelToBecomeKey {
|
|
1444
|
+
// We need to override this so that mouse clicks don't move keyboard focus on focusable views by default.
|
|
1445
|
+
return false;
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1440
1448
|
- (BOOL)acceptsFirstResponder
|
|
1441
1449
|
{
|
|
1442
|
-
|
|
1450
|
+
return [self focusable] || [super acceptsFirstResponder];
|
|
1443
1451
|
}
|
|
1444
1452
|
|
|
1445
1453
|
- (void)updateTrackingAreas
|
|
@@ -1524,13 +1532,9 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1524
1532
|
block(body);
|
|
1525
1533
|
}
|
|
1526
1534
|
|
|
1527
|
-
- (NSDictionary*)
|
|
1535
|
+
- (NSDictionary*)dataTransferInfoFromPasteboard:(NSPasteboard*)pasteboard
|
|
1528
1536
|
{
|
|
1529
|
-
|
|
1530
|
-
return @{};
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
NSArray *fileNames = [pastboard propertyListForType:NSFilenamesPboardType];
|
|
1537
|
+
NSArray *fileNames = [pasteboard propertyListForType:NSFilenamesPboardType] ?: @[];
|
|
1534
1538
|
NSMutableArray *files = [[NSMutableArray alloc] initWithCapacity:fileNames.count];
|
|
1535
1539
|
NSMutableArray *items = [[NSMutableArray alloc] initWithCapacity:fileNames.count];
|
|
1536
1540
|
NSMutableArray *types = [[NSMutableArray alloc] initWithCapacity:fileNames.count];
|
|
@@ -1556,11 +1560,21 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1556
1560
|
BOOL success = [fileURL getResourceValue:&fileSizeValue
|
|
1557
1561
|
forKey:NSURLFileSizeKey
|
|
1558
1562
|
error:&fileSizeError];
|
|
1559
|
-
|
|
1563
|
+
|
|
1564
|
+
NSNumber *width = nil;
|
|
1565
|
+
NSNumber *height = nil;
|
|
1566
|
+
if ([MIMETypeString hasPrefix:@"image/"]) {
|
|
1567
|
+
NSImage *image = [[NSImage alloc] initWithContentsOfURL:fileURL];
|
|
1568
|
+
width = @(image.size.width);
|
|
1569
|
+
height = @(image.size.height);
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1560
1572
|
[files addObject:@{@"name": RCTNullIfNil(fileURL.lastPathComponent),
|
|
1561
1573
|
@"type": RCTNullIfNil(MIMETypeString),
|
|
1562
|
-
@"uri": RCTNullIfNil(fileURL.
|
|
1563
|
-
@"size": success ? fileSizeValue : (id)kCFNull
|
|
1574
|
+
@"uri": RCTNullIfNil(fileURL.path),
|
|
1575
|
+
@"size": success ? fileSizeValue : (id)kCFNull,
|
|
1576
|
+
@"width": RCTNullIfNil(width),
|
|
1577
|
+
@"height": RCTNullIfNil(height)
|
|
1564
1578
|
}];
|
|
1565
1579
|
|
|
1566
1580
|
[items addObject:@{@"kind": @"file",
|
|
@@ -1570,7 +1584,27 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1570
1584
|
[types addObject:RCTNullIfNil(MIMETypeString)];
|
|
1571
1585
|
}
|
|
1572
1586
|
}
|
|
1573
|
-
|
|
1587
|
+
|
|
1588
|
+
NSPasteboardType imageType = [pasteboard availableTypeFromArray:@[NSPasteboardTypePNG, NSPasteboardTypeTIFF]];
|
|
1589
|
+
if (imageType && fileNames.count == 0) {
|
|
1590
|
+
NSString *MIMETypeString = imageType == NSPasteboardTypePNG ? @"image/png" : @"image/tiff";
|
|
1591
|
+
NSData *imageData = [pasteboard dataForType:imageType];
|
|
1592
|
+
NSImage *image = [[NSImage alloc] initWithData:imageData];
|
|
1593
|
+
|
|
1594
|
+
[files addObject:@{@"type": RCTNullIfNil(MIMETypeString),
|
|
1595
|
+
@"uri": RCTDataURL(MIMETypeString, imageData).absoluteString,
|
|
1596
|
+
@"size": @(imageData.length),
|
|
1597
|
+
@"width": @(image.size.width),
|
|
1598
|
+
@"height": @(image.size.height),
|
|
1599
|
+
}];
|
|
1600
|
+
|
|
1601
|
+
[items addObject:@{@"kind": @"image",
|
|
1602
|
+
@"type": RCTNullIfNil(MIMETypeString),
|
|
1603
|
+
}];
|
|
1604
|
+
|
|
1605
|
+
[types addObject:RCTNullIfNil(MIMETypeString)];
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1574
1608
|
return @{@"dataTransfer": @{@"files": files,
|
|
1575
1609
|
@"items": items,
|
|
1576
1610
|
@"types": types}};
|
|
@@ -1595,9 +1629,9 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1595
1629
|
[self sendMouseEventWithBlock:self.onDragEnter
|
|
1596
1630
|
locationInfo:[self locationInfoFromDraggingLocation:sender.draggingLocation]
|
|
1597
1631
|
modifierFlags:0
|
|
1598
|
-
additionalData:[self
|
|
1599
|
-
|
|
1600
|
-
if ([pboard
|
|
1632
|
+
additionalData:[self dataTransferInfoFromPasteboard:pboard]];
|
|
1633
|
+
|
|
1634
|
+
if ([pboard availableTypeFromArray:self.registeredDraggedTypes]) {
|
|
1601
1635
|
if (sourceDragMask & NSDragOperationLink) {
|
|
1602
1636
|
return NSDragOperationLink;
|
|
1603
1637
|
} else if (sourceDragMask & NSDragOperationCopy) {
|
|
@@ -1612,7 +1646,7 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1612
1646
|
[self sendMouseEventWithBlock:self.onDragLeave
|
|
1613
1647
|
locationInfo:[self locationInfoFromDraggingLocation:sender.draggingLocation]
|
|
1614
1648
|
modifierFlags:0
|
|
1615
|
-
additionalData:[self
|
|
1649
|
+
additionalData:[self dataTransferInfoFromPasteboard:sender.draggingPasteboard]];
|
|
1616
1650
|
}
|
|
1617
1651
|
|
|
1618
1652
|
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
|
|
@@ -1620,7 +1654,7 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
|
|
|
1620
1654
|
[self sendMouseEventWithBlock:self.onDrop
|
|
1621
1655
|
locationInfo:[self locationInfoFromDraggingLocation:sender.draggingLocation]
|
|
1622
1656
|
modifierFlags:0
|
|
1623
|
-
additionalData:[self
|
|
1657
|
+
additionalData:[self dataTransferInfoFromPasteboard:sender.draggingPasteboard]];
|
|
1624
1658
|
return YES;
|
|
1625
1659
|
}
|
|
1626
1660
|
#endif // ]TODO(macOS GH#774)
|
|
@@ -52,7 +52,15 @@
|
|
|
52
52
|
return @"Backspace";
|
|
53
53
|
} else if (code == NSDeleteFunctionKey) {
|
|
54
54
|
return @"Delete";
|
|
55
|
-
|
|
55
|
+
} else if (code == NSHomeFunctionKey) {
|
|
56
|
+
return @"Home";
|
|
57
|
+
} else if (code == NSEndFunctionKey) {
|
|
58
|
+
return @"End";
|
|
59
|
+
} else if (code == NSPageUpFunctionKey) {
|
|
60
|
+
return @"PageUp";
|
|
61
|
+
} else if (code == NSPageDownFunctionKey) {
|
|
62
|
+
return @"PageDown";
|
|
63
|
+
}
|
|
56
64
|
|
|
57
65
|
return key;
|
|
58
66
|
}
|
|
@@ -95,7 +95,8 @@ RCT_EXPORT_MODULE()
|
|
|
95
95
|
|
|
96
96
|
- (void)setBridge:(RCTBridge *)bridge
|
|
97
97
|
{
|
|
98
|
-
|
|
98
|
+
RCTErrorNewArchitectureValidation(
|
|
99
|
+
RCTNotAllowedInBridgeless, self, @"RCTViewManager must not be initialized for the new architecture");
|
|
99
100
|
_bridge = bridge;
|
|
100
101
|
}
|
|
101
102
|
|
|
@@ -197,7 +198,7 @@ RCT_REMAP_VIEW_PROPERTY(opacity, alpha, CGFloat)
|
|
|
197
198
|
RCT_REMAP_VIEW_PROPERTY(opacity, alphaValue, CGFloat)
|
|
198
199
|
#endif // ]TODO(macOS GH#774)
|
|
199
200
|
|
|
200
|
-
#if TARGET_OS_OSX // TODO(macOS GH#774)
|
|
201
|
+
#if !TARGET_OS_OSX // TODO(macOS GH#774)
|
|
201
202
|
RCT_REMAP_VIEW_PROPERTY(shadowColor, layer.shadowColor, CGColor)
|
|
202
203
|
RCT_REMAP_VIEW_PROPERTY(shadowOffset, layer.shadowOffset, CGSize)
|
|
203
204
|
RCT_REMAP_VIEW_PROPERTY(shadowOpacity, layer.shadowOpacity, float)
|
|
@@ -495,18 +496,8 @@ RCT_EXPORT_VIEW_PROPERTY(onDragLeave, RCTDirectEventBlock)
|
|
|
495
496
|
RCT_EXPORT_VIEW_PROPERTY(onDrop, RCTDirectEventBlock)
|
|
496
497
|
RCT_EXPORT_VIEW_PROPERTY(onKeyDown, RCTDirectEventBlock) // macOS keyboard events
|
|
497
498
|
RCT_EXPORT_VIEW_PROPERTY(onKeyUp, RCTDirectEventBlock) // macOS keyboard events
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
if ([view respondsToSelector:@selector(setValidKeysDown:)]) {
|
|
501
|
-
view.validKeysDown = [RCTConvert NSArray:json];
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
RCT_CUSTOM_VIEW_PROPERTY(validKeysUp, NSArray<NSString*>, RCTView)
|
|
505
|
-
{
|
|
506
|
-
if ([view respondsToSelector:@selector(setValidKeysUp:)]) {
|
|
507
|
-
view.validKeysUp = [RCTConvert NSArray:json];
|
|
508
|
-
}
|
|
509
|
-
}
|
|
499
|
+
RCT_EXPORT_VIEW_PROPERTY(validKeysDown, NSArray<NSString*>)
|
|
500
|
+
RCT_EXPORT_VIEW_PROPERTY(validKeysUp, NSArray<NSString*>)
|
|
510
501
|
#endif // ]TODO(macOS GH#774)
|
|
511
502
|
#if TARGET_OS_OSX // [TODO(macOS GH#768)
|
|
512
503
|
RCT_CUSTOM_VIEW_PROPERTY(nextKeyViewTag, NSNumber, RCTView)
|
|
@@ -18,6 +18,12 @@
|
|
|
18
18
|
#import "RCTScrollView.h"
|
|
19
19
|
|
|
20
20
|
@implementation RCTScrollContentView
|
|
21
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
22
|
+
- (BOOL)isFlipped
|
|
23
|
+
{
|
|
24
|
+
return !self.inverted;
|
|
25
|
+
}
|
|
26
|
+
#endif // ]TODO(macOS GH#774)
|
|
21
27
|
|
|
22
28
|
- (void)reactSetFrame:(CGRect)frame
|
|
23
29
|
{
|
|
@@ -65,9 +65,10 @@
|
|
|
65
65
|
@property (nonatomic, copy) RCTDirectEventBlock onScrollEndDrag;
|
|
66
66
|
@property (nonatomic, copy) RCTDirectEventBlock onMomentumScrollBegin;
|
|
67
67
|
@property (nonatomic, copy) RCTDirectEventBlock onMomentumScrollEnd;
|
|
68
|
-
@property (nonatomic, copy) RCTDirectEventBlock onScrollKeyDown; // TODO(macOS GH#774)
|
|
69
68
|
@property (nonatomic, copy) RCTDirectEventBlock onPreferredScrollerStyleDidChange; // TODO(macOS GH#774)
|
|
70
69
|
|
|
70
|
+
@property (nonatomic, copy) RCTDirectEventBlock onInvertedDidChange; // TODO(macOS GH#774)
|
|
71
|
+
|
|
71
72
|
- (void)flashScrollIndicators; // TODO(macOS GH#774)
|
|
72
73
|
|
|
73
74
|
@end
|