react-native-macos 0.76.6 → 0.76.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/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 -3
- package/Libraries/Network/RCTFileRequestHandler.mm +11 -4
- 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/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm +2354 -0
- package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +2820 -0
- 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
|
@@ -256,6 +256,10 @@ static inline std::string toString(const ModalHostViewPresentationStyle &value)
|
|
|
256
256
|
}
|
|
257
257
|
using ModalHostViewSupportedOrientationsMask = uint32_t;
|
|
258
258
|
|
|
259
|
+
struct ModalHostViewSupportedOrientationsMaskWrapped {
|
|
260
|
+
ModalHostViewSupportedOrientationsMask value;
|
|
261
|
+
};
|
|
262
|
+
|
|
259
263
|
enum class ModalHostViewSupportedOrientations: ModalHostViewSupportedOrientationsMask {
|
|
260
264
|
Portrait = 1 << 0,
|
|
261
265
|
PortraitUpsideDown = 1 << 1,
|
|
@@ -282,50 +286,50 @@ constexpr void operator|=(
|
|
|
282
286
|
lhs = lhs | static_cast<ModalHostViewSupportedOrientationsMask>(rhs);
|
|
283
287
|
}
|
|
284
288
|
|
|
285
|
-
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value,
|
|
289
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewSupportedOrientationsMaskWrapped &wrapped) {
|
|
286
290
|
auto items = std::vector<std::string>{value};
|
|
287
291
|
for (const auto &item : items) {
|
|
288
292
|
if (item == "portrait") {
|
|
289
|
-
|
|
293
|
+
wrapped.value |= ModalHostViewSupportedOrientations::Portrait;
|
|
290
294
|
continue;
|
|
291
295
|
}
|
|
292
296
|
if (item == "portrait-upside-down") {
|
|
293
|
-
|
|
297
|
+
wrapped.value |= ModalHostViewSupportedOrientations::PortraitUpsideDown;
|
|
294
298
|
continue;
|
|
295
299
|
}
|
|
296
300
|
if (item == "landscape") {
|
|
297
|
-
|
|
301
|
+
wrapped.value |= ModalHostViewSupportedOrientations::Landscape;
|
|
298
302
|
continue;
|
|
299
303
|
}
|
|
300
304
|
if (item == "landscape-left") {
|
|
301
|
-
|
|
305
|
+
wrapped.value |= ModalHostViewSupportedOrientations::LandscapeLeft;
|
|
302
306
|
continue;
|
|
303
307
|
}
|
|
304
308
|
if (item == "landscape-right") {
|
|
305
|
-
|
|
309
|
+
wrapped.value |= ModalHostViewSupportedOrientations::LandscapeRight;
|
|
306
310
|
continue;
|
|
307
311
|
}
|
|
308
312
|
abort();
|
|
309
313
|
}
|
|
310
314
|
}
|
|
311
315
|
|
|
312
|
-
static inline std::string toString(const
|
|
316
|
+
static inline std::string toString(const ModalHostViewSupportedOrientationsMaskWrapped &wrapped) {
|
|
313
317
|
auto result = std::string{};
|
|
314
318
|
auto separator = std::string{", "};
|
|
315
319
|
|
|
316
|
-
if (value & ModalHostViewSupportedOrientations::Portrait) {
|
|
320
|
+
if (wrapped.value & ModalHostViewSupportedOrientations::Portrait) {
|
|
317
321
|
result += "portrait" + separator;
|
|
318
322
|
}
|
|
319
|
-
if (value & ModalHostViewSupportedOrientations::PortraitUpsideDown) {
|
|
323
|
+
if (wrapped.value & ModalHostViewSupportedOrientations::PortraitUpsideDown) {
|
|
320
324
|
result += "portrait-upside-down" + separator;
|
|
321
325
|
}
|
|
322
|
-
if (value & ModalHostViewSupportedOrientations::Landscape) {
|
|
326
|
+
if (wrapped.value & ModalHostViewSupportedOrientations::Landscape) {
|
|
323
327
|
result += "landscape" + separator;
|
|
324
328
|
}
|
|
325
|
-
if (value & ModalHostViewSupportedOrientations::LandscapeLeft) {
|
|
329
|
+
if (wrapped.value & ModalHostViewSupportedOrientations::LandscapeLeft) {
|
|
326
330
|
result += "landscape-left" + separator;
|
|
327
331
|
}
|
|
328
|
-
if (value & ModalHostViewSupportedOrientations::LandscapeRight) {
|
|
332
|
+
if (wrapped.value & ModalHostViewSupportedOrientations::LandscapeRight) {
|
|
329
333
|
result += "landscape-right" + separator;
|
|
330
334
|
}
|
|
331
335
|
if (!result.empty()) {
|
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
#ifdef ANDROID
|
|
12
12
|
#include <folly/dynamic.h>
|
|
13
|
-
#include <react/renderer/mapbuffer/MapBuffer.h>
|
|
14
|
-
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
|
15
13
|
#endif
|
|
16
14
|
|
|
17
15
|
namespace facebook::react {
|
|
@@ -25,9 +23,6 @@ public:
|
|
|
25
23
|
folly::dynamic getDynamic() const {
|
|
26
24
|
return {};
|
|
27
25
|
};
|
|
28
|
-
MapBuffer getMapBuffer() const {
|
|
29
|
-
return MapBufferBuilder::EMPTY();
|
|
30
|
-
};
|
|
31
26
|
#endif
|
|
32
27
|
};
|
|
33
28
|
|
|
@@ -40,9 +35,6 @@ public:
|
|
|
40
35
|
folly::dynamic getDynamic() const {
|
|
41
36
|
return {};
|
|
42
37
|
};
|
|
43
|
-
MapBuffer getMapBuffer() const {
|
|
44
|
-
return MapBufferBuilder::EMPTY();
|
|
45
|
-
};
|
|
46
38
|
#endif
|
|
47
39
|
};
|
|
48
40
|
|
|
@@ -55,9 +47,6 @@ public:
|
|
|
55
47
|
folly::dynamic getDynamic() const {
|
|
56
48
|
return {};
|
|
57
49
|
};
|
|
58
|
-
MapBuffer getMapBuffer() const {
|
|
59
|
-
return MapBufferBuilder::EMPTY();
|
|
60
|
-
};
|
|
61
50
|
#endif
|
|
62
51
|
};
|
|
63
52
|
|
|
@@ -70,9 +59,6 @@ public:
|
|
|
70
59
|
folly::dynamic getDynamic() const {
|
|
71
60
|
return {};
|
|
72
61
|
};
|
|
73
|
-
MapBuffer getMapBuffer() const {
|
|
74
|
-
return MapBufferBuilder::EMPTY();
|
|
75
|
-
};
|
|
76
62
|
#endif
|
|
77
63
|
};
|
|
78
64
|
|
|
@@ -85,9 +71,6 @@ public:
|
|
|
85
71
|
folly::dynamic getDynamic() const {
|
|
86
72
|
return {};
|
|
87
73
|
};
|
|
88
|
-
MapBuffer getMapBuffer() const {
|
|
89
|
-
return MapBufferBuilder::EMPTY();
|
|
90
|
-
};
|
|
91
74
|
#endif
|
|
92
75
|
};
|
|
93
76
|
|
|
@@ -100,9 +83,6 @@ public:
|
|
|
100
83
|
folly::dynamic getDynamic() const {
|
|
101
84
|
return {};
|
|
102
85
|
};
|
|
103
|
-
MapBuffer getMapBuffer() const {
|
|
104
|
-
return MapBufferBuilder::EMPTY();
|
|
105
|
-
};
|
|
106
86
|
#endif
|
|
107
87
|
};
|
|
108
88
|
|
|
@@ -115,9 +95,6 @@ public:
|
|
|
115
95
|
folly::dynamic getDynamic() const {
|
|
116
96
|
return {};
|
|
117
97
|
};
|
|
118
|
-
MapBuffer getMapBuffer() const {
|
|
119
|
-
return MapBufferBuilder::EMPTY();
|
|
120
|
-
};
|
|
121
98
|
#endif
|
|
122
99
|
};
|
|
123
100
|
|
|
@@ -130,9 +107,6 @@ public:
|
|
|
130
107
|
folly::dynamic getDynamic() const {
|
|
131
108
|
return {};
|
|
132
109
|
};
|
|
133
|
-
MapBuffer getMapBuffer() const {
|
|
134
|
-
return MapBufferBuilder::EMPTY();
|
|
135
|
-
};
|
|
136
110
|
#endif
|
|
137
111
|
};
|
|
138
112
|
|
|
@@ -73,6 +73,12 @@ static TextAttributes convertRawProp(
|
|
|
73
73
|
"allowFontScaling",
|
|
74
74
|
sourceTextAttributes.allowFontScaling,
|
|
75
75
|
defaultTextAttributes.allowFontScaling);
|
|
76
|
+
textAttributes.maxFontSizeMultiplier = convertRawProp(
|
|
77
|
+
context,
|
|
78
|
+
rawProps,
|
|
79
|
+
"maxFontSizeMultiplier",
|
|
80
|
+
sourceTextAttributes.maxFontSizeMultiplier,
|
|
81
|
+
defaultTextAttributes.maxFontSizeMultiplier);
|
|
76
82
|
textAttributes.dynamicTypeRamp = convertRawProp(
|
|
77
83
|
context,
|
|
78
84
|
rawProps,
|
|
@@ -266,6 +272,12 @@ void BaseTextProps::setProp(
|
|
|
266
272
|
defaults, value, textAttributes, fontVariant, "fontVariant");
|
|
267
273
|
REBUILD_FIELD_SWITCH_CASE(
|
|
268
274
|
defaults, value, textAttributes, allowFontScaling, "allowFontScaling");
|
|
275
|
+
REBUILD_FIELD_SWITCH_CASE(
|
|
276
|
+
defaults,
|
|
277
|
+
value,
|
|
278
|
+
textAttributes,
|
|
279
|
+
maxFontSizeMultiplier,
|
|
280
|
+
"maxFontSizeMultiplier");
|
|
269
281
|
REBUILD_FIELD_SWITCH_CASE(
|
|
270
282
|
defaults, value, textAttributes, letterSpacing, "letterSpacing");
|
|
271
283
|
REBUILD_FIELD_SWITCH_CASE(
|
|
@@ -208,8 +208,7 @@ inline bool operator==(
|
|
|
208
208
|
return areAttributedStringsEquivalentLayoutWise(
|
|
209
209
|
lhs.attributedString, rhs.attributedString) &&
|
|
210
210
|
lhs.paragraphAttributes == rhs.paragraphAttributes &&
|
|
211
|
-
lhs.layoutConstraints
|
|
212
|
-
rhs.layoutConstraints.maximumSize.width;
|
|
211
|
+
lhs.layoutConstraints == rhs.layoutConstraints;
|
|
213
212
|
}
|
|
214
213
|
|
|
215
214
|
inline bool operator!=(
|
|
@@ -243,7 +242,7 @@ struct hash<facebook::react::TextMeasureCacheKey> {
|
|
|
243
242
|
return facebook::react::hash_combine(
|
|
244
243
|
attributedStringHashLayoutWise(key.attributedString),
|
|
245
244
|
key.paragraphAttributes,
|
|
246
|
-
key.layoutConstraints
|
|
245
|
+
key.layoutConstraints);
|
|
247
246
|
}
|
|
248
247
|
};
|
|
249
248
|
|
|
@@ -137,6 +137,7 @@ inline static CGFloat RCTBaseSizeForDynamicTypeRamp(const DynamicTypeRamp &dynam
|
|
|
137
137
|
inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const TextAttributes &textAttributes)
|
|
138
138
|
{
|
|
139
139
|
if (textAttributes.allowFontScaling.value_or(true)) {
|
|
140
|
+
CGFloat fontSizeMultiplier = !isnan(textAttributes.fontSizeMultiplier) ? textAttributes.fontSizeMultiplier : 1.0;
|
|
140
141
|
#if !TARGET_OS_OSX // [macOS]
|
|
141
142
|
if (textAttributes.dynamicTypeRamp.has_value()) {
|
|
142
143
|
DynamicTypeRamp dynamicTypeRamp = textAttributes.dynamicTypeRamp.value();
|
|
@@ -145,12 +146,13 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex
|
|
|
145
146
|
// Using a specific font size reduces rounding errors from -scaledValueForValue:
|
|
146
147
|
CGFloat requestedSize =
|
|
147
148
|
isnan(textAttributes.fontSize) ? RCTBaseSizeForDynamicTypeRamp(dynamicTypeRamp) : textAttributes.fontSize;
|
|
148
|
-
|
|
149
|
-
} else {
|
|
150
|
-
return textAttributes.fontSizeMultiplier;
|
|
149
|
+
fontSizeMultiplier = [fontMetrics scaledValueForValue:requestedSize] / requestedSize;
|
|
151
150
|
}
|
|
151
|
+
CGFloat maxFontSizeMultiplier =
|
|
152
|
+
!isnan(textAttributes.maxFontSizeMultiplier) ? textAttributes.maxFontSizeMultiplier : 0.0;
|
|
153
|
+
return maxFontSizeMultiplier >= 1.0 ? fminf(maxFontSizeMultiplier, fontSizeMultiplier) : fontSizeMultiplier;
|
|
152
154
|
#else // [macOS
|
|
153
|
-
return
|
|
155
|
+
return fontSizeMultiplier;
|
|
154
156
|
#endif // macOS]
|
|
155
157
|
} else {
|
|
156
158
|
return 1.0;
|
|
@@ -409,6 +411,7 @@ static NSMutableAttributedString *RCTNSAttributedStringFragmentWithAttributesFro
|
|
|
409
411
|
{
|
|
410
412
|
auto nsAttributedStringFragment = RCTNSAttributedStringFragmentFromFragment(fragment, placeholderImage);
|
|
411
413
|
|
|
414
|
+
#if !TARGET_OS_MACCATALYST
|
|
412
415
|
if (fragment.parentShadowView.componentHandle) {
|
|
413
416
|
RCTWeakEventEmitterWrapper *eventEmitterWrapper = [RCTWeakEventEmitterWrapper new];
|
|
414
417
|
eventEmitterWrapper.eventEmitter = fragment.parentShadowView.eventEmitter;
|
|
@@ -419,6 +422,7 @@ static NSMutableAttributedString *RCTNSAttributedStringFragmentWithAttributesFro
|
|
|
419
422
|
[nsAttributedStringFragment addAttributes:additionalTextAttributes
|
|
420
423
|
range:NSMakeRange(0, nsAttributedStringFragment.length)];
|
|
421
424
|
}
|
|
425
|
+
#endif
|
|
422
426
|
|
|
423
427
|
return nsAttributedStringFragment;
|
|
424
428
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
#import "RCTFontUtils.h"
|
|
9
9
|
#import <CoreText/CoreText.h>
|
|
10
|
+
#import <React/RCTFont.h>
|
|
10
11
|
|
|
11
12
|
#import <algorithm>
|
|
12
13
|
#import <cmath>
|
|
@@ -45,12 +46,6 @@ static RCTFontProperties RCTResolveFontProperties(
|
|
|
45
46
|
return fontProperties;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
static UIFontWeight RCTGetFontWeight(UIFont *font)
|
|
49
|
-
{
|
|
50
|
-
NSDictionary *traits = [font.fontDescriptor objectForKey:UIFontDescriptorTraitsAttribute];
|
|
51
|
-
return [traits[UIFontWeightTrait] doubleValue];
|
|
52
|
-
}
|
|
53
|
-
|
|
54
49
|
static RCTFontStyle RCTGetFontStyle(UIFont *font)
|
|
55
50
|
{
|
|
56
51
|
NSDictionary *traits = [font.fontDescriptor objectForKey:UIFontDescriptorTraitsAttribute];
|
|
@@ -151,6 +146,22 @@ static UIFont *RCTDefaultFontWithFontProperties(RCTFontProperties fontProperties
|
|
|
151
146
|
return font;
|
|
152
147
|
}
|
|
153
148
|
|
|
149
|
+
#if TARGET_OS_OSX // [macOS
|
|
150
|
+
NSArray<NSString *> *RCTFontNamesForFamilyName(NSString *familyName) {
|
|
151
|
+
NSArray<NSArray *> *fontMembers = [[NSFontManager sharedFontManager] availableMembersOfFontFamily:familyName];
|
|
152
|
+
NSMutableArray<NSString *> *fontNames = [NSMutableArray array];
|
|
153
|
+
|
|
154
|
+
for (NSArray *fontMember in fontMembers) {
|
|
155
|
+
// The first object is the Post-script name of the font.
|
|
156
|
+
NSString *fontName = fontMember.firstObject;
|
|
157
|
+
[fontNames addObject:fontName];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Return an immutable array
|
|
161
|
+
return [NSArray arrayWithArray:fontNames];
|
|
162
|
+
}
|
|
163
|
+
#endif // macOS]
|
|
164
|
+
|
|
154
165
|
UIFont *RCTFontWithFontProperties(RCTFontProperties fontProperties)
|
|
155
166
|
{
|
|
156
167
|
RCTFontProperties defaultFontProperties = RCTDefaultFontProperties();
|
|
@@ -167,19 +178,28 @@ UIFont *RCTFontWithFontProperties(RCTFontProperties fontProperties)
|
|
|
167
178
|
#if !TARGET_OS_OSX // [macOS]
|
|
168
179
|
NSArray<NSString *> *fontNames = [UIFont fontNamesForFamilyName:fontProperties.family];
|
|
169
180
|
#else // [macOS
|
|
170
|
-
NSArray<NSString *> *fontNames =
|
|
181
|
+
NSArray<NSString *> *fontNames = RCTFontNamesForFamilyName(fontProperties.family);
|
|
171
182
|
#endif // macOS]
|
|
183
|
+
UIFontWeight fontWeight = fontProperties.weight;
|
|
172
184
|
|
|
173
185
|
if (fontNames.count == 0) {
|
|
174
186
|
// Gracefully handle being given a font name rather than font family, for
|
|
175
187
|
// example: "Helvetica Light Oblique" rather than just "Helvetica".
|
|
176
188
|
font = [UIFont fontWithName:fontProperties.family size:effectiveFontSize];
|
|
177
|
-
|
|
178
|
-
|
|
189
|
+
if (font) {
|
|
190
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
191
|
+
fontNames = [UIFont fontNamesForFamilyName:font.familyName];
|
|
192
|
+
#else // [macOS
|
|
193
|
+
fontNames = RCTFontNamesForFamilyName(font.familyName);
|
|
194
|
+
#endif // macOS]
|
|
195
|
+
fontWeight = fontWeight ?: RCTGetFontWeight(font);
|
|
196
|
+
} else {
|
|
179
197
|
// Failback to system font.
|
|
180
198
|
font = [UIFont systemFontOfSize:effectiveFontSize weight:fontProperties.weight];
|
|
181
199
|
}
|
|
182
|
-
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (fontNames.count > 0) {
|
|
183
203
|
// Get the closest font that matches the given weight for the fontFamily
|
|
184
204
|
CGFloat closestWeight = INFINITY;
|
|
185
205
|
for (NSString *name in fontNames) {
|
|
@@ -190,7 +210,7 @@ UIFont *RCTFontWithFontProperties(RCTFontProperties fontProperties)
|
|
|
190
210
|
}
|
|
191
211
|
|
|
192
212
|
CGFloat testWeight = RCTGetFontWeight(fontMatch);
|
|
193
|
-
if (ABS(testWeight -
|
|
213
|
+
if (ABS(testWeight - fontWeight) < ABS(closestWeight - fontWeight)) {
|
|
194
214
|
font = fontMatch;
|
|
195
215
|
closestWeight = testWeight;
|
|
196
216
|
}
|
|
@@ -107,9 +107,9 @@ inline static NSUnderlineStyle RCTNSUnderlineStyleFromTextDecorationStyle(
|
|
|
107
107
|
case facebook::react::TextDecorationStyle::Double:
|
|
108
108
|
return NSUnderlineStyleDouble;
|
|
109
109
|
case facebook::react::TextDecorationStyle::Dashed:
|
|
110
|
-
return
|
|
110
|
+
return NSUnderlineStylePatternDash | NSUnderlineStyleSingle; // [macOS]
|
|
111
111
|
case facebook::react::TextDecorationStyle::Dotted:
|
|
112
|
-
return
|
|
112
|
+
return NSUnderlineStylePatternDot | NSUnderlineStyleSingle; // [macOS]
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -126,20 +126,41 @@ std::shared_ptr<ShadowNode> UIManager::cloneNode(
|
|
|
126
126
|
|
|
127
127
|
if (!rawProps.isEmpty()) {
|
|
128
128
|
if (family.nativeProps_DEPRECATED != nullptr) {
|
|
129
|
+
// 1. update the nativeProps_DEPRECATED props.
|
|
130
|
+
//
|
|
131
|
+
// In this step, we want the most recent value for the props
|
|
132
|
+
// managed by setNativeProps.
|
|
129
133
|
// Values in `rawProps` patch (take precedence over)
|
|
130
|
-
// `nativeProps_DEPRECATED`. For example, if both
|
|
131
|
-
// and `rawProps` contain key 'A'.
|
|
132
|
-
// was previously in
|
|
134
|
+
// `nativeProps_DEPRECATED`. For example, if both
|
|
135
|
+
// `nativeProps_DEPRECATED` and `rawProps` contain key 'A'.
|
|
136
|
+
// Value from `rawProps` overrides what was previously in
|
|
137
|
+
// `nativeProps_DEPRECATED`. Notice that the `nativeProps_DEPRECATED`
|
|
138
|
+
// patch will not get more props from `rawProps`: if the key is not
|
|
139
|
+
// present in `nativeProps_DEPRECATED`, it will not be added.
|
|
140
|
+
//
|
|
141
|
+
// The result of this operation is the new `nativeProps_DEPRECATED`.
|
|
133
142
|
family.nativeProps_DEPRECATED =
|
|
134
143
|
std::make_unique<folly::dynamic>(mergeDynamicProps(
|
|
135
|
-
*family.nativeProps_DEPRECATED,
|
|
136
|
-
(folly::dynamic)rawProps,
|
|
144
|
+
*family.nativeProps_DEPRECATED, // source
|
|
145
|
+
(folly::dynamic)rawProps, // patch
|
|
137
146
|
NullValueStrategy::Ignore));
|
|
138
147
|
|
|
148
|
+
// 2. Compute the final set of props.
|
|
149
|
+
//
|
|
150
|
+
// This step takes the new props handled by `setNativeProps` and
|
|
151
|
+
// merges them in the `rawProps` managed by React.
|
|
152
|
+
// The new props handled by `nativeProps` now takes precedence
|
|
153
|
+
// on the props handled by React, as we want to make sure that
|
|
154
|
+
// all the props are applied to the component.
|
|
155
|
+
// We use these finalProps as source of truth for the component.
|
|
156
|
+
auto finalProps = mergeDynamicProps(
|
|
157
|
+
(folly::dynamic)rawProps, // source
|
|
158
|
+
*family.nativeProps_DEPRECATED, // patch
|
|
159
|
+
NullValueStrategy::Override);
|
|
160
|
+
|
|
161
|
+
// 3. Clone the props by using finalProps.
|
|
139
162
|
props = componentDescriptor.cloneProps(
|
|
140
|
-
propsParserContext,
|
|
141
|
-
shadowNode.getProps(),
|
|
142
|
-
RawProps(*family.nativeProps_DEPRECATED));
|
|
163
|
+
propsParserContext, shadowNode.getProps(), RawProps(finalProps));
|
|
143
164
|
} else {
|
|
144
165
|
props = componentDescriptor.cloneProps(
|
|
145
166
|
propsParserContext, shadowNode.getProps(), std::move(rawProps));
|
|
@@ -204,47 +204,51 @@ std::string simpleBasename(const std::string& path) {
|
|
|
204
204
|
*/
|
|
205
205
|
void ReactInstance::loadScript(
|
|
206
206
|
std::unique_ptr<const JSBigString> script,
|
|
207
|
-
const std::string& sourceURL
|
|
207
|
+
const std::string& sourceURL,
|
|
208
|
+
std::function<void(jsi::Runtime& runtime)>&& completion) {
|
|
208
209
|
auto buffer = std::make_shared<BigStringBuffer>(std::move(script));
|
|
209
210
|
std::string scriptName = simpleBasename(sourceURL);
|
|
210
211
|
|
|
211
|
-
runtimeScheduler_->scheduleWork(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
212
|
+
runtimeScheduler_->scheduleWork([this,
|
|
213
|
+
scriptName,
|
|
214
|
+
sourceURL,
|
|
215
|
+
buffer = std::move(buffer),
|
|
216
|
+
weakBufferedRuntimeExecuter =
|
|
217
|
+
std::weak_ptr<BufferedRuntimeExecutor>(
|
|
218
|
+
bufferedRuntimeExecutor_),
|
|
219
|
+
completion](jsi::Runtime& runtime) {
|
|
220
|
+
SystraceSection s("ReactInstance::loadScript");
|
|
221
|
+
bool hasLogger(ReactMarker::logTaggedMarkerBridgelessImpl);
|
|
222
|
+
if (hasLogger) {
|
|
223
|
+
ReactMarker::logTaggedMarkerBridgeless(
|
|
224
|
+
ReactMarker::RUN_JS_BUNDLE_START, scriptName.c_str());
|
|
225
|
+
}
|
|
224
226
|
|
|
225
|
-
|
|
227
|
+
runtime.evaluateJavaScript(buffer, sourceURL);
|
|
226
228
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
229
|
+
/**
|
|
230
|
+
* TODO(T183610671): We need a safe/reliable way to enable the js
|
|
231
|
+
* pipeline from javascript. Remove this after we figure that out, or
|
|
232
|
+
* after we just remove the js pipeline.
|
|
233
|
+
*/
|
|
234
|
+
if (!jsErrorHandler_->hasHandledFatalError()) {
|
|
235
|
+
jsErrorHandler_->setRuntimeReady();
|
|
236
|
+
}
|
|
235
237
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
238
|
+
if (hasLogger) {
|
|
239
|
+
ReactMarker::logTaggedMarkerBridgeless(
|
|
240
|
+
ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str());
|
|
241
|
+
ReactMarker::logMarkerBridgeless(ReactMarker::INIT_REACT_RUNTIME_STOP);
|
|
242
|
+
ReactMarker::logMarkerBridgeless(ReactMarker::APP_STARTUP_STOP);
|
|
243
|
+
}
|
|
244
|
+
if (auto strongBufferedRuntimeExecuter =
|
|
245
|
+
weakBufferedRuntimeExecuter.lock()) {
|
|
246
|
+
strongBufferedRuntimeExecuter->flush();
|
|
247
|
+
}
|
|
248
|
+
if (completion) {
|
|
249
|
+
completion(runtime);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
248
252
|
}
|
|
249
253
|
|
|
250
254
|
/*
|
|
@@ -48,7 +48,8 @@ class ReactInstance final : private jsinspector_modern::InstanceTargetDelegate {
|
|
|
48
48
|
|
|
49
49
|
void loadScript(
|
|
50
50
|
std::unique_ptr<const JSBigString> script,
|
|
51
|
-
const std::string& sourceURL
|
|
51
|
+
const std::string& sourceURL,
|
|
52
|
+
std::function<void(jsi::Runtime& runtime)>&& completion = nullptr);
|
|
52
53
|
|
|
53
54
|
void registerSegment(uint32_t segmentId, const std::string& segmentPath);
|
|
54
55
|
|
|
@@ -470,8 +470,9 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags)
|
|
|
470
470
|
|
|
471
471
|
auto script = std::make_unique<NSDataBigString>(source.data);
|
|
472
472
|
const auto *url = deriveSourceURL(source.url).UTF8String;
|
|
473
|
-
_reactInstance->loadScript(std::move(script), url)
|
|
474
|
-
|
|
473
|
+
_reactInstance->loadScript(std::move(script), url, [](jsi::Runtime &_) {
|
|
474
|
+
[[NSNotificationCenter defaultCenter] postNotificationName:@"RCTInstanceDidLoadBundle" object:nil];
|
|
475
|
+
});
|
|
475
476
|
}
|
|
476
477
|
|
|
477
478
|
- (void)_handleJSError:(const JsErrorHandler::ParsedError &)error
|
package/jest/setup.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-macos",
|
|
3
|
-
"version": "0.76.
|
|
3
|
+
"version": "0.76.7",
|
|
4
4
|
"description": "React Native for macOS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -111,13 +111,13 @@
|
|
|
111
111
|
},
|
|
112
112
|
"dependencies": {
|
|
113
113
|
"@jest/create-cache-key-function": "^29.6.3",
|
|
114
|
-
"@react-native-mac/virtualized-lists": "0.76.
|
|
115
|
-
"@react-native/assets-registry": "0.76.
|
|
116
|
-
"@react-native/codegen": "0.76.
|
|
117
|
-
"@react-native/community-cli-plugin": "0.76.
|
|
118
|
-
"@react-native/gradle-plugin": "0.76.
|
|
119
|
-
"@react-native/js-polyfills": "0.76.
|
|
120
|
-
"@react-native/normalize-colors": "0.76.
|
|
114
|
+
"@react-native-mac/virtualized-lists": "0.76.6",
|
|
115
|
+
"@react-native/assets-registry": "0.76.7",
|
|
116
|
+
"@react-native/codegen": "0.76.7",
|
|
117
|
+
"@react-native/community-cli-plugin": "0.76.7",
|
|
118
|
+
"@react-native/gradle-plugin": "0.76.7",
|
|
119
|
+
"@react-native/js-polyfills": "0.76.7",
|
|
120
|
+
"@react-native/normalize-colors": "0.76.7",
|
|
121
121
|
"abort-controller": "^3.0.0",
|
|
122
122
|
"anser": "^1.4.9",
|
|
123
123
|
"ansi-regex": "^5.0.0",
|
|
@@ -187,6 +187,6 @@ class NewArchitectureHelper
|
|
|
187
187
|
end
|
|
188
188
|
|
|
189
189
|
def self.new_arch_enabled
|
|
190
|
-
return ENV["RCT_NEW_ARCH_ENABLED"] ==
|
|
190
|
+
return ENV["RCT_NEW_ARCH_ENABLED"] == "1" # [macOS] Disable Fabric by default till macOS supports it
|
|
191
191
|
end
|
|
192
192
|
end
|
|
@@ -44,10 +44,10 @@ class ReactNativePodsUtils
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def self.set_gcc_preprocessor_definition_for_React_hermes(installer)
|
|
47
|
-
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-hermes",
|
|
48
|
-
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-jsinspector",
|
|
49
|
-
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "hermes-engine",
|
|
50
|
-
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-RuntimeHermes",
|
|
47
|
+
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-hermes", :debug)
|
|
48
|
+
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-jsinspector", :debug)
|
|
49
|
+
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "hermes-engine", :debug)
|
|
50
|
+
self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-RuntimeHermes", :debug)
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def self.turn_off_resource_bundle_react_core(installer)
|
|
@@ -193,11 +193,11 @@ class ReactNativePodsUtils
|
|
|
193
193
|
|
|
194
194
|
private
|
|
195
195
|
|
|
196
|
-
def self.add_build_settings_to_pod(installer, settings_name, settings_value, target_pod_name,
|
|
196
|
+
def self.add_build_settings_to_pod(installer, settings_name, settings_value, target_pod_name, configuration_type)
|
|
197
197
|
installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
|
|
198
198
|
if pod_name.to_s == target_pod_name
|
|
199
199
|
target_installation_result.native_target.build_configurations.each do |config|
|
|
200
|
-
if
|
|
200
|
+
if configuration_type == nil || (configuration_type != nil && config.type == configuration_type)
|
|
201
201
|
config.build_settings[settings_name] ||= '$(inherited) '
|
|
202
202
|
config.build_settings[settings_name] << settings_value
|
|
203
203
|
end
|