react-native-macos 0.76.6 → 0.76.8
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.mm +0 -5
- package/Libraries/AppDelegate/RCTAppSetupUtils.h +1 -1
- package/Libraries/AppDelegate/RCTAppSetupUtils.mm +4 -2
- package/Libraries/AppDelegate/RCTRootViewFactory.mm +2 -3
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Image/RCTImageLoader.mm +9 -1
- package/Libraries/Image/RCTImageView.mm +5 -0
- package/Libraries/Image/RCTImageViewManager.mm +4 -0
- package/Libraries/Network/RCTDataRequestHandler.mm +10 -6
- package/Libraries/Network/RCTFileRequestHandler.mm +11 -7
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.mm +3 -1
- package/Libraries/Text/TextInput/RCTBaseTextInputView.mm +2 -1
- package/Libraries/Utilities/Appearance.js +3 -1
- package/React/Base/RCTRootView.m +58 -0
- package/React/Base/RCTTouchHandler.m +6 -5
- package/React/Base/RCTUIKit.h +4 -1
- package/React/Base/RCTVersion.m +1 -1
- package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm +2 -5
- package/React/Base/macOS/RCTUIKit.m +9 -2
- package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h +2 -1
- package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +8 -18
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h +3 -0
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +17 -18
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +16 -5
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +14 -11
- package/React/Views/RCTFont.h +2 -0
- package/React/Views/RCTFont.mm +4 -5
- package/React/Views/RCTView.m +2 -11
- package/React/Views/ScrollView/RCTScrollView.h +3 -1
- package/React/Views/ScrollView/RCTScrollView.m +8 -0
- package/React/Views/UIView+React.m +5 -2
- package/ReactAndroid/api/ReactAndroid.api +4 -0
- package/ReactAndroid/cmake-utils/ReactNative-application.cmake +18 -3
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.java +12 -13
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +8 -2
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java +15 -8
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +1 -7
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +1 -11
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +1 -3
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +1 -3
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +1 -12
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +1 -3
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +11 -3
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +11 -3
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt +25 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +16 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java +1 -0
- package/ReactAndroid/src/main/jni/react/fabric/Binding.cpp +17 -19
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +1 -15
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +1 -4
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +1 -5
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +1 -6
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +47 -65
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +2 -4
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +1 -5
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +1 -2
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.mm +9 -0
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +1 -6
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +1 -3
- package/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp +5 -0
- package/ReactCommon/react/renderer/attributedstring/TextAttributes.h +2 -0
- package/ReactCommon/react/renderer/attributedstring/conversions.h +5 -0
- package/ReactCommon/react/renderer/components/rncore/Props.cpp +1 -1
- package/ReactCommon/react/renderer/components/rncore/Props.h +16 -12
- package/ReactCommon/react/renderer/components/rncore/States.h +0 -26
- package/ReactCommon/react/renderer/components/text/BaseTextProps.cpp +12 -0
- package/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h +2 -3
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +8 -4
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTFontUtils.mm +31 -11
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextPrimitivesConversions.h +2 -2
- package/ReactCommon/react/renderer/uimanager/UIManager.cpp +29 -8
- package/ReactCommon/react/runtime/ReactInstance.cpp +39 -35
- package/ReactCommon/react/runtime/ReactInstance.h +2 -1
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +3 -2
- package/gradle/libs.versions.toml +1 -1
- package/jest/setup.js +5 -1
- package/package.json +8 -8
- package/scripts/cocoapods/new_architecture.rb +1 -1
- package/scripts/cocoapods/utils.rb +6 -6
- package/scripts/codegen/generate-artifacts-executor.js +68 -7
- package/src/private/featureflags/ReactNativeFeatureFlags.js +1 -6
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +1 -2
- package/Libraries/AddressSanitizerCrash/AddressSanitizerCrash.js +0 -13
- package/Libraries/AddressSanitizerCrash/NativeAddressSanitizerCrash.js +0 -19
- package/React/CoreModules/RCTAddressSanitizerCrashManager.h +0 -12
- package/React/CoreModules/RCTAddressSanitizerCrashManager.mm +0 -18
package/React/Views/RCTFont.h
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
#import <React/RCTConvert.h>
|
|
11
11
|
|
|
12
12
|
typedef UIFont * (^RCTFontHandler)(CGFloat fontSize, NSString *fontWeightDescription);
|
|
13
|
+
typedef CGFloat RCTFontWeight;
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* React Native will use the System font for rendering by default. If you want to
|
|
@@ -19,6 +20,7 @@ typedef UIFont * (^RCTFontHandler)(CGFloat fontSize, NSString *fontWeightDescrip
|
|
|
19
20
|
*/
|
|
20
21
|
RCT_EXTERN void RCTSetDefaultFontHandler(RCTFontHandler handler);
|
|
21
22
|
RCT_EXTERN BOOL RCTHasFontHandlerSet(void);
|
|
23
|
+
RCT_EXTERN RCTFontWeight RCTGetFontWeight(UIFont *font);
|
|
22
24
|
|
|
23
25
|
@interface RCTFont : NSObject
|
|
24
26
|
|
package/React/Views/RCTFont.mm
CHANGED
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
#import <CoreText/CoreText.h>
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
static RCTFontWeight weightOfFont(UIFont *font)
|
|
14
|
+
RCTFontWeight RCTGetFontWeight(UIFont *font)
|
|
16
15
|
{
|
|
17
16
|
static NSArray<NSString *> *weightSuffixes;
|
|
18
17
|
static NSArray<NSNumber *> *fontWeights;
|
|
@@ -419,7 +418,7 @@ RCT_ARRAY_CONVERTER(RCTFontVariantDescriptor)
|
|
|
419
418
|
if (font) {
|
|
420
419
|
familyName = font.familyName ?: defaultFontFamily;
|
|
421
420
|
fontSize = font.pointSize ?: defaultFontSize;
|
|
422
|
-
fontWeight =
|
|
421
|
+
fontWeight = RCTGetFontWeight(font);
|
|
423
422
|
isItalic = isItalicFont(font);
|
|
424
423
|
isCondensed = isCondensedFont(font);
|
|
425
424
|
}
|
|
@@ -467,7 +466,7 @@ RCT_ARRAY_CONVERTER(RCTFontVariantDescriptor)
|
|
|
467
466
|
// It's actually a font name, not a font family name,
|
|
468
467
|
// but we'll do what was meant, not what was said.
|
|
469
468
|
familyName = font.familyName;
|
|
470
|
-
fontWeight = weight ? fontWeight :
|
|
469
|
+
fontWeight = weight ? fontWeight : RCTGetFontWeight(font);
|
|
471
470
|
isItalic = style ? isItalic : isItalicFont(font);
|
|
472
471
|
isCondensed = isCondensedFont(font);
|
|
473
472
|
} else {
|
|
@@ -493,7 +492,7 @@ RCT_ARRAY_CONVERTER(RCTFontVariantDescriptor)
|
|
|
493
492
|
for (NSString *name in names) {
|
|
494
493
|
UIFont *match = [UIFont fontWithName:name size:fontSize];
|
|
495
494
|
if (isItalic == isItalicFont(match) && isCondensed == isCondensedFont(match)) {
|
|
496
|
-
CGFloat testWeight =
|
|
495
|
+
CGFloat testWeight = RCTGetFontWeight(match);
|
|
497
496
|
if (ABS(testWeight - fontWeight) < ABS(closestWeight - fontWeight)) {
|
|
498
497
|
font = match;
|
|
499
498
|
closestWeight = testWeight;
|
package/React/Views/RCTView.m
CHANGED
|
@@ -252,17 +252,8 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : unused)
|
|
|
252
252
|
// of the hit view will return YES from -pointInside:withEvent:). See:
|
|
253
253
|
// - https://developer.apple.com/library/ios/qa/qa2013/qa1812.html
|
|
254
254
|
for (RCTUIView *subview in [sortedSubviews reverseObjectEnumerator]) { // [macOS]
|
|
255
|
-
CGPoint pointForHitTest =
|
|
256
|
-
|
|
257
|
-
pointForHitTest = [subview convertPoint:point fromView:self];
|
|
258
|
-
#else // [macOS
|
|
259
|
-
if ([subview isKindOfClass:[RCTView class]]) {
|
|
260
|
-
pointForHitTest = [subview convertPoint:point fromView:self];
|
|
261
|
-
} else {
|
|
262
|
-
pointForHitTest = point;
|
|
263
|
-
}
|
|
264
|
-
#endif // macOS]
|
|
265
|
-
hitSubview = RCTUIViewHitTestWithEvent(subview, pointForHitTest, event); // macOS]
|
|
255
|
+
CGPoint pointForHitTest = [subview convertPoint:point fromView:self];
|
|
256
|
+
hitSubview = RCTUIViewHitTestWithEvent(subview, pointForHitTest, event); // [macOS]
|
|
266
257
|
if (hitSubview != nil) {
|
|
267
258
|
break;
|
|
268
259
|
}
|
|
@@ -57,8 +57,10 @@
|
|
|
57
57
|
@property (nonatomic, assign) BOOL inverted;
|
|
58
58
|
/** Focus area of newly-activated text input relative to the window to compare against UIKeyboardFrameBegin/End */
|
|
59
59
|
@property (nonatomic, assign) CGRect firstResponderFocus;
|
|
60
|
-
|
|
60
|
+
/** newly-activated text input outside of the scroll view */
|
|
61
|
+
@property (nonatomic, weak) RCTPlatformView *firstResponderViewOutsideScrollView; // [macOS]
|
|
61
62
|
|
|
63
|
+
@property (nonatomic, assign) BOOL hasOverlayStyleIndicator; // [macOS]
|
|
62
64
|
|
|
63
65
|
// NOTE: currently these event props are only declared so we can export the
|
|
64
66
|
// event names to JS - we don't call the blocks directly because scroll events
|
|
@@ -455,6 +455,14 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
|
|
|
455
455
|
if (!didFocusExternalTextField && focusEnd > endFrame.origin.y) {
|
|
456
456
|
// Text field active region is below visible area with keyboard - update diff to bring into view
|
|
457
457
|
contentDiff = endFrame.origin.y - focusEnd;
|
|
458
|
+
} else {
|
|
459
|
+
#if TARGET_OS_IOS // [visionOS]
|
|
460
|
+
UIView *inputAccessoryView = _firstResponderViewOutsideScrollView.inputAccessoryView;
|
|
461
|
+
if (inputAccessoryView) {
|
|
462
|
+
// Text input view is within the inputAccessoryView.
|
|
463
|
+
contentDiff = endFrame.origin.y - beginFrame.origin.y;
|
|
464
|
+
}
|
|
465
|
+
#endif // [visionOS]
|
|
458
466
|
}
|
|
459
467
|
} else if (endFrame.origin.y <= beginFrame.origin.y) {
|
|
460
468
|
// Keyboard opened for other reason
|
|
@@ -573,10 +573,13 @@ static __weak RCTPlatformView *_pendingFocusView; // [macOS]
|
|
|
573
573
|
|
|
574
574
|
// [macOS
|
|
575
575
|
#pragma mark - Hit testing
|
|
576
|
-
#if TARGET_OS_OSX
|
|
576
|
+
#if TARGET_OS_OSX
|
|
577
|
+
// IMPORTANT -- point is in local coordinate space, unlike the hitTest: version from OSX which is in super's coordinate space
|
|
577
578
|
- (RCTPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
|
|
578
579
|
{
|
|
579
|
-
|
|
580
|
+
NSView *superview = [self superview];
|
|
581
|
+
NSPoint pointInSuper = superview != nil ? [self convertPoint:point toView:superview] : point;
|
|
582
|
+
return [self hitTest:pointInSuper];
|
|
580
583
|
}
|
|
581
584
|
#endif // macOS]
|
|
582
585
|
|
|
@@ -7280,6 +7280,8 @@ public final class com/facebook/react/views/scroll/ReactScrollViewHelper {
|
|
|
7280
7280
|
public static final field SNAP_ALIGNMENT_END I
|
|
7281
7281
|
public static final field SNAP_ALIGNMENT_START I
|
|
7282
7282
|
public static final fun addScrollListener (Lcom/facebook/react/views/scroll/ReactScrollViewHelper$ScrollListener;)V
|
|
7283
|
+
public static final fun dispatchMomentumEndOnAnimationEnd (Landroid/view/ViewGroup;)V
|
|
7284
|
+
public static final fun emitLayoutChangeEvent (Landroid/view/ViewGroup;)V
|
|
7283
7285
|
public static final fun emitLayoutEvent (Landroid/view/ViewGroup;)V
|
|
7284
7286
|
public static final fun emitScrollBeginDragEvent (Landroid/view/ViewGroup;)V
|
|
7285
7287
|
public static final fun emitScrollEndDragEvent (Landroid/view/ViewGroup;FF)V
|
|
@@ -7857,6 +7859,7 @@ public class com/facebook/react/views/text/TextAttributeProps {
|
|
|
7857
7859
|
public static final field TA_KEY_LETTER_SPACING S
|
|
7858
7860
|
public static final field TA_KEY_LINE_BREAK_STRATEGY S
|
|
7859
7861
|
public static final field TA_KEY_LINE_HEIGHT S
|
|
7862
|
+
public static final field TA_KEY_MAX_FONT_SIZE_MULTIPLIER S
|
|
7860
7863
|
public static final field TA_KEY_OPACITY S
|
|
7861
7864
|
public static final field TA_KEY_ROLE S
|
|
7862
7865
|
public static final field TA_KEY_TEXT_DECORATION_COLOR S
|
|
@@ -7889,6 +7892,7 @@ public class com/facebook/react/views/text/TextAttributeProps {
|
|
|
7889
7892
|
protected field mLetterSpacingInput F
|
|
7890
7893
|
protected field mLineHeight F
|
|
7891
7894
|
protected field mLineHeightInput F
|
|
7895
|
+
protected field mMaxFontSizeMultiplier F
|
|
7892
7896
|
protected field mNumberOfLines I
|
|
7893
7897
|
protected field mOpacity F
|
|
7894
7898
|
protected field mRole Lcom/facebook/react/uimanager/ReactAccessibilityDelegate$Role;
|
|
@@ -34,9 +34,24 @@ set(BUILD_DIR ${PROJECT_BUILD_DIR})
|
|
|
34
34
|
file(TO_CMAKE_PATH "${BUILD_DIR}" BUILD_DIR)
|
|
35
35
|
file(TO_CMAKE_PATH "${REACT_ANDROID_DIR}" REACT_ANDROID_DIR)
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
if (PROJECT_ROOT_DIR)
|
|
38
|
+
# This empty `if` is just to silence a CMake warning and make sure the `PROJECT_ROOT_DIR`
|
|
39
|
+
# variable is defined if user need to access it.
|
|
40
|
+
endif ()
|
|
41
|
+
|
|
42
|
+
file(GLOB override_cpp_SRC CONFIGURE_DEPENDS *.cpp)
|
|
43
|
+
# We check if the user is providing a custom OnLoad.cpp file. If so, we pick that
|
|
44
|
+
# for compilation. Otherwise we fallback to using the `default-app-setup/OnLoad.cpp`
|
|
45
|
+
# file instead.
|
|
46
|
+
if(override_cpp_SRC)
|
|
47
|
+
file(GLOB input_SRC CONFIGURE_DEPENDS
|
|
48
|
+
*.cpp
|
|
49
|
+
${BUILD_DIR}/generated/autolinking/src/main/jni/*.cpp)
|
|
50
|
+
else()
|
|
51
|
+
file(GLOB input_SRC CONFIGURE_DEPENDS
|
|
52
|
+
${REACT_ANDROID_DIR}/cmake-utils/default-app-setup/*.cpp
|
|
53
|
+
${BUILD_DIR}/generated/autolinking/src/main/jni/*.cpp)
|
|
54
|
+
endif()
|
|
40
55
|
|
|
41
56
|
add_library(${CMAKE_PROJECT_NAME} SHARED ${input_SRC})
|
|
42
57
|
|
|
@@ -179,31 +179,30 @@ public abstract class HeadlessJsTaskService extends Service implements HeadlessJ
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
private void createReactContextAndScheduleTask(final HeadlessJsTaskConfig taskConfig) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
final ReactInstanceManager reactInstanceManager =
|
|
186
|
-
getReactNativeHost().getReactInstanceManager();
|
|
187
|
-
|
|
188
|
-
reactInstanceManager.addReactInstanceEventListener(
|
|
182
|
+
if (ReactFeatureFlags.enableBridgelessArchitecture) {
|
|
183
|
+
final ReactHost reactHost = getReactHost();
|
|
184
|
+
reactHost.addReactInstanceEventListener(
|
|
189
185
|
new ReactInstanceEventListener() {
|
|
190
186
|
@Override
|
|
191
187
|
public void onReactContextInitialized(@NonNull ReactContext reactContext) {
|
|
192
188
|
invokeStartTask(reactContext, taskConfig);
|
|
193
|
-
|
|
189
|
+
reactHost.removeReactInstanceEventListener(this);
|
|
194
190
|
}
|
|
195
191
|
});
|
|
196
|
-
|
|
197
|
-
} else {
|
|
198
|
-
|
|
192
|
+
reactHost.start();
|
|
193
|
+
} else {
|
|
194
|
+
final ReactInstanceManager reactInstanceManager =
|
|
195
|
+
getReactNativeHost().getReactInstanceManager();
|
|
196
|
+
|
|
197
|
+
reactInstanceManager.addReactInstanceEventListener(
|
|
199
198
|
new ReactInstanceEventListener() {
|
|
200
199
|
@Override
|
|
201
200
|
public void onReactContextInitialized(@NonNull ReactContext reactContext) {
|
|
202
201
|
invokeStartTask(reactContext, taskConfig);
|
|
203
|
-
|
|
202
|
+
reactInstanceManager.removeReactInstanceEventListener(this);
|
|
204
203
|
}
|
|
205
204
|
});
|
|
206
|
-
|
|
205
|
+
reactInstanceManager.createReactContextInBackground();
|
|
207
206
|
}
|
|
208
207
|
}
|
|
209
208
|
}
|
|
@@ -449,12 +449,18 @@ public class FabricUIManager
|
|
|
449
449
|
|
|
450
450
|
@Override
|
|
451
451
|
public void markActiveTouchForTag(int surfaceId, int reactTag) {
|
|
452
|
-
mMountingManager.getSurfaceManager(surfaceId)
|
|
452
|
+
SurfaceMountingManager surfaceMountingManager = mMountingManager.getSurfaceManager(surfaceId);
|
|
453
|
+
if (surfaceMountingManager != null) {
|
|
454
|
+
surfaceMountingManager.markActiveTouchForTag(reactTag);
|
|
455
|
+
}
|
|
453
456
|
}
|
|
454
457
|
|
|
455
458
|
@Override
|
|
456
459
|
public void sweepActiveTouchForTag(int surfaceId, int reactTag) {
|
|
457
|
-
mMountingManager.getSurfaceManager(surfaceId)
|
|
460
|
+
SurfaceMountingManager surfaceMountingManager = mMountingManager.getSurfaceManager(surfaceId);
|
|
461
|
+
if (surfaceMountingManager != null) {
|
|
462
|
+
surfaceMountingManager.sweepActiveTouchForTag(reactTag);
|
|
463
|
+
}
|
|
458
464
|
}
|
|
459
465
|
|
|
460
466
|
/**
|
|
@@ -330,14 +330,11 @@ public class MountingManager {
|
|
|
330
330
|
@AnyThread
|
|
331
331
|
@ThreadConfined(ANY)
|
|
332
332
|
public @Nullable EventEmitterWrapper getEventEmitter(int surfaceId, int reactTag) {
|
|
333
|
-
SurfaceMountingManager
|
|
334
|
-
|
|
335
|
-
? getSurfaceManagerForView(reactTag)
|
|
336
|
-
: getSurfaceManager(surfaceId));
|
|
337
|
-
if (surfaceMountingManager == null) {
|
|
333
|
+
SurfaceMountingManager smm = getSurfaceMountingManager(surfaceId, reactTag);
|
|
334
|
+
if (smm == null) {
|
|
338
335
|
return null;
|
|
339
336
|
}
|
|
340
|
-
return
|
|
337
|
+
return smm.getEventEmitter(reactTag);
|
|
341
338
|
}
|
|
342
339
|
|
|
343
340
|
/**
|
|
@@ -434,11 +431,21 @@ public class MountingManager {
|
|
|
434
431
|
boolean canCoalesceEvent,
|
|
435
432
|
@Nullable WritableMap params,
|
|
436
433
|
@EventCategoryDef int eventCategory) {
|
|
437
|
-
|
|
434
|
+
SurfaceMountingManager smm = getSurfaceMountingManager(surfaceId, reactTag);
|
|
438
435
|
if (smm == null) {
|
|
439
|
-
|
|
436
|
+
FLog.d(
|
|
437
|
+
TAG,
|
|
438
|
+
"Cannot queue event without valid surface mounting manager for tag: %d, surfaceId: %d",
|
|
439
|
+
reactTag,
|
|
440
|
+
surfaceId);
|
|
440
441
|
return;
|
|
441
442
|
}
|
|
442
443
|
smm.enqueuePendingEvent(reactTag, eventName, canCoalesceEvent, params, eventCategory);
|
|
443
444
|
}
|
|
445
|
+
|
|
446
|
+
private @Nullable SurfaceMountingManager getSurfaceMountingManager(int surfaceId, int reactTag) {
|
|
447
|
+
return (surfaceId == ViewUtil.NO_SURFACE_ID
|
|
448
|
+
? getSurfaceManagerForView(reactTag)
|
|
449
|
+
: getSurfaceManager(surfaceId));
|
|
450
|
+
}
|
|
444
451
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<89491eb63a7ca59b17419ed4432a4f88>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -34,12 +34,6 @@ public object ReactNativeFeatureFlags {
|
|
|
34
34
|
@JvmStatic
|
|
35
35
|
public fun commonTestFlag(): Boolean = accessor.commonTestFlag()
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
* Adds support for recursively processing commits that mount synchronously (Android only).
|
|
39
|
-
*/
|
|
40
|
-
@JvmStatic
|
|
41
|
-
public fun allowRecursiveCommitsWithSynchronousMountOnAndroid(): Boolean = accessor.allowRecursiveCommitsWithSynchronousMountOnAndroid()
|
|
42
|
-
|
|
43
37
|
/**
|
|
44
38
|
* When enabled, the RuntimeScheduler processing the event loop will batch all rendering updates and dispatch them together at the end of each iteration of the loop.
|
|
45
39
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<9f741ec3df7cd5ecd8d5c3c099c86aba>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -21,7 +21,6 @@ package com.facebook.react.internal.featureflags
|
|
|
21
21
|
|
|
22
22
|
public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccessor {
|
|
23
23
|
private var commonTestFlagCache: Boolean? = null
|
|
24
|
-
private var allowRecursiveCommitsWithSynchronousMountOnAndroidCache: Boolean? = null
|
|
25
24
|
private var batchRenderingUpdatesInEventLoopCache: Boolean? = null
|
|
26
25
|
private var completeReactInstanceCreationOnBgThreadOnAndroidCache: Boolean? = null
|
|
27
26
|
private var destroyFabricSurfacesInReactInstanceManagerCache: Boolean? = null
|
|
@@ -78,15 +77,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
|
|
|
78
77
|
return cached
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
override fun allowRecursiveCommitsWithSynchronousMountOnAndroid(): Boolean {
|
|
82
|
-
var cached = allowRecursiveCommitsWithSynchronousMountOnAndroidCache
|
|
83
|
-
if (cached == null) {
|
|
84
|
-
cached = ReactNativeFeatureFlagsCxxInterop.allowRecursiveCommitsWithSynchronousMountOnAndroid()
|
|
85
|
-
allowRecursiveCommitsWithSynchronousMountOnAndroidCache = cached
|
|
86
|
-
}
|
|
87
|
-
return cached
|
|
88
|
-
}
|
|
89
|
-
|
|
90
80
|
override fun batchRenderingUpdatesInEventLoop(): Boolean {
|
|
91
81
|
var cached = batchRenderingUpdatesInEventLoopCache
|
|
92
82
|
if (cached == null) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<774337b6aee6f528b0852704271ed96f>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -30,8 +30,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
|
|
|
30
30
|
|
|
31
31
|
@DoNotStrip @JvmStatic public external fun commonTestFlag(): Boolean
|
|
32
32
|
|
|
33
|
-
@DoNotStrip @JvmStatic public external fun allowRecursiveCommitsWithSynchronousMountOnAndroid(): Boolean
|
|
34
|
-
|
|
35
33
|
@DoNotStrip @JvmStatic public external fun batchRenderingUpdatesInEventLoop(): Boolean
|
|
36
34
|
|
|
37
35
|
@DoNotStrip @JvmStatic public external fun completeReactInstanceCreationOnBgThreadOnAndroid(): Boolean
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<43c4ba7a6c4f5a12ada181c081f91bfc>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -25,8 +25,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
|
|
|
25
25
|
|
|
26
26
|
override fun commonTestFlag(): Boolean = false
|
|
27
27
|
|
|
28
|
-
override fun allowRecursiveCommitsWithSynchronousMountOnAndroid(): Boolean = false
|
|
29
|
-
|
|
30
28
|
override fun batchRenderingUpdatesInEventLoop(): Boolean = false
|
|
31
29
|
|
|
32
30
|
override fun completeReactInstanceCreationOnBgThreadOnAndroid(): Boolean = false
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<0ca6ebf7ef1418d721b6f183f89b96a2>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -25,7 +25,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
|
|
|
25
25
|
private val accessedFeatureFlags = mutableSetOf<String>()
|
|
26
26
|
|
|
27
27
|
private var commonTestFlagCache: Boolean? = null
|
|
28
|
-
private var allowRecursiveCommitsWithSynchronousMountOnAndroidCache: Boolean? = null
|
|
29
28
|
private var batchRenderingUpdatesInEventLoopCache: Boolean? = null
|
|
30
29
|
private var completeReactInstanceCreationOnBgThreadOnAndroidCache: Boolean? = null
|
|
31
30
|
private var destroyFabricSurfacesInReactInstanceManagerCache: Boolean? = null
|
|
@@ -83,16 +82,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
|
|
|
83
82
|
return cached
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
override fun allowRecursiveCommitsWithSynchronousMountOnAndroid(): Boolean {
|
|
87
|
-
var cached = allowRecursiveCommitsWithSynchronousMountOnAndroidCache
|
|
88
|
-
if (cached == null) {
|
|
89
|
-
cached = currentProvider.allowRecursiveCommitsWithSynchronousMountOnAndroid()
|
|
90
|
-
accessedFeatureFlags.add("allowRecursiveCommitsWithSynchronousMountOnAndroid")
|
|
91
|
-
allowRecursiveCommitsWithSynchronousMountOnAndroidCache = cached
|
|
92
|
-
}
|
|
93
|
-
return cached
|
|
94
|
-
}
|
|
95
|
-
|
|
96
85
|
override fun batchRenderingUpdatesInEventLoop(): Boolean {
|
|
97
86
|
var cached = batchRenderingUpdatesInEventLoopCache
|
|
98
87
|
if (cached == null) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<94e1e69be22ec978859e3f242610f21b>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -25,8 +25,6 @@ import com.facebook.proguard.annotations.DoNotStrip
|
|
|
25
25
|
public interface ReactNativeFeatureFlagsProvider {
|
|
26
26
|
@DoNotStrip public fun commonTestFlag(): Boolean
|
|
27
27
|
|
|
28
|
-
@DoNotStrip public fun allowRecursiveCommitsWithSynchronousMountOnAndroid(): Boolean
|
|
29
|
-
|
|
30
28
|
@DoNotStrip public fun batchRenderingUpdatesInEventLoop(): Boolean
|
|
31
29
|
|
|
32
30
|
@DoNotStrip public fun completeReactInstanceCreationOnBgThreadOnAndroid(): Boolean
|
package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java
CHANGED
|
@@ -1544,12 +1544,20 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
|
|
|
1544
1544
|
DEFAULT_FLING_ANIMATOR.cancel();
|
|
1545
1545
|
|
|
1546
1546
|
// Update the fling animator with new values
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
.setIntValues(start, end);
|
|
1547
|
+
int duration = ReactScrollViewHelper.getDefaultScrollAnimationDuration(getContext());
|
|
1548
|
+
DEFAULT_FLING_ANIMATOR.setDuration(duration).setIntValues(start, end);
|
|
1550
1549
|
|
|
1551
1550
|
// Start the animator
|
|
1552
1551
|
DEFAULT_FLING_ANIMATOR.start();
|
|
1552
|
+
|
|
1553
|
+
if (mSendMomentumEvents) {
|
|
1554
|
+
int xVelocity = 0;
|
|
1555
|
+
if (duration > 0) {
|
|
1556
|
+
xVelocity = (end - start) / duration;
|
|
1557
|
+
}
|
|
1558
|
+
ReactScrollViewHelper.emitScrollMomentumBeginEvent(this, xVelocity, 0);
|
|
1559
|
+
ReactScrollViewHelper.dispatchMomentumEndOnAnimationEnd(this);
|
|
1560
|
+
}
|
|
1553
1561
|
}
|
|
1554
1562
|
|
|
1555
1563
|
@Override
|
|
@@ -1358,12 +1358,20 @@ public class ReactScrollView extends ScrollView
|
|
|
1358
1358
|
DEFAULT_FLING_ANIMATOR.cancel();
|
|
1359
1359
|
|
|
1360
1360
|
// Update the fling animator with new values
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
.setIntValues(start, end);
|
|
1361
|
+
int duration = ReactScrollViewHelper.getDefaultScrollAnimationDuration(getContext());
|
|
1362
|
+
DEFAULT_FLING_ANIMATOR.setDuration(duration).setIntValues(start, end);
|
|
1364
1363
|
|
|
1365
1364
|
// Start the animator
|
|
1366
1365
|
DEFAULT_FLING_ANIMATOR.start();
|
|
1366
|
+
|
|
1367
|
+
if (mSendMomentumEvents) {
|
|
1368
|
+
int yVelocity = 0;
|
|
1369
|
+
if (duration > 0) {
|
|
1370
|
+
yVelocity = (end - start) / duration;
|
|
1371
|
+
}
|
|
1372
|
+
ReactScrollViewHelper.emitScrollMomentumBeginEvent(this, 0, yVelocity);
|
|
1373
|
+
ReactScrollViewHelper.dispatchMomentumEndOnAnimationEnd(this);
|
|
1374
|
+
}
|
|
1367
1375
|
}
|
|
1368
1376
|
|
|
1369
1377
|
@NonNull
|
|
@@ -412,6 +412,31 @@ public object ReactScrollViewHelper {
|
|
|
412
412
|
})
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
+
@JvmStatic
|
|
416
|
+
public fun <T> dispatchMomentumEndOnAnimationEnd(scrollView: T) where
|
|
417
|
+
T : HasFlingAnimator?,
|
|
418
|
+
T : HasScrollEventThrottle?,
|
|
419
|
+
T : ViewGroup {
|
|
420
|
+
scrollView
|
|
421
|
+
.getFlingAnimator()
|
|
422
|
+
.addListener(
|
|
423
|
+
object : Animator.AnimatorListener {
|
|
424
|
+
override fun onAnimationStart(animator: Animator) = Unit
|
|
425
|
+
|
|
426
|
+
override fun onAnimationEnd(animator: Animator) {
|
|
427
|
+
emitScrollMomentumEndEvent(scrollView)
|
|
428
|
+
animator.removeListener(this)
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
override fun onAnimationCancel(animator: Animator) {
|
|
432
|
+
emitScrollMomentumEndEvent(scrollView)
|
|
433
|
+
animator.removeListener(this)
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
override fun onAnimationRepeat(animator: Animator) = Unit
|
|
437
|
+
})
|
|
438
|
+
}
|
|
439
|
+
|
|
415
440
|
@JvmStatic
|
|
416
441
|
public fun <T> predictFinalScrollPosition(
|
|
417
442
|
scrollView: T,
|
|
@@ -61,6 +61,7 @@ public class TextAttributeProps {
|
|
|
61
61
|
public static final short TA_KEY_LINE_BREAK_STRATEGY = 25;
|
|
62
62
|
public static final short TA_KEY_ROLE = 26;
|
|
63
63
|
public static final short TA_KEY_TEXT_TRANSFORM = 27;
|
|
64
|
+
public static final short TA_KEY_MAX_FONT_SIZE_MULTIPLIER = 29;
|
|
64
65
|
|
|
65
66
|
public static final int UNSET = -1;
|
|
66
67
|
|
|
@@ -81,6 +82,7 @@ public class TextAttributeProps {
|
|
|
81
82
|
protected float mLineHeight = Float.NaN;
|
|
82
83
|
protected boolean mIsColorSet = false;
|
|
83
84
|
protected boolean mAllowFontScaling = true;
|
|
85
|
+
protected float mMaxFontSizeMultiplier = Float.NaN;
|
|
84
86
|
protected int mColor;
|
|
85
87
|
protected boolean mIsBackgroundColorSet = false;
|
|
86
88
|
protected int mBackgroundColor;
|
|
@@ -227,6 +229,9 @@ public class TextAttributeProps {
|
|
|
227
229
|
case TA_KEY_TEXT_TRANSFORM:
|
|
228
230
|
result.setTextTransform(entry.getStringValue());
|
|
229
231
|
break;
|
|
232
|
+
case TA_KEY_MAX_FONT_SIZE_MULTIPLIER:
|
|
233
|
+
result.setMaxFontSizeMultiplier((float) entry.getDoubleValue());
|
|
234
|
+
break;
|
|
230
235
|
}
|
|
231
236
|
}
|
|
232
237
|
|
|
@@ -243,6 +248,8 @@ public class TextAttributeProps {
|
|
|
243
248
|
result.setLineHeight(getFloatProp(props, ViewProps.LINE_HEIGHT, ReactConstants.UNSET));
|
|
244
249
|
result.setLetterSpacing(getFloatProp(props, ViewProps.LETTER_SPACING, Float.NaN));
|
|
245
250
|
result.setAllowFontScaling(getBooleanProp(props, ViewProps.ALLOW_FONT_SCALING, true));
|
|
251
|
+
result.setMaxFontSizeMultiplier(
|
|
252
|
+
getFloatProp(props, ViewProps.MAX_FONT_SIZE_MULTIPLIER, Float.NaN));
|
|
246
253
|
result.setFontSize(getFloatProp(props, ViewProps.FONT_SIZE, ReactConstants.UNSET));
|
|
247
254
|
result.setColor(props.hasKey(ViewProps.COLOR) ? props.getInt(ViewProps.COLOR, 0) : null);
|
|
248
255
|
result.setColor(
|
|
@@ -411,7 +418,14 @@ public class TextAttributeProps {
|
|
|
411
418
|
mAllowFontScaling = allowFontScaling;
|
|
412
419
|
setFontSize(mFontSizeInput);
|
|
413
420
|
setLineHeight(mLineHeightInput);
|
|
414
|
-
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
private void setMaxFontSizeMultiplier(float maxFontSizeMultiplier) {
|
|
425
|
+
if (maxFontSizeMultiplier != mMaxFontSizeMultiplier) {
|
|
426
|
+
mMaxFontSizeMultiplier = maxFontSizeMultiplier;
|
|
427
|
+
setFontSize(mFontSizeInput);
|
|
428
|
+
setLineHeight(mLineHeightInput);
|
|
415
429
|
}
|
|
416
430
|
}
|
|
417
431
|
|
|
@@ -420,7 +434,7 @@ public class TextAttributeProps {
|
|
|
420
434
|
if (fontSize != ReactConstants.UNSET) {
|
|
421
435
|
fontSize =
|
|
422
436
|
mAllowFontScaling
|
|
423
|
-
? (float) Math.ceil(PixelUtil.toPixelFromSP(fontSize))
|
|
437
|
+
? (float) Math.ceil(PixelUtil.toPixelFromSP(fontSize, mMaxFontSizeMultiplier))
|
|
424
438
|
: (float) Math.ceil(PixelUtil.toPixelFromDIP(fontSize));
|
|
425
439
|
}
|
|
426
440
|
mFontSize = (int) fontSize;
|
|
@@ -501,27 +501,25 @@ void Binding::schedulerShouldRenderTransactions(
|
|
|
501
501
|
return;
|
|
502
502
|
}
|
|
503
503
|
|
|
504
|
-
if (ReactNativeFeatureFlags::
|
|
505
|
-
allowRecursiveCommitsWithSynchronousMountOnAndroid()) {
|
|
506
|
-
std::vector<MountingTransaction> pendingTransactions;
|
|
507
|
-
|
|
508
|
-
{
|
|
509
|
-
// Retain the lock to access the pending transactions but not to execute
|
|
510
|
-
// the mount operations because that method can call into this method
|
|
511
|
-
// again.
|
|
512
|
-
std::unique_lock<std::mutex> lock(pendingTransactionsMutex_);
|
|
513
|
-
pendingTransactions_.swap(pendingTransactions);
|
|
514
|
-
}
|
|
515
504
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
505
|
+
std::vector<MountingTransaction> pendingTransactions;
|
|
506
|
+
|
|
507
|
+
{
|
|
508
|
+
// Retain the lock to access the pending transactions but not to execute
|
|
509
|
+
// the mount operations because that method can call into this method
|
|
510
|
+
// again.
|
|
511
|
+
//
|
|
512
|
+
// This can be re-entrant when mounting manager triggers state updates
|
|
513
|
+
// synchronously (this can happen when committing from the UI thread).
|
|
514
|
+
// This is safe because we're already combining all the transactions for the
|
|
515
|
+
// same surface ID in a single transaction in the pending transactions list,
|
|
516
|
+
// so operations won't run out of order.
|
|
520
517
|
std::unique_lock<std::mutex> lock(pendingTransactionsMutex_);
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
518
|
+
pendingTransactions_.swap(pendingTransactions);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
for (auto& transaction : pendingTransactions) {
|
|
522
|
+
mountingManager->executeMount(transaction);
|
|
525
523
|
}
|
|
526
524
|
}
|
|
527
525
|
|