react-native 0.74.0-rc.2 → 0.74.0-rc.4
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/AppDelegate/RCTAppDelegate.h +5 -8
- package/Libraries/AppDelegate/RCTAppDelegate.mm +56 -130
- package/Libraries/AppDelegate/RCTRootViewFactory.h +123 -0
- package/Libraries/AppDelegate/RCTRootViewFactory.mm +253 -0
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +1 -0
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/registerCallableModule.d.ts +16 -0
- package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +4 -0
- package/Libraries/StyleSheet/StyleSheetTypes.js +3 -0
- package/React/Base/RCTBridgeProxy+Cxx.h +20 -0
- package/React/Base/RCTBridgeProxy.h +2 -0
- package/React/Base/RCTBridgeProxy.mm +15 -0
- package/React/Base/RCTConvert.h +3 -0
- package/React/Base/RCTConvert.mm +9 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h +7 -0
- package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm +17 -2
- package/React/CoreModules/RCTRedBox.mm +7 -1
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +32 -0
- package/React/Views/RCTCursor.h +13 -0
- package/React/Views/RCTView.h +3 -0
- package/React/Views/RCTView.m +30 -0
- package/React/Views/RCTViewManager.m +2 -0
- package/ReactAndroid/api/ReactAndroid.api +44 -0
- package/ReactAndroid/build.gradle.kts +26 -0
- package/ReactAndroid/cmake-utils/ReactNative-application.cmake +6 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +22 -16
- package/ReactAndroid/src/main/java/com/facebook/react/ReactHost.kt +9 -0
- package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +5 -0
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java +2 -1
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleRegistry.java +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArrayInterface.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadHandler.java +0 -11
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHostDelegate.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt +11 -6
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt +201 -0
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.java +4 -6
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +47 -0
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +2 -0
- package/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.cpp +0 -1
- package/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.h +0 -4
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/react/renderer/components/view/BaseViewProps.cpp +9 -0
- package/ReactCommon/react/renderer/components/view/BaseViewProps.h +2 -0
- package/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp +1 -1
- package/ReactCommon/react/renderer/components/view/conversions.h +22 -0
- package/ReactCommon/react/renderer/components/view/primitives.h +2 -0
- package/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTImagePrimitivesConversions.h +2 -2
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +45 -12
- package/ReactCommon/yoga/yoga/algorithm/AbsoluteLayout.cpp +64 -40
- package/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +19 -20
- package/package.json +11 -11
- package/sdks/hermesc/osx-bin/hermes +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/template/package.json +5 -5
- package/types/index.d.ts +1 -0
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultBindingsInstaller.kt +0 -20
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
type Module = Object;
|
|
11
|
+
type RegisterCallableModule = (
|
|
12
|
+
name: string,
|
|
13
|
+
moduleOrFactory: Module | (() => Module),
|
|
14
|
+
) => void;
|
|
15
|
+
|
|
16
|
+
export const registerCallableModule: RegisterCallableModule;
|
|
@@ -192,7 +192,7 @@ export function parseComponentStack(message: string): ComponentStack {
|
|
|
192
192
|
if (!s) {
|
|
193
193
|
return null;
|
|
194
194
|
}
|
|
195
|
-
const match = s.match(/(.*) \(at (.*\.js):([\d]+)\)/);
|
|
195
|
+
const match = s.match(/(.*) \(at (.*\.(?:js|jsx|ts|tsx)):([\d]+)\)/);
|
|
196
196
|
if (!match) {
|
|
197
197
|
return null;
|
|
198
198
|
}
|
|
@@ -27,6 +27,8 @@ export type DimensionValue =
|
|
|
27
27
|
type AnimatableNumericValue = number | Animated.AnimatedNode;
|
|
28
28
|
type AnimatableStringValue = string | Animated.AnimatedNode;
|
|
29
29
|
|
|
30
|
+
export type CursorValue = 'auto' | 'pointer';
|
|
31
|
+
|
|
30
32
|
/**
|
|
31
33
|
* Flex Prop Types
|
|
32
34
|
* @see https://reactnative.dev/docs/flexbox
|
|
@@ -274,6 +276,7 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
|
|
|
274
276
|
* Controls whether the View can be the target of touch events.
|
|
275
277
|
*/
|
|
276
278
|
pointerEvents?: 'box-none' | 'none' | 'box-only' | 'auto' | undefined;
|
|
279
|
+
cursor?: CursorValue | undefined;
|
|
277
280
|
}
|
|
278
281
|
|
|
279
282
|
export type FontVariant =
|
|
@@ -403,4 +406,5 @@ export interface ImageStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
|
|
|
403
406
|
tintColor?: ColorValue | undefined;
|
|
404
407
|
opacity?: AnimatableNumericValue | undefined;
|
|
405
408
|
objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | undefined;
|
|
409
|
+
cursor?: CursorValue | undefined;
|
|
406
410
|
}
|
|
@@ -37,6 +37,8 @@ export type EdgeInsetsValue = {
|
|
|
37
37
|
export type DimensionValue = number | string | 'auto' | AnimatedNode | null;
|
|
38
38
|
export type AnimatableNumericValue = number | AnimatedNode;
|
|
39
39
|
|
|
40
|
+
export type CursorValue = 'auto' | 'pointer';
|
|
41
|
+
|
|
40
42
|
/**
|
|
41
43
|
* React Native's layout system is based on Flexbox and is powered both
|
|
42
44
|
* on iOS and Android by an open source project called `Yoga`:
|
|
@@ -729,6 +731,7 @@ export type ____ViewStyle_InternalCore = $ReadOnly<{
|
|
|
729
731
|
opacity?: AnimatableNumericValue,
|
|
730
732
|
elevation?: number,
|
|
731
733
|
pointerEvents?: 'auto' | 'none' | 'box-none' | 'box-only',
|
|
734
|
+
cursor?: CursorValue,
|
|
732
735
|
}>;
|
|
733
736
|
|
|
734
737
|
export type ____ViewStyle_Internal = $ReadOnly<{
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#ifdef __cplusplus
|
|
9
|
+
#import <ReactCommon/CallInvoker.h>
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
#import "RCTBridgeProxy.h"
|
|
13
|
+
|
|
14
|
+
@interface RCTBridgeProxy (Cxx)
|
|
15
|
+
|
|
16
|
+
#ifdef __cplusplus
|
|
17
|
+
@property (nonatomic, readwrite) std::shared_ptr<facebook::react::CallInvoker> jsCallInvoker;
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
@end
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
@class RCTViewRegistry;
|
|
16
16
|
|
|
17
17
|
@interface RCTBridgeProxy : NSProxy
|
|
18
|
+
|
|
18
19
|
- (instancetype)initWithViewRegistry:(RCTViewRegistry *)viewRegistry
|
|
19
20
|
moduleRegistry:(RCTModuleRegistry *)moduleRegistry
|
|
20
21
|
bundleManager:(RCTBundleManager *)bundleManager
|
|
@@ -34,4 +35,5 @@
|
|
|
34
35
|
*/
|
|
35
36
|
- (id)moduleForClass:(Class)moduleClass;
|
|
36
37
|
- (id)moduleForName:(NSString *)moduleName lazilyLoadIfNecessary:(BOOL)lazilyLoad;
|
|
38
|
+
|
|
37
39
|
@end
|
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
#import "RCTBridgeProxy.h"
|
|
9
|
+
#import "RCTBridgeProxy+Cxx.h"
|
|
10
|
+
|
|
9
11
|
#import <React/RCTBridge+Private.h>
|
|
10
12
|
#import <React/RCTBridge.h>
|
|
11
13
|
#import <React/RCTLog.h>
|
|
12
14
|
#import <React/RCTUIManager.h>
|
|
15
|
+
#import <ReactCommon/CallInvoker.h>
|
|
13
16
|
#import <jsi/jsi.h>
|
|
14
17
|
|
|
15
18
|
using namespace facebook;
|
|
@@ -21,6 +24,12 @@ using namespace facebook;
|
|
|
21
24
|
- (void)forwardInvocation:(NSInvocation *)invocation;
|
|
22
25
|
@end
|
|
23
26
|
|
|
27
|
+
@interface RCTBridgeProxy ()
|
|
28
|
+
|
|
29
|
+
@property (nonatomic, readwrite) std::shared_ptr<facebook::react::CallInvoker> jsCallInvoker;
|
|
30
|
+
|
|
31
|
+
@end
|
|
32
|
+
|
|
24
33
|
@implementation RCTBridgeProxy {
|
|
25
34
|
RCTUIManagerProxy *_uiManagerProxy;
|
|
26
35
|
RCTModuleRegistry *_moduleRegistry;
|
|
@@ -84,6 +93,12 @@ using namespace facebook;
|
|
|
84
93
|
return _runtime;
|
|
85
94
|
}
|
|
86
95
|
|
|
96
|
+
- (std::shared_ptr<facebook::react::CallInvoker>)jsCallInvoker
|
|
97
|
+
{
|
|
98
|
+
[self logWarning:@"Please migrate to RuntimeExecutor" cmd:_cmd];
|
|
99
|
+
return _jsCallInvoker;
|
|
100
|
+
}
|
|
101
|
+
|
|
87
102
|
/**
|
|
88
103
|
* RCTModuleRegistry
|
|
89
104
|
*/
|
package/React/Base/RCTConvert.h
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
#import <React/RCTAnimationType.h>
|
|
12
12
|
#import <React/RCTBorderCurve.h>
|
|
13
13
|
#import <React/RCTBorderStyle.h>
|
|
14
|
+
#import <React/RCTCursor.h>
|
|
14
15
|
#import <React/RCTDefines.h>
|
|
15
16
|
#import <React/RCTLog.h>
|
|
16
17
|
#import <React/RCTPointerEvents.h>
|
|
@@ -80,6 +81,8 @@ typedef NSURL RCTFileURL;
|
|
|
80
81
|
+ (UIBarStyle)UIBarStyle:(id)json __deprecated;
|
|
81
82
|
#endif
|
|
82
83
|
|
|
84
|
+
+ (RCTCursor)RCTCursor:(id)json;
|
|
85
|
+
|
|
83
86
|
+ (CGFloat)CGFloat:(id)json;
|
|
84
87
|
+ (CGPoint)CGPoint:(id)json;
|
|
85
88
|
+ (CGSize)CGSize:(id)json;
|
package/React/Base/RCTConvert.mm
CHANGED
|
@@ -545,6 +545,15 @@ RCT_ENUM_CONVERTER(
|
|
|
545
545
|
UIBarStyleDefault,
|
|
546
546
|
integerValue)
|
|
547
547
|
|
|
548
|
+
RCT_ENUM_CONVERTER(
|
|
549
|
+
RCTCursor,
|
|
550
|
+
(@{
|
|
551
|
+
@"auto" : @(RCTCursorAuto),
|
|
552
|
+
@"pointer" : @(RCTCursorPointer),
|
|
553
|
+
}),
|
|
554
|
+
RCTCursorAuto,
|
|
555
|
+
integerValue)
|
|
556
|
+
|
|
548
557
|
static void convertCGStruct(const char *type, NSArray *fields, CGFloat *result, id json)
|
|
549
558
|
{
|
|
550
559
|
NSUInteger count = fields.count;
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -56,6 +56,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
56
56
|
*/
|
|
57
57
|
@property (nonatomic, copy, nullable) RCTSurfaceHostingViewActivityIndicatorViewFactory activityIndicatorViewFactory;
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* When set to `YES`, the activity indicator is not automatically hidden when the Surface stage changes.
|
|
61
|
+
* In this scenario, users should invoke `hideActivityIndicator` to remove it.
|
|
62
|
+
*
|
|
63
|
+
* @param disabled: if `YES`, the auto-hide is disabled. Otherwise the loading view will be hidden automatically
|
|
64
|
+
*/
|
|
65
|
+
- (void)disableActivityIndicatorAutoHide:(BOOL)disabled;
|
|
59
66
|
@end
|
|
60
67
|
|
|
61
68
|
NS_ASSUME_NONNULL_END
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
UIView *_Nullable _activityIndicatorView;
|
|
25
25
|
UIView *_Nullable _surfaceView;
|
|
26
26
|
RCTSurfaceStage _stage;
|
|
27
|
+
BOOL _autoHideDisabled;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
RCT_NOT_IMPLEMENTED(-(instancetype)init)
|
|
@@ -36,6 +37,7 @@ RCT_NOT_IMPLEMENTED(-(nullable instancetype)initWithCoder : (NSCoder *)coder)
|
|
|
36
37
|
if (self = [super initWithFrame:CGRectZero]) {
|
|
37
38
|
_surface = surface;
|
|
38
39
|
_sizeMeasureMode = sizeMeasureMode;
|
|
40
|
+
_autoHideDisabled = NO;
|
|
39
41
|
|
|
40
42
|
_surface.delegate = self;
|
|
41
43
|
_stage = surface.stage;
|
|
@@ -124,6 +126,10 @@ RCT_NOT_IMPLEMENTED(-(nullable instancetype)initWithCoder : (NSCoder *)coder)
|
|
|
124
126
|
_sizeMeasureMode = sizeMeasureMode;
|
|
125
127
|
[self _invalidateLayout];
|
|
126
128
|
}
|
|
129
|
+
- (void)disableActivityIndicatorAutoHide:(BOOL)disabled
|
|
130
|
+
{
|
|
131
|
+
_autoHideDisabled = disabled;
|
|
132
|
+
}
|
|
127
133
|
|
|
128
134
|
#pragma mark - isActivityIndicatorViewVisible
|
|
129
135
|
|
|
@@ -162,7 +168,16 @@ RCT_NOT_IMPLEMENTED(-(nullable instancetype)initWithCoder : (NSCoder *)coder)
|
|
|
162
168
|
_surfaceView = _surface.view;
|
|
163
169
|
_surfaceView.frame = self.bounds;
|
|
164
170
|
_surfaceView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
165
|
-
|
|
171
|
+
if (_activityIndicatorView && _autoHideDisabled) {
|
|
172
|
+
// The activity indicator is still showing and the surface is set to
|
|
173
|
+
// prevent the auto hide. This means that the application will take care of
|
|
174
|
+
// hiding it when it's ready.
|
|
175
|
+
// Let's add the surfaceView below the activity indicator so it's ready once
|
|
176
|
+
// the activity indicator is hidden.
|
|
177
|
+
[self insertSubview:_surfaceView belowSubview:_activityIndicatorView];
|
|
178
|
+
} else {
|
|
179
|
+
[self addSubview:_surfaceView];
|
|
180
|
+
}
|
|
166
181
|
} else {
|
|
167
182
|
[_surfaceView removeFromSuperview];
|
|
168
183
|
_surfaceView = nil;
|
|
@@ -204,7 +219,7 @@ RCT_NOT_IMPLEMENTED(-(nullable instancetype)initWithCoder : (NSCoder *)coder)
|
|
|
204
219
|
- (void)_updateViews
|
|
205
220
|
{
|
|
206
221
|
self.isSurfaceViewVisible = RCTSurfaceStageIsRunning(_stage);
|
|
207
|
-
self.isActivityIndicatorViewVisible = RCTSurfaceStageIsPreparing(_stage);
|
|
222
|
+
self.isActivityIndicatorViewVisible = _autoHideDisabled || RCTSurfaceStageIsPreparing(_stage);
|
|
208
223
|
}
|
|
209
224
|
|
|
210
225
|
- (void)didMoveToWindow
|
|
@@ -274,7 +274,13 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
|
|
|
274
274
|
|
|
275
275
|
- (void)reload
|
|
276
276
|
{
|
|
277
|
-
|
|
277
|
+
if (_actionDelegate != nil) {
|
|
278
|
+
[_actionDelegate reloadFromRedBoxController:self];
|
|
279
|
+
} else {
|
|
280
|
+
// In bridgeless mode `RCTRedBox` gets deallocated, we need to notify listeners anyway.
|
|
281
|
+
RCTTriggerReloadCommandListeners(@"Redbox");
|
|
282
|
+
[self dismiss];
|
|
283
|
+
}
|
|
278
284
|
}
|
|
279
285
|
|
|
280
286
|
- (void)showExtraDataViewController
|
|
@@ -257,6 +257,11 @@ using namespace facebook::react;
|
|
|
257
257
|
self.layer.doubleSided = newViewProps.backfaceVisibility == BackfaceVisibility::Visible;
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
+
// `cursor`
|
|
261
|
+
if (oldViewProps.cursor != newViewProps.cursor) {
|
|
262
|
+
needsInvalidateLayer = YES;
|
|
263
|
+
}
|
|
264
|
+
|
|
260
265
|
// `shouldRasterize`
|
|
261
266
|
if (oldViewProps.shouldRasterize != newViewProps.shouldRasterize) {
|
|
262
267
|
self.layer.shouldRasterize = newViewProps.shouldRasterize;
|
|
@@ -592,6 +597,33 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
|
|
|
592
597
|
layer.shadowPath = nil;
|
|
593
598
|
}
|
|
594
599
|
|
|
600
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 170000 /* __IPHONE_17_0 */
|
|
601
|
+
// Stage 1.5. Cursor / Hover Effects
|
|
602
|
+
if (@available(iOS 17.0, *)) {
|
|
603
|
+
UIHoverStyle *hoverStyle = nil;
|
|
604
|
+
if (_props->cursor == Cursor::Pointer) {
|
|
605
|
+
const RCTCornerInsets cornerInsets =
|
|
606
|
+
RCTGetCornerInsets(RCTCornerRadiiFromBorderRadii(borderMetrics.borderRadii), UIEdgeInsetsZero);
|
|
607
|
+
#if TARGET_OS_IOS
|
|
608
|
+
// Due to an Apple bug, it seems on iOS, UIShapes made with `[UIShape shapeWithBezierPath:]`
|
|
609
|
+
// evaluate their shape on the superviews' coordinate space. This leads to the hover shape
|
|
610
|
+
// rendering incorrectly on iOS, iOS apps in compatibility mode on visionOS, but not on visionOS.
|
|
611
|
+
// To work around this, for iOS, we can calculate the border path based on `view.frame` (the
|
|
612
|
+
// superview's coordinate space) instead of view.bounds.
|
|
613
|
+
CGPathRef borderPath = RCTPathCreateWithRoundedRect(self.frame, cornerInsets, NULL);
|
|
614
|
+
#else // TARGET_OS_VISION
|
|
615
|
+
CGPathRef borderPath = RCTPathCreateWithRoundedRect(self.bounds, cornerInsets, NULL);
|
|
616
|
+
#endif
|
|
617
|
+
UIBezierPath *bezierPath = [UIBezierPath bezierPathWithCGPath:borderPath];
|
|
618
|
+
CGPathRelease(borderPath);
|
|
619
|
+
UIShape *shape = [UIShape shapeWithBezierPath:bezierPath];
|
|
620
|
+
|
|
621
|
+
hoverStyle = [UIHoverStyle styleWithEffect:[UIHoverAutomaticEffect effect] shape:shape];
|
|
622
|
+
}
|
|
623
|
+
[self setHoverStyle:hoverStyle];
|
|
624
|
+
}
|
|
625
|
+
#endif
|
|
626
|
+
|
|
595
627
|
// Stage 2. Border Rendering
|
|
596
628
|
const bool useCoreAnimationBorderRendering =
|
|
597
629
|
borderMetrics.borderColors.isUniform() && borderMetrics.borderWidths.isUniform() &&
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
|
|
10
|
+
typedef NS_ENUM(NSInteger, RCTCursor) {
|
|
11
|
+
RCTCursorAuto,
|
|
12
|
+
RCTCursorPointer,
|
|
13
|
+
};
|
package/React/Views/RCTView.h
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
#import <React/RCTBorderCurve.h>
|
|
11
11
|
#import <React/RCTBorderStyle.h>
|
|
12
12
|
#import <React/RCTComponent.h>
|
|
13
|
+
#import <React/RCTCursor.h>
|
|
13
14
|
#import <React/RCTPointerEvents.h>
|
|
14
15
|
|
|
15
16
|
extern const UIAccessibilityTraits SwitchAccessibilityTrait;
|
|
@@ -120,6 +121,8 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait;
|
|
|
120
121
|
*/
|
|
121
122
|
@property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;
|
|
122
123
|
|
|
124
|
+
@property (nonatomic, assign) RCTCursor cursor;
|
|
125
|
+
|
|
123
126
|
/**
|
|
124
127
|
* (Experimental and unused for Paper) Pointer event handlers.
|
|
125
128
|
*/
|
package/React/Views/RCTView.m
CHANGED
|
@@ -136,6 +136,7 @@ static NSString *RCTRecursiveAccessibilityLabel(UIView *view)
|
|
|
136
136
|
_borderCurve = RCTBorderCurveCircular;
|
|
137
137
|
_borderStyle = RCTBorderStyleSolid;
|
|
138
138
|
_hitTestEdgeInsets = UIEdgeInsetsZero;
|
|
139
|
+
_cursor = RCTCursorAuto;
|
|
139
140
|
|
|
140
141
|
_backgroundColor = super.backgroundColor;
|
|
141
142
|
}
|
|
@@ -796,6 +797,8 @@ static CGFloat RCTDefaultIfNegativeTo(CGFloat defaultValue, CGFloat x)
|
|
|
796
797
|
|
|
797
798
|
RCTUpdateShadowPathForView(self);
|
|
798
799
|
|
|
800
|
+
RCTUpdateHoverStyleForView(self);
|
|
801
|
+
|
|
799
802
|
const RCTCornerRadii cornerRadii = [self cornerRadii];
|
|
800
803
|
const UIEdgeInsets borderInsets = [self bordersAsInsets];
|
|
801
804
|
const RCTBorderColors borderColors = [self borderColorsWithTraitCollection:self.traitCollection];
|
|
@@ -891,6 +894,33 @@ static void RCTUpdateShadowPathForView(RCTView *view)
|
|
|
891
894
|
}
|
|
892
895
|
}
|
|
893
896
|
|
|
897
|
+
static void RCTUpdateHoverStyleForView(RCTView *view)
|
|
898
|
+
{
|
|
899
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 170000 /* __IPHONE_17_0 */
|
|
900
|
+
if (@available(iOS 17.0, *)) {
|
|
901
|
+
UIHoverStyle *hoverStyle = nil;
|
|
902
|
+
if ([view cursor] == RCTCursorPointer) {
|
|
903
|
+
const RCTCornerRadii cornerRadii = [view cornerRadii];
|
|
904
|
+
const RCTCornerInsets cornerInsets = RCTGetCornerInsets(cornerRadii, UIEdgeInsetsZero);
|
|
905
|
+
#if TARGET_OS_IOS
|
|
906
|
+
// Due to an Apple bug, it seems on iOS, `[UIShape shapeWithBezierPath:]` needs to
|
|
907
|
+
// be calculated in the superviews' coordinate space (view.frame). This is not true
|
|
908
|
+
// on other platforms like visionOS.
|
|
909
|
+
CGPathRef borderPath = RCTPathCreateWithRoundedRect(view.frame, cornerInsets, NULL);
|
|
910
|
+
#else // TARGET_OS_VISION
|
|
911
|
+
CGPathRef borderPath = RCTPathCreateWithRoundedRect(view.bounds, cornerInsets, NULL);
|
|
912
|
+
#endif
|
|
913
|
+
UIBezierPath *bezierPath = [UIBezierPath bezierPathWithCGPath:borderPath];
|
|
914
|
+
CGPathRelease(borderPath);
|
|
915
|
+
UIShape *shape = [UIShape shapeWithBezierPath:bezierPath];
|
|
916
|
+
|
|
917
|
+
hoverStyle = [UIHoverStyle styleWithEffect:[UIHoverHighlightEffect effect] shape:shape];
|
|
918
|
+
}
|
|
919
|
+
[view setHoverStyle:hoverStyle];
|
|
920
|
+
}
|
|
921
|
+
#endif
|
|
922
|
+
}
|
|
923
|
+
|
|
894
924
|
- (void)updateClippingForLayer:(CALayer *)layer
|
|
895
925
|
{
|
|
896
926
|
CALayer *mask = nil;
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
#import "RCTBridge.h"
|
|
14
14
|
#import "RCTConvert+Transform.h"
|
|
15
15
|
#import "RCTConvert.h"
|
|
16
|
+
#import "RCTCursor.h"
|
|
16
17
|
#import "RCTLog.h"
|
|
17
18
|
#import "RCTShadowView.h"
|
|
18
19
|
#import "RCTUIManager.h"
|
|
@@ -195,6 +196,7 @@ RCT_REMAP_VIEW_PROPERTY(testID, reactAccessibilityElement.accessibilityIdentifie
|
|
|
195
196
|
|
|
196
197
|
RCT_EXPORT_VIEW_PROPERTY(backgroundColor, UIColor)
|
|
197
198
|
RCT_REMAP_VIEW_PROPERTY(backfaceVisibility, layer.doubleSided, css_backface_visibility_t)
|
|
199
|
+
RCT_EXPORT_VIEW_PROPERTY(cursor, RCTCursor)
|
|
198
200
|
RCT_REMAP_VIEW_PROPERTY(opacity, alpha, CGFloat)
|
|
199
201
|
RCT_REMAP_VIEW_PROPERTY(shadowColor, layer.shadowColor, CGColor)
|
|
200
202
|
RCT_REMAP_VIEW_PROPERTY(shadowOffset, layer.shadowOffset, CGSize)
|
|
@@ -196,6 +196,7 @@ public abstract interface class com/facebook/react/ReactHost {
|
|
|
196
196
|
public abstract fun getJsEngineResolutionAlgorithm ()Lcom/facebook/react/JSEngineResolutionAlgorithm;
|
|
197
197
|
public abstract fun getLifecycleState ()Lcom/facebook/react/common/LifecycleState;
|
|
198
198
|
public abstract fun getReactQueueConfiguration ()Lcom/facebook/react/bridge/queue/ReactQueueConfiguration;
|
|
199
|
+
public abstract fun onActivityResult (Landroid/app/Activity;IILandroid/content/Intent;)V
|
|
199
200
|
public abstract fun onBackPressed ()Z
|
|
200
201
|
public abstract fun onHostDestroy ()V
|
|
201
202
|
public abstract fun onHostDestroy (Landroid/app/Activity;)V
|
|
@@ -949,6 +950,10 @@ public abstract class com/facebook/react/bridge/NativeArray : com/facebook/react
|
|
|
949
950
|
public fun toString ()Ljava/lang/String;
|
|
950
951
|
}
|
|
951
952
|
|
|
953
|
+
public abstract interface class com/facebook/react/bridge/NativeArrayInterface {
|
|
954
|
+
public abstract fun toString ()Ljava/lang/String;
|
|
955
|
+
}
|
|
956
|
+
|
|
952
957
|
public abstract class com/facebook/react/bridge/NativeMap {
|
|
953
958
|
public fun <init> (Lcom/facebook/jni/HybridData;)V
|
|
954
959
|
public fun toString ()Ljava/lang/String;
|
|
@@ -3575,6 +3580,43 @@ public abstract class com/facebook/react/runtime/BindingsInstaller {
|
|
|
3575
3580
|
public fun <init> (Lcom/facebook/jni/HybridData;)V
|
|
3576
3581
|
}
|
|
3577
3582
|
|
|
3583
|
+
public final class com/facebook/react/runtime/BridgelessCatalystInstance : com/facebook/react/bridge/CatalystInstance {
|
|
3584
|
+
public fun <init> (Lcom/facebook/react/runtime/ReactHostImpl;)V
|
|
3585
|
+
public fun addBridgeIdleDebugListener (Lcom/facebook/react/bridge/NotThreadSafeBridgeIdleDebugListener;)V
|
|
3586
|
+
public fun addJSIModules (Ljava/util/List;)V
|
|
3587
|
+
public fun callFunction (Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/bridge/NativeArray;)V
|
|
3588
|
+
public fun destroy ()V
|
|
3589
|
+
public fun extendNativeModules (Lcom/facebook/react/bridge/NativeModuleRegistry;)V
|
|
3590
|
+
public fun getFabricUIManager ()Lcom/facebook/react/bridge/UIManager;
|
|
3591
|
+
public fun getJSCallInvokerHolder ()Lcom/facebook/react/turbomodule/core/interfaces/CallInvokerHolder;
|
|
3592
|
+
public fun getJSIModule (Lcom/facebook/react/bridge/JSIModuleType;)Lcom/facebook/react/bridge/JSIModule;
|
|
3593
|
+
public fun getJSModule (Ljava/lang/Class;)Lcom/facebook/react/bridge/JavaScriptModule;
|
|
3594
|
+
public fun getJavaScriptContextHolder ()Lcom/facebook/react/bridge/JavaScriptContextHolder;
|
|
3595
|
+
public fun getNativeMethodCallInvokerHolder ()Lcom/facebook/react/turbomodule/core/interfaces/NativeMethodCallInvokerHolder;
|
|
3596
|
+
public fun getNativeModule (Ljava/lang/Class;)Lcom/facebook/react/bridge/NativeModule;
|
|
3597
|
+
public fun getNativeModule (Ljava/lang/String;)Lcom/facebook/react/bridge/NativeModule;
|
|
3598
|
+
public fun getNativeModules ()Ljava/util/Collection;
|
|
3599
|
+
public fun getReactQueueConfiguration ()Lcom/facebook/react/bridge/queue/ReactQueueConfiguration;
|
|
3600
|
+
public fun getRuntimeExecutor ()Lcom/facebook/react/bridge/RuntimeExecutor;
|
|
3601
|
+
public fun getRuntimeScheduler ()Lcom/facebook/react/bridge/RuntimeScheduler;
|
|
3602
|
+
public fun getSourceURL ()Ljava/lang/String;
|
|
3603
|
+
public fun handleMemoryPressure (I)V
|
|
3604
|
+
public fun hasNativeModule (Ljava/lang/Class;)Z
|
|
3605
|
+
public fun hasRunJSBundle ()Z
|
|
3606
|
+
public fun invokeCallback (ILcom/facebook/react/bridge/NativeArrayInterface;)V
|
|
3607
|
+
public fun isDestroyed ()Z
|
|
3608
|
+
public fun loadScriptFromAssets (Landroid/content/res/AssetManager;Ljava/lang/String;Z)V
|
|
3609
|
+
public fun loadScriptFromFile (Ljava/lang/String;Ljava/lang/String;Z)V
|
|
3610
|
+
public fun loadSplitBundleFromFile (Ljava/lang/String;Ljava/lang/String;)V
|
|
3611
|
+
public fun registerSegment (ILjava/lang/String;)V
|
|
3612
|
+
public fun removeBridgeIdleDebugListener (Lcom/facebook/react/bridge/NotThreadSafeBridgeIdleDebugListener;)V
|
|
3613
|
+
public fun runJSBundle ()V
|
|
3614
|
+
public fun setFabricUIManager (Lcom/facebook/react/bridge/UIManager;)V
|
|
3615
|
+
public fun setSourceURLs (Ljava/lang/String;Ljava/lang/String;)V
|
|
3616
|
+
public fun setTurboModuleManager (Lcom/facebook/react/bridge/JSIModule;)V
|
|
3617
|
+
public fun setTurboModuleRegistry (Lcom/facebook/react/internal/turbomodule/core/interfaces/TurboModuleRegistry;)V
|
|
3618
|
+
}
|
|
3619
|
+
|
|
3578
3620
|
public class com/facebook/react/runtime/CoreReactPackage$$ReactModuleInfoProvider : com/facebook/react/module/model/ReactModuleInfoProvider {
|
|
3579
3621
|
public fun <init> ()V
|
|
3580
3622
|
public fun getReactModuleInfos ()Ljava/util/Map;
|
|
@@ -3602,6 +3644,7 @@ public class com/facebook/react/runtime/ReactHostImpl : com/facebook/react/React
|
|
|
3602
3644
|
public fun getLifecycleState ()Lcom/facebook/react/common/LifecycleState;
|
|
3603
3645
|
public fun getMemoryPressureRouter ()Lcom/facebook/react/MemoryPressureRouter;
|
|
3604
3646
|
public fun getReactQueueConfiguration ()Lcom/facebook/react/bridge/queue/ReactQueueConfiguration;
|
|
3647
|
+
public fun onActivityResult (Landroid/app/Activity;IILandroid/content/Intent;)V
|
|
3605
3648
|
public fun onBackPressed ()Z
|
|
3606
3649
|
public fun onHostDestroy ()V
|
|
3607
3650
|
public fun onHostDestroy (Landroid/app/Activity;)V
|
|
@@ -7042,6 +7085,7 @@ public class com/facebook/react/views/text/TextAttributeProps : com/facebook/rea
|
|
|
7042
7085
|
public static final field TA_KEY_TEXT_SHADOW_OFFSET_DY S
|
|
7043
7086
|
public static final field TA_KEY_TEXT_SHADOW_RADIUS S
|
|
7044
7087
|
public static final field TA_KEY_TEXT_TRANSFORM S
|
|
7088
|
+
public static final field UNSET I
|
|
7045
7089
|
protected field mAccessibilityRole Lcom/facebook/react/uimanager/ReactAccessibilityDelegate$AccessibilityRole;
|
|
7046
7090
|
protected field mAllowFontScaling Z
|
|
7047
7091
|
protected field mBackgroundColor I
|
|
@@ -125,6 +125,16 @@ val preparePrefab by
|
|
|
125
125
|
"react/renderer/components/view/"),
|
|
126
126
|
Pair("../ReactCommon/react/renderer/components/view/platform/android/", ""),
|
|
127
127
|
)),
|
|
128
|
+
PrefabPreprocessingEntry(
|
|
129
|
+
"rrc_text",
|
|
130
|
+
Pair(
|
|
131
|
+
"../ReactCommon/react/renderer/components/text/",
|
|
132
|
+
"react/renderer/components/text/")),
|
|
133
|
+
PrefabPreprocessingEntry(
|
|
134
|
+
"rrc_textinput",
|
|
135
|
+
Pair(
|
|
136
|
+
"../ReactCommon/react/renderer/components/textinput/",
|
|
137
|
+
"react/renderer/components/androidtextinput/")),
|
|
128
138
|
PrefabPreprocessingEntry(
|
|
129
139
|
"rrc_legacyviewmanagerinterop",
|
|
130
140
|
Pair(
|
|
@@ -138,6 +148,14 @@ val preparePrefab by
|
|
|
138
148
|
PrefabPreprocessingEntry(
|
|
139
149
|
"react_render_mapbuffer",
|
|
140
150
|
Pair("../ReactCommon/react/renderer/mapbuffer/", "react/renderer/mapbuffer/")),
|
|
151
|
+
PrefabPreprocessingEntry(
|
|
152
|
+
"react_render_textlayoutmanager",
|
|
153
|
+
listOf(
|
|
154
|
+
Pair(
|
|
155
|
+
"../ReactCommon/react/renderer/textlayoutmanager/",
|
|
156
|
+
"react/renderer/textlayoutmanager/"),
|
|
157
|
+
Pair("../ReactCommon/react/renderer/textlayoutmanager/platform/android/", ""),
|
|
158
|
+
)),
|
|
141
159
|
PrefabPreprocessingEntry(
|
|
142
160
|
"yoga",
|
|
143
161
|
listOf(
|
|
@@ -538,11 +556,14 @@ android {
|
|
|
538
556
|
"rrc_image",
|
|
539
557
|
"rrc_root",
|
|
540
558
|
"rrc_view",
|
|
559
|
+
"rrc_text",
|
|
560
|
+
"rrc_textinput",
|
|
541
561
|
"rrc_legacyviewmanagerinterop",
|
|
542
562
|
"jsi",
|
|
543
563
|
"glog",
|
|
544
564
|
"fabricjni",
|
|
545
565
|
"react_render_mapbuffer",
|
|
566
|
+
"react_render_textlayoutmanager",
|
|
546
567
|
"yoga",
|
|
547
568
|
"folly_runtime",
|
|
548
569
|
"react_nativemodule_core",
|
|
@@ -662,6 +683,8 @@ android {
|
|
|
662
683
|
create("rrc_image") { headers = File(prefabHeadersDir, "rrc_image").absolutePath }
|
|
663
684
|
create("rrc_root") { headers = File(prefabHeadersDir, "rrc_root").absolutePath }
|
|
664
685
|
create("rrc_view") { headers = File(prefabHeadersDir, "rrc_view").absolutePath }
|
|
686
|
+
create("rrc_text") { headers = File(prefabHeadersDir, "rrc_text").absolutePath }
|
|
687
|
+
create("rrc_textinput") { headers = File(prefabHeadersDir, "rrc_textinput").absolutePath }
|
|
665
688
|
create("rrc_legacyviewmanagerinterop") {
|
|
666
689
|
headers = File(prefabHeadersDir, "rrc_legacyviewmanagerinterop").absolutePath
|
|
667
690
|
}
|
|
@@ -671,6 +694,9 @@ android {
|
|
|
671
694
|
create("react_render_mapbuffer") {
|
|
672
695
|
headers = File(prefabHeadersDir, "react_render_mapbuffer").absolutePath
|
|
673
696
|
}
|
|
697
|
+
create("react_render_textlayoutmanager") {
|
|
698
|
+
headers = File(prefabHeadersDir, "react_render_textlayoutmanager").absolutePath
|
|
699
|
+
}
|
|
674
700
|
create("yoga") { headers = File(prefabHeadersDir, "yoga").absolutePath }
|
|
675
701
|
create("folly_runtime") { headers = File(prefabHeadersDir, "folly_runtime").absolutePath }
|
|
676
702
|
create("react_nativemodule_core") {
|
|
@@ -74,10 +74,13 @@ add_library(react_cxxreactpackage ALIAS ReactAndroid::react_cxxreactpackage)
|
|
|
74
74
|
add_library(react_render_core ALIAS ReactAndroid::react_render_core)
|
|
75
75
|
add_library(react_render_graphics ALIAS ReactAndroid::react_render_graphics)
|
|
76
76
|
add_library(rrc_view ALIAS ReactAndroid::rrc_view)
|
|
77
|
+
add_library(rrc_text ALIAS ReactAndroid::rrc_text)
|
|
78
|
+
add_library(rrc_textinput ALIAS ReactAndroid::rrc_textinput)
|
|
77
79
|
add_library(jsi ALIAS ReactAndroid::jsi)
|
|
78
80
|
add_library(glog ALIAS ReactAndroid::glog)
|
|
79
81
|
add_library(fabricjni ALIAS ReactAndroid::fabricjni)
|
|
80
82
|
add_library(react_render_mapbuffer ALIAS ReactAndroid::react_render_mapbuffer)
|
|
83
|
+
add_library(react_render_textlayoutmanager ALIAS ReactAndroid::react_render_textlayoutmanager)
|
|
81
84
|
add_library(yoga ALIAS ReactAndroid::yoga)
|
|
82
85
|
add_library(folly_runtime ALIAS ReactAndroid::folly_runtime)
|
|
83
86
|
add_library(react_nativemodule_core ALIAS ReactAndroid::react_nativemodule_core)
|
|
@@ -106,8 +109,11 @@ target_link_libraries(${CMAKE_PROJECT_NAME}
|
|
|
106
109
|
react_render_graphics # prefab ready
|
|
107
110
|
react_render_imagemanager # prefab ready
|
|
108
111
|
react_render_mapbuffer # prefab ready
|
|
112
|
+
react_render_textlayoutmanager # prefab ready
|
|
109
113
|
rrc_image # prefab ready
|
|
110
114
|
rrc_view # prefab ready
|
|
115
|
+
rrc_text # prefab ready
|
|
116
|
+
rrc_textinput # prefab ready
|
|
111
117
|
rrc_legacyviewmanagerinterop # prefab ready
|
|
112
118
|
runtimeexecutor # prefab ready
|
|
113
119
|
turbomodulejsijni # prefab ready
|
|
@@ -16,6 +16,7 @@ import androidx.annotation.Nullable;
|
|
|
16
16
|
import com.facebook.infer.annotation.Assertions;
|
|
17
17
|
import com.facebook.react.config.ReactFeatureFlags;
|
|
18
18
|
import com.facebook.react.devsupport.DoubleTapReloadRecognizer;
|
|
19
|
+
import com.facebook.react.devsupport.interfaces.DevSupportManager;
|
|
19
20
|
import com.facebook.react.interfaces.fabric.ReactSurface;
|
|
20
21
|
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
|
21
22
|
|
|
@@ -139,8 +140,7 @@ public class ReactDelegate {
|
|
|
139
140
|
public void onActivityResult(
|
|
140
141
|
int requestCode, int resultCode, Intent data, boolean shouldForwardToReactInstance) {
|
|
141
142
|
if (ReactFeatureFlags.enableBridgelessArchitecture) {
|
|
142
|
-
|
|
143
|
-
return;
|
|
143
|
+
mReactHost.onActivityResult(mActivity, requestCode, resultCode, data);
|
|
144
144
|
} else {
|
|
145
145
|
if (getReactNativeHost().hasInstance() && shouldForwardToReactInstance) {
|
|
146
146
|
getReactNativeHost()
|
|
@@ -196,22 +196,28 @@ public class ReactDelegate {
|
|
|
196
196
|
* application.
|
|
197
197
|
*/
|
|
198
198
|
public boolean shouldShowDevMenuOrReload(int keyCode, KeyEvent event) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
DevSupportManager devSupportManager = null;
|
|
200
|
+
if (ReactFeatureFlags.enableBridgelessArchitecture
|
|
201
|
+
&& mReactHost != null
|
|
202
|
+
&& mReactHost.getDevSupportManager() != null) {
|
|
203
|
+
devSupportManager = mReactHost.getDevSupportManager();
|
|
202
204
|
} else if (getReactNativeHost().hasInstance()
|
|
203
205
|
&& getReactNativeHost().getUseDeveloperSupport()) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
206
|
+
devSupportManager = getReactNativeHost().getReactInstanceManager().getDevSupportManager();
|
|
207
|
+
} else {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (keyCode == KeyEvent.KEYCODE_MENU) {
|
|
212
|
+
devSupportManager.showDevOptionsDialog();
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
boolean didDoubleTapR =
|
|
216
|
+
Assertions.assertNotNull(mDoubleTapReloadRecognizer)
|
|
217
|
+
.didDoubleTapR(keyCode, mActivity.getCurrentFocus());
|
|
218
|
+
if (didDoubleTapR) {
|
|
219
|
+
devSupportManager.handleReloadJS();
|
|
220
|
+
return true;
|
|
215
221
|
}
|
|
216
222
|
return false;
|
|
217
223
|
}
|