react-native 0.78.0-rc.2 → 0.78.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/Core/ReactNativeVersion.js +1 -1
- package/React/Base/RCTVersion.m +1 -1
- package/React/DevSupport/RCTPausedInDebuggerOverlayController.mm +3 -5
- package/ReactAndroid/api/ReactAndroid.api +11 -2
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/HMRClient.java +4 -1
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java +15 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/network/ReactCookieJarContainer.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactOverflowView.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactPointerEventsView.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +16 -2
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.mm +13 -4
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.h +1 -0
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +16 -8
- package/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp +8 -0
- package/ReactCommon/react/renderer/attributedstring/TextAttributes.h +2 -0
- package/ReactCommon/react/renderer/attributedstring/conversions.h +5 -0
- package/ReactCommon/react/renderer/components/text/BaseTextProps.cpp +12 -0
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +5 -3
- package/package.json +8 -8
- package/react-native.config.js +6 -0
- package/scripts/codegen/generate-artifacts-executor.js +8 -4
- package/scripts/generate-codegen-artifacts.js +6 -1
- package/sdks/hermesc/linux64-bin/hermesc +0 -0
- 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/React/Base/RCTVersion.m
CHANGED
|
@@ -54,13 +54,11 @@
|
|
|
54
54
|
]];
|
|
55
55
|
|
|
56
56
|
UIButton *resumeButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
57
|
-
|
|
57
|
+
UIImage *image = [UIImage systemImageNamed:@"forward.frame.fill"];
|
|
58
|
+
[resumeButton setImage:image forState:UIControlStateNormal];
|
|
59
|
+
[resumeButton setImage:image forState:UIControlStateDisabled];
|
|
58
60
|
resumeButton.tintColor = [UIColor colorWithRed:0.37 green:0.37 blue:0.37 alpha:1];
|
|
59
61
|
|
|
60
|
-
resumeButton.configurationUpdateHandler = ^(UIButton *button) {
|
|
61
|
-
button.imageView.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
62
|
resumeButton.enabled = NO;
|
|
65
63
|
[NSLayoutConstraint activateConstraints:@[
|
|
66
64
|
[resumeButton.widthAnchor constraintEqualToConstant:48],
|
|
@@ -2215,7 +2215,7 @@ public abstract interface class com/facebook/react/devsupport/HMRClient : com/fa
|
|
|
2215
2215
|
public abstract fun disable ()V
|
|
2216
2216
|
public abstract fun enable ()V
|
|
2217
2217
|
public abstract fun registerBundle (Ljava/lang/String;)V
|
|
2218
|
-
public abstract fun setup (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;
|
|
2218
|
+
public abstract fun setup (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IZLjava/lang/String;)V
|
|
2219
2219
|
}
|
|
2220
2220
|
|
|
2221
2221
|
public final class com/facebook/react/devsupport/InspectorFlags {
|
|
@@ -3482,6 +3482,14 @@ public class com/facebook/react/modules/network/ResponseUtil {
|
|
|
3482
3482
|
public static fun onResponseReceived (Lcom/facebook/react/bridge/ReactApplicationContext;IILcom/facebook/react/bridge/WritableMap;Ljava/lang/String;)V
|
|
3483
3483
|
}
|
|
3484
3484
|
|
|
3485
|
+
public final class com/facebook/react/modules/network/ReactCookieJarContainer : com/facebook/react/modules/network/CookieJarContainer {
|
|
3486
|
+
public fun <init> ()V
|
|
3487
|
+
public fun loadForRequest (Lokhttp3/HttpUrl;)Ljava/util/List;
|
|
3488
|
+
public fun removeCookieJar ()V
|
|
3489
|
+
public fun saveFromResponse (Lokhttp3/HttpUrl;Ljava/util/List;)V
|
|
3490
|
+
public fun setCookieJar (Lokhttp3/CookieJar;)V
|
|
3491
|
+
}
|
|
3492
|
+
|
|
3485
3493
|
public class com/facebook/react/modules/network/TLSSocketFactory : javax/net/ssl/SSLSocketFactory {
|
|
3486
3494
|
public fun <init> ()V
|
|
3487
3495
|
public fun createSocket (Ljava/lang/String;I)Ljava/net/Socket;
|
|
@@ -7342,6 +7350,7 @@ public class com/facebook/react/views/text/TextAttributeProps {
|
|
|
7342
7350
|
public static final field TA_KEY_LETTER_SPACING S
|
|
7343
7351
|
public static final field TA_KEY_LINE_BREAK_STRATEGY S
|
|
7344
7352
|
public static final field TA_KEY_LINE_HEIGHT S
|
|
7353
|
+
public static final field TA_KEY_MAX_FONT_SIZE_MULTIPLIER S
|
|
7345
7354
|
public static final field TA_KEY_OPACITY S
|
|
7346
7355
|
public static final field TA_KEY_ROLE S
|
|
7347
7356
|
public static final field TA_KEY_TEXT_DECORATION_COLOR S
|
|
@@ -7374,6 +7383,7 @@ public class com/facebook/react/views/text/TextAttributeProps {
|
|
|
7374
7383
|
protected field mLetterSpacingInput F
|
|
7375
7384
|
protected field mLineHeight F
|
|
7376
7385
|
protected field mLineHeightInput F
|
|
7386
|
+
protected field mMaxFontSizeMultiplier F
|
|
7377
7387
|
protected field mNumberOfLines I
|
|
7378
7388
|
protected field mOpacity F
|
|
7379
7389
|
protected field mRole Lcom/facebook/react/uimanager/ReactAccessibilityDelegate$Role;
|
|
@@ -7823,4 +7833,3 @@ public final class com/facebook/react/views/view/WindowUtilKt {
|
|
|
7823
7833
|
public static final fun setStatusBarVisibility (Landroid/view/Window;Z)V
|
|
7824
7834
|
public static final fun setSystemBarsTranslucency (Landroid/view/Window;Z)V
|
|
7825
7835
|
}
|
|
7826
|
-
|
|
@@ -685,10 +685,12 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
|
|
|
685
685
|
URL sourceUrl = new URL(getSourceUrl());
|
|
686
686
|
String path = sourceUrl.getPath().substring(1); // strip initial slash in path
|
|
687
687
|
String host = sourceUrl.getHost();
|
|
688
|
+
String scheme = sourceUrl.getProtocol();
|
|
688
689
|
int port = sourceUrl.getPort() != -1 ? sourceUrl.getPort() : sourceUrl.getDefaultPort();
|
|
689
690
|
mCurrentReactContext
|
|
690
691
|
.getJSModule(HMRClient.class)
|
|
691
|
-
.setup(
|
|
692
|
+
.setup(
|
|
693
|
+
"android", path, host, port, mDevSettings.isHotModuleReplacementEnabled(), scheme);
|
|
692
694
|
} catch (MalformedURLException e) {
|
|
693
695
|
showNewJavaError(e.getMessage(), e);
|
|
694
696
|
}
|
|
@@ -26,8 +26,11 @@ public interface HMRClient extends JavaScriptModule {
|
|
|
26
26
|
* @param host The host that the HMRClient should communicate with.
|
|
27
27
|
* @param port The port that the HMRClient should communicate with on the host.
|
|
28
28
|
* @param isEnabled Whether HMR is enabled initially.
|
|
29
|
+
* @param scheme The protocol that the HMRClient should communicate with on the host (defaults to
|
|
30
|
+
* http).
|
|
29
31
|
*/
|
|
30
|
-
void setup(
|
|
32
|
+
void setup(
|
|
33
|
+
String platform, String bundleEntry, String host, int port, boolean isEnabled, String scheme);
|
|
31
34
|
|
|
32
35
|
/** Registers an additional JS bundle with HMRClient. */
|
|
33
36
|
void registerBundle(String bundleUrl);
|
|
@@ -331,14 +331,11 @@ public class MountingManager {
|
|
|
331
331
|
@AnyThread
|
|
332
332
|
@ThreadConfined(ANY)
|
|
333
333
|
public @Nullable EventEmitterWrapper getEventEmitter(int surfaceId, int reactTag) {
|
|
334
|
-
SurfaceMountingManager
|
|
335
|
-
|
|
336
|
-
? getSurfaceManagerForView(reactTag)
|
|
337
|
-
: getSurfaceManager(surfaceId));
|
|
338
|
-
if (surfaceMountingManager == null) {
|
|
334
|
+
SurfaceMountingManager smm = getSurfaceMountingManager(surfaceId, reactTag);
|
|
335
|
+
if (smm == null) {
|
|
339
336
|
return null;
|
|
340
337
|
}
|
|
341
|
-
return
|
|
338
|
+
return smm.getEventEmitter(reactTag);
|
|
342
339
|
}
|
|
343
340
|
|
|
344
341
|
/**
|
|
@@ -458,11 +455,21 @@ public class MountingManager {
|
|
|
458
455
|
boolean canCoalesceEvent,
|
|
459
456
|
@Nullable WritableMap params,
|
|
460
457
|
@EventCategoryDef int eventCategory) {
|
|
461
|
-
|
|
458
|
+
SurfaceMountingManager smm = getSurfaceMountingManager(surfaceId, reactTag);
|
|
462
459
|
if (smm == null) {
|
|
463
|
-
|
|
460
|
+
FLog.d(
|
|
461
|
+
TAG,
|
|
462
|
+
"Cannot queue event without valid surface mounting manager for tag: %d, surfaceId: %d",
|
|
463
|
+
reactTag,
|
|
464
|
+
surfaceId);
|
|
464
465
|
return;
|
|
465
466
|
}
|
|
466
467
|
smm.enqueuePendingEvent(reactTag, eventName, canCoalesceEvent, params, eventCategory);
|
|
467
468
|
}
|
|
469
|
+
|
|
470
|
+
private @Nullable SurfaceMountingManager getSurfaceMountingManager(int surfaceId, int reactTag) {
|
|
471
|
+
return (surfaceId == ViewUtil.NO_SURFACE_ID
|
|
472
|
+
? getSurfaceManagerForView(reactTag)
|
|
473
|
+
: getSurfaceManager(surfaceId));
|
|
474
|
+
}
|
|
468
475
|
}
|
package/ReactAndroid/src/main/java/com/facebook/react/modules/network/ReactCookieJarContainer.kt
CHANGED
|
@@ -16,7 +16,7 @@ import okhttp3.Headers
|
|
|
16
16
|
import okhttp3.HttpUrl
|
|
17
17
|
|
|
18
18
|
/** Basic okhttp3 CookieJar container */
|
|
19
|
-
|
|
19
|
+
public class ReactCookieJarContainer : CookieJarContainer {
|
|
20
20
|
|
|
21
21
|
private var cookieJar: CookieJar? = null
|
|
22
22
|
|
|
@@ -13,6 +13,6 @@ package com.facebook.react.uimanager
|
|
|
13
13
|
*/
|
|
14
14
|
public interface ReactPointerEventsView {
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
public
|
|
16
|
+
/** The PointerEvents of the View. */
|
|
17
|
+
public val pointerEvents: PointerEvents
|
|
18
18
|
}
|
|
@@ -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;
|
package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.mm
CHANGED
|
@@ -123,6 +123,15 @@ std::vector<ExportedMethod> parseExportedMethods(std::string moduleName, Class m
|
|
|
123
123
|
NSArray<RCTMethodArgument *> *arguments;
|
|
124
124
|
SEL objCMethodSelector = NSSelectorFromString(RCTParseMethodSignature(methodInfo->objcName, &arguments));
|
|
125
125
|
NSMethodSignature *objCMethodSignature = [moduleClass instanceMethodSignatureForSelector:objCMethodSelector];
|
|
126
|
+
if (objCMethodSignature == nullptr) {
|
|
127
|
+
RCTLogWarn(
|
|
128
|
+
@"The objective-c `%s` method signature for the JS method `%@` can not be found in the ObjecitveC definition of the %s module.\nThe `%@` JS method will not be available.",
|
|
129
|
+
methodInfo->objcName,
|
|
130
|
+
jsMethodName,
|
|
131
|
+
moduleName.c_str(),
|
|
132
|
+
jsMethodName);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
126
135
|
std::string objCMethodReturnType = [objCMethodSignature methodReturnType];
|
|
127
136
|
|
|
128
137
|
if (objCMethodSignature.numberOfArguments - 2 != [arguments count]) {
|
|
@@ -337,7 +346,7 @@ void ObjCInteropTurboModule::setInvocationArg(
|
|
|
337
346
|
SEL selector = selectorForType(argumentType);
|
|
338
347
|
|
|
339
348
|
if ([RCTConvert respondsToSelector:selector]) {
|
|
340
|
-
id objCArg = TurboModuleConvertUtils::convertJSIValueToObjCObject(runtime, jsiArg, jsInvoker_);
|
|
349
|
+
id objCArg = TurboModuleConvertUtils::convertJSIValueToObjCObject(runtime, jsiArg, jsInvoker_, YES);
|
|
341
350
|
|
|
342
351
|
if (objCArgType == @encode(char)) {
|
|
343
352
|
char arg = RCTConvertTo<char>(selector, objCArg);
|
|
@@ -491,7 +500,7 @@ void ObjCInteropTurboModule::setInvocationArg(
|
|
|
491
500
|
}
|
|
492
501
|
|
|
493
502
|
RCTResponseSenderBlock arg =
|
|
494
|
-
(RCTResponseSenderBlock)TurboModuleConvertUtils::convertJSIValueToObjCObject(runtime, jsiArg, jsInvoker_);
|
|
503
|
+
(RCTResponseSenderBlock)TurboModuleConvertUtils::convertJSIValueToObjCObject(runtime, jsiArg, jsInvoker_, YES);
|
|
495
504
|
if (arg) {
|
|
496
505
|
[retainedObjectsForInvocation addObject:arg];
|
|
497
506
|
}
|
|
@@ -506,7 +515,7 @@ void ObjCInteropTurboModule::setInvocationArg(
|
|
|
506
515
|
}
|
|
507
516
|
|
|
508
517
|
RCTResponseSenderBlock senderBlock =
|
|
509
|
-
(RCTResponseSenderBlock)TurboModuleConvertUtils::convertJSIValueToObjCObject(runtime, jsiArg, jsInvoker_);
|
|
518
|
+
(RCTResponseSenderBlock)TurboModuleConvertUtils::convertJSIValueToObjCObject(runtime, jsiArg, jsInvoker_, YES);
|
|
510
519
|
RCTResponseErrorBlock arg = ^(NSError *error) {
|
|
511
520
|
senderBlock(@[ RCTJSErrorFromNSError(error) ]);
|
|
512
521
|
};
|
|
@@ -536,7 +545,7 @@ void ObjCInteropTurboModule::setInvocationArg(
|
|
|
536
545
|
runtime, errorPrefix + "JavaScript argument must be a plain object. Got " + getType(runtime, jsiArg));
|
|
537
546
|
}
|
|
538
547
|
|
|
539
|
-
id arg = TurboModuleConvertUtils::convertJSIValueToObjCObject(runtime, jsiArg, jsInvoker_);
|
|
548
|
+
id arg = TurboModuleConvertUtils::convertJSIValueToObjCObject(runtime, jsiArg, jsInvoker_, YES);
|
|
540
549
|
|
|
541
550
|
RCTManagedPointer *(*convert)(id, SEL, id) = (__typeof__(convert))objc_msgSend;
|
|
542
551
|
RCTManagedPointer *box = convert([RCTCxxConvert class], selector, arg);
|
|
@@ -32,6 +32,7 @@ using EventEmitterCallback = std::function<void(const std::string &, id)>;
|
|
|
32
32
|
namespace TurboModuleConvertUtils {
|
|
33
33
|
jsi::Value convertObjCObjectToJSIValue(jsi::Runtime &runtime, id value);
|
|
34
34
|
id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, std::shared_ptr<CallInvoker> jsInvoker);
|
|
35
|
+
id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, std::shared_ptr<CallInvoker> jsInvoker, BOOL useNSNull);
|
|
35
36
|
} // namespace TurboModuleConvertUtils
|
|
36
37
|
|
|
37
38
|
template <>
|
|
@@ -112,20 +112,20 @@ static NSString *convertJSIStringToNSString(jsi::Runtime &runtime, const jsi::St
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
static NSArray *
|
|
115
|
-
convertJSIArrayToNSArray(jsi::Runtime &runtime, const jsi::Array &value, std::shared_ptr<CallInvoker> jsInvoker)
|
|
115
|
+
convertJSIArrayToNSArray(jsi::Runtime &runtime, const jsi::Array &value, std::shared_ptr<CallInvoker> jsInvoker, BOOL useNSNull)
|
|
116
116
|
{
|
|
117
117
|
size_t size = value.size(runtime);
|
|
118
118
|
NSMutableArray *result = [NSMutableArray new];
|
|
119
119
|
for (size_t i = 0; i < size; i++) {
|
|
120
120
|
// Insert kCFNull when it's `undefined` value to preserve the indices.
|
|
121
|
-
id convertedObject = convertJSIValueToObjCObject(runtime, value.getValueAtIndex(runtime, i), jsInvoker);
|
|
121
|
+
id convertedObject = convertJSIValueToObjCObject(runtime, value.getValueAtIndex(runtime, i), jsInvoker, useNSNull);
|
|
122
122
|
[result addObject:convertedObject ? convertedObject : (id)kCFNull];
|
|
123
123
|
}
|
|
124
124
|
return [result copy];
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
static NSDictionary *
|
|
128
|
-
convertJSIObjectToNSDictionary(jsi::Runtime &runtime, const jsi::Object &value, std::shared_ptr<CallInvoker> jsInvoker)
|
|
128
|
+
convertJSIObjectToNSDictionary(jsi::Runtime &runtime, const jsi::Object &value, std::shared_ptr<CallInvoker> jsInvoker, BOOL useNSNull)
|
|
129
129
|
{
|
|
130
130
|
jsi::Array propertyNames = value.getPropertyNames(runtime);
|
|
131
131
|
size_t size = propertyNames.size(runtime);
|
|
@@ -133,7 +133,7 @@ convertJSIObjectToNSDictionary(jsi::Runtime &runtime, const jsi::Object &value,
|
|
|
133
133
|
for (size_t i = 0; i < size; i++) {
|
|
134
134
|
jsi::String name = propertyNames.getValueAtIndex(runtime, i).getString(runtime);
|
|
135
135
|
NSString *k = convertJSIStringToNSString(runtime, name);
|
|
136
|
-
id v = convertJSIValueToObjCObject(runtime, value.getProperty(runtime, name), jsInvoker);
|
|
136
|
+
id v = convertJSIValueToObjCObject(runtime, value.getProperty(runtime, name), jsInvoker, useNSNull);
|
|
137
137
|
if (v) {
|
|
138
138
|
result[k] = v;
|
|
139
139
|
}
|
|
@@ -159,11 +159,14 @@ convertJSIFunctionToCallback(jsi::Runtime &rt, jsi::Function &&function, std::sh
|
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, std::shared_ptr<CallInvoker> jsInvoker)
|
|
162
|
+
id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, std::shared_ptr<CallInvoker> jsInvoker, BOOL useNSNull)
|
|
163
163
|
{
|
|
164
|
-
if (value.isUndefined() || value.isNull()) {
|
|
164
|
+
if (value.isUndefined() || (value.isNull() && !useNSNull)) {
|
|
165
165
|
return nil;
|
|
166
166
|
}
|
|
167
|
+
if (value.isNull() && useNSNull) {
|
|
168
|
+
return [NSNull null];
|
|
169
|
+
}
|
|
167
170
|
if (value.isBool()) {
|
|
168
171
|
return @(value.getBool());
|
|
169
172
|
}
|
|
@@ -176,17 +179,22 @@ id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, s
|
|
|
176
179
|
if (value.isObject()) {
|
|
177
180
|
jsi::Object o = value.getObject(runtime);
|
|
178
181
|
if (o.isArray(runtime)) {
|
|
179
|
-
return convertJSIArrayToNSArray(runtime, o.getArray(runtime), jsInvoker);
|
|
182
|
+
return convertJSIArrayToNSArray(runtime, o.getArray(runtime), jsInvoker, useNSNull);
|
|
180
183
|
}
|
|
181
184
|
if (o.isFunction(runtime)) {
|
|
182
185
|
return convertJSIFunctionToCallback(runtime, o.getFunction(runtime), jsInvoker);
|
|
183
186
|
}
|
|
184
|
-
return convertJSIObjectToNSDictionary(runtime, o, jsInvoker);
|
|
187
|
+
return convertJSIObjectToNSDictionary(runtime, o, jsInvoker, useNSNull);
|
|
185
188
|
}
|
|
186
189
|
|
|
187
190
|
throw std::runtime_error("Unsupported jsi::Value kind");
|
|
188
191
|
}
|
|
189
192
|
|
|
193
|
+
id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value, std::shared_ptr<CallInvoker> jsInvoker)
|
|
194
|
+
{
|
|
195
|
+
return convertJSIValueToObjCObject(runtime, value, jsInvoker, NO);
|
|
196
|
+
}
|
|
197
|
+
|
|
190
198
|
static jsi::Value createJSRuntimeError(jsi::Runtime &runtime, const std::string &message)
|
|
191
199
|
{
|
|
192
200
|
return runtime.global().getPropertyAsFunction(runtime, "Error").call(runtime, message);
|
|
@@ -46,6 +46,9 @@ void TextAttributes::apply(TextAttributes textAttributes) {
|
|
|
46
46
|
allowFontScaling = textAttributes.allowFontScaling.has_value()
|
|
47
47
|
? textAttributes.allowFontScaling
|
|
48
48
|
: allowFontScaling;
|
|
49
|
+
maxFontSizeMultiplier = !std::isnan(textAttributes.maxFontSizeMultiplier)
|
|
50
|
+
? textAttributes.maxFontSizeMultiplier
|
|
51
|
+
: maxFontSizeMultiplier;
|
|
49
52
|
dynamicTypeRamp = textAttributes.dynamicTypeRamp.has_value()
|
|
50
53
|
? textAttributes.dynamicTypeRamp
|
|
51
54
|
: dynamicTypeRamp;
|
|
@@ -168,6 +171,7 @@ bool TextAttributes::operator==(const TextAttributes& rhs) const {
|
|
|
168
171
|
rhs.accessibilityRole,
|
|
169
172
|
rhs.role,
|
|
170
173
|
rhs.textTransform) &&
|
|
174
|
+
floatEquality(maxFontSizeMultiplier, rhs.maxFontSizeMultiplier) &&
|
|
171
175
|
floatEquality(opacity, rhs.opacity) &&
|
|
172
176
|
floatEquality(fontSize, rhs.fontSize) &&
|
|
173
177
|
floatEquality(fontSizeMultiplier, rhs.fontSizeMultiplier) &&
|
|
@@ -224,6 +228,10 @@ SharedDebugStringConvertibleList TextAttributes::getDebugProps() const {
|
|
|
224
228
|
"allowFontScaling",
|
|
225
229
|
allowFontScaling,
|
|
226
230
|
textAttributes.allowFontScaling),
|
|
231
|
+
debugStringConvertibleItem(
|
|
232
|
+
"maxFontSizeMultiplier",
|
|
233
|
+
maxFontSizeMultiplier,
|
|
234
|
+
textAttributes.maxFontSizeMultiplier),
|
|
227
235
|
debugStringConvertibleItem(
|
|
228
236
|
"dynamicTypeRamp", dynamicTypeRamp, textAttributes.dynamicTypeRamp),
|
|
229
237
|
debugStringConvertibleItem(
|
|
@@ -51,6 +51,7 @@ class TextAttributes : public DebugStringConvertible {
|
|
|
51
51
|
std::optional<FontStyle> fontStyle{};
|
|
52
52
|
std::optional<FontVariant> fontVariant{};
|
|
53
53
|
std::optional<bool> allowFontScaling{};
|
|
54
|
+
Float maxFontSizeMultiplier{std::numeric_limits<Float>::quiet_NaN()};
|
|
54
55
|
std::optional<DynamicTypeRamp> dynamicTypeRamp{};
|
|
55
56
|
Float letterSpacing{std::numeric_limits<Float>::quiet_NaN()};
|
|
56
57
|
std::optional<TextTransform> textTransform{};
|
|
@@ -117,6 +118,7 @@ struct hash<facebook::react::TextAttributes> {
|
|
|
117
118
|
textAttributes.opacity,
|
|
118
119
|
textAttributes.fontFamily,
|
|
119
120
|
textAttributes.fontSize,
|
|
121
|
+
textAttributes.maxFontSizeMultiplier,
|
|
120
122
|
textAttributes.fontSizeMultiplier,
|
|
121
123
|
textAttributes.fontWeight,
|
|
122
124
|
textAttributes.fontStyle,
|
|
@@ -910,6 +910,7 @@ constexpr static MapBuffer::Key TA_KEY_LINE_BREAK_STRATEGY = 25;
|
|
|
910
910
|
constexpr static MapBuffer::Key TA_KEY_ROLE = 26;
|
|
911
911
|
constexpr static MapBuffer::Key TA_KEY_TEXT_TRANSFORM = 27;
|
|
912
912
|
constexpr static MapBuffer::Key TA_KEY_ALIGNMENT_VERTICAL = 28;
|
|
913
|
+
constexpr static MapBuffer::Key TA_KEY_MAX_FONT_SIZE_MULTIPLIER = 29;
|
|
913
914
|
|
|
914
915
|
// constants for ParagraphAttributes serialization
|
|
915
916
|
constexpr static MapBuffer::Key PA_KEY_MAX_NUMBER_OF_LINES = 0;
|
|
@@ -1004,6 +1005,10 @@ inline MapBuffer toMapBuffer(const TextAttributes& textAttributes) {
|
|
|
1004
1005
|
builder.putBool(
|
|
1005
1006
|
TA_KEY_ALLOW_FONT_SCALING, *textAttributes.allowFontScaling);
|
|
1006
1007
|
}
|
|
1008
|
+
if (!std::isnan(textAttributes.maxFontSizeMultiplier)) {
|
|
1009
|
+
builder.putDouble(
|
|
1010
|
+
TA_KEY_MAX_FONT_SIZE_MULTIPLIER, textAttributes.maxFontSizeMultiplier);
|
|
1011
|
+
}
|
|
1007
1012
|
if (!std::isnan(textAttributes.letterSpacing)) {
|
|
1008
1013
|
builder.putDouble(TA_KEY_LETTER_SPACING, textAttributes.letterSpacing);
|
|
1009
1014
|
}
|
|
@@ -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(
|
|
@@ -135,6 +135,7 @@ inline static CGFloat RCTBaseSizeForDynamicTypeRamp(const DynamicTypeRamp &dynam
|
|
|
135
135
|
inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const TextAttributes &textAttributes)
|
|
136
136
|
{
|
|
137
137
|
if (textAttributes.allowFontScaling.value_or(true)) {
|
|
138
|
+
CGFloat fontSizeMultiplier = !isnan(textAttributes.fontSizeMultiplier) ? textAttributes.fontSizeMultiplier : 1.0;
|
|
138
139
|
if (textAttributes.dynamicTypeRamp.has_value()) {
|
|
139
140
|
DynamicTypeRamp dynamicTypeRamp = textAttributes.dynamicTypeRamp.value();
|
|
140
141
|
UIFontMetrics *fontMetrics =
|
|
@@ -142,10 +143,11 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex
|
|
|
142
143
|
// Using a specific font size reduces rounding errors from -scaledValueForValue:
|
|
143
144
|
CGFloat requestedSize =
|
|
144
145
|
isnan(textAttributes.fontSize) ? RCTBaseSizeForDynamicTypeRamp(dynamicTypeRamp) : textAttributes.fontSize;
|
|
145
|
-
|
|
146
|
-
} else {
|
|
147
|
-
return textAttributes.fontSizeMultiplier;
|
|
146
|
+
fontSizeMultiplier = [fontMetrics scaledValueForValue:requestedSize] / requestedSize;
|
|
148
147
|
}
|
|
148
|
+
CGFloat maxFontSizeMultiplier =
|
|
149
|
+
!isnan(textAttributes.maxFontSizeMultiplier) ? textAttributes.maxFontSizeMultiplier : 0.0;
|
|
150
|
+
return maxFontSizeMultiplier >= 1.0 ? fminf(maxFontSizeMultiplier, fontSizeMultiplier) : fontSizeMultiplier;
|
|
149
151
|
} else {
|
|
150
152
|
return 1.0;
|
|
151
153
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native",
|
|
3
|
-
"version": "0.78.0-rc.
|
|
3
|
+
"version": "0.78.0-rc.4",
|
|
4
4
|
"description": "A framework for building native apps using React",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -108,13 +108,13 @@
|
|
|
108
108
|
},
|
|
109
109
|
"dependencies": {
|
|
110
110
|
"@jest/create-cache-key-function": "^29.6.3",
|
|
111
|
-
"@react-native/assets-registry": "0.78.0-rc.
|
|
112
|
-
"@react-native/codegen": "0.78.0-rc.
|
|
113
|
-
"@react-native/community-cli-plugin": "0.78.0-rc.
|
|
114
|
-
"@react-native/gradle-plugin": "0.78.0-rc.
|
|
115
|
-
"@react-native/js-polyfills": "0.78.0-rc.
|
|
116
|
-
"@react-native/normalize-colors": "0.78.0-rc.
|
|
117
|
-
"@react-native/virtualized-lists": "0.78.0-rc.
|
|
111
|
+
"@react-native/assets-registry": "0.78.0-rc.4",
|
|
112
|
+
"@react-native/codegen": "0.78.0-rc.4",
|
|
113
|
+
"@react-native/community-cli-plugin": "0.78.0-rc.4",
|
|
114
|
+
"@react-native/gradle-plugin": "0.78.0-rc.4",
|
|
115
|
+
"@react-native/js-polyfills": "0.78.0-rc.4",
|
|
116
|
+
"@react-native/normalize-colors": "0.78.0-rc.4",
|
|
117
|
+
"@react-native/virtualized-lists": "0.78.0-rc.4",
|
|
118
118
|
"abort-controller": "^3.0.0",
|
|
119
119
|
"anser": "^1.4.9",
|
|
120
120
|
"ansi-regex": "^5.0.0",
|
package/react-native.config.js
CHANGED
|
@@ -84,12 +84,18 @@ const codegenCommand = {
|
|
|
84
84
|
name: '--outputPath <path>',
|
|
85
85
|
description: 'Path where generated artifacts will be output to.',
|
|
86
86
|
},
|
|
87
|
+
{
|
|
88
|
+
name: '--source <string>',
|
|
89
|
+
description: 'Whether the script is invoked from an `app` or a `library`',
|
|
90
|
+
default: 'app',
|
|
91
|
+
},
|
|
87
92
|
],
|
|
88
93
|
func: (argv, config, args) =>
|
|
89
94
|
require('./scripts/codegen/generate-artifacts-executor').execute(
|
|
90
95
|
args.path,
|
|
91
96
|
args.platform,
|
|
92
97
|
args.outputPath,
|
|
98
|
+
args.source,
|
|
93
99
|
),
|
|
94
100
|
};
|
|
95
101
|
|
|
@@ -899,11 +899,12 @@ function generateFBReactNativeSpecIOS(projectRoot /*: string */) /*: void*/ {
|
|
|
899
899
|
* @parameter projectRoot: the directory with the app source code, where the package.json lives.
|
|
900
900
|
* @parameter baseOutputPath: the base output path for the CodeGen.
|
|
901
901
|
* @parameter targetPlatform: the target platform. Supported values: 'android', 'ios', 'all'.
|
|
902
|
+
* @parameter source: the source that is invoking codegen. Supported values: 'app', 'library'.
|
|
902
903
|
* @throws If it can't find a config file for react-native.
|
|
903
904
|
* @throws If it can't find a CodeGen configuration in the file.
|
|
904
905
|
* @throws If it can't find a cli for the CodeGen.
|
|
905
906
|
*/
|
|
906
|
-
function execute(projectRoot, targetPlatform, baseOutputPath) {
|
|
907
|
+
function execute(projectRoot, targetPlatform, baseOutputPath, source) {
|
|
907
908
|
try {
|
|
908
909
|
codegenLog(`Analyzing ${path.join(projectRoot, 'package.json')}`);
|
|
909
910
|
|
|
@@ -951,9 +952,12 @@ function execute(projectRoot, targetPlatform, baseOutputPath) {
|
|
|
951
952
|
platform,
|
|
952
953
|
);
|
|
953
954
|
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
955
|
+
if (source === 'app') {
|
|
956
|
+
// These components are only required by apps, not by libraries
|
|
957
|
+
generateRCTThirdPartyComponents(libraries, outputPath);
|
|
958
|
+
generateCustomURLHandlers(libraries, outputPath);
|
|
959
|
+
generateAppDependencyProvider(outputPath);
|
|
960
|
+
}
|
|
957
961
|
|
|
958
962
|
cleanupEmptyFilesAndFolders(outputPath);
|
|
959
963
|
}
|
|
@@ -25,7 +25,12 @@ const argv = yargs
|
|
|
25
25
|
alias: 'outputPath',
|
|
26
26
|
description: 'Path where generated artifacts will be output to.',
|
|
27
27
|
})
|
|
28
|
+
.option('s', {
|
|
29
|
+
alias: 'source',
|
|
30
|
+
description: 'Whether the script is invoked from an `app` or a `library`',
|
|
31
|
+
default: 'app',
|
|
32
|
+
})
|
|
28
33
|
.usage('Usage: $0 -p [path to app] -t [target platform] -o [output path]')
|
|
29
34
|
.demandOption(['p', 't']).argv;
|
|
30
35
|
|
|
31
|
-
executor.execute(argv.path, argv.targetPlatform, argv.outputPath);
|
|
36
|
+
executor.execute(argv.path, argv.targetPlatform, argv.outputPath, argv.source);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|