react-native 0.78.0-rc.1 → 0.78.0-rc.3

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.
@@ -17,7 +17,7 @@ const version: $ReadOnly<{
17
17
  major: 0,
18
18
  minor: 78,
19
19
  patch: 0,
20
- prerelease: 'rc.1',
20
+ prerelease: 'rc.3',
21
21
  };
22
22
 
23
23
  module.exports = {version};
@@ -477,7 +477,15 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image, CGSize size, CGFloat scal
477
477
 
478
478
  // Add missing png extension
479
479
  if (request.URL.fileURL && request.URL.pathExtension.length == 0) {
480
- mutableRequest.URL = [request.URL URLByAppendingPathExtension:@"png"];
480
+ // Check if there exists a file with that url on disk already
481
+ // This should fix issue https://github.com/facebook/react-native/issues/46870
482
+ if ([[NSFileManager defaultManager] fileExistsAtPath:request.URL.path]) {
483
+ mutableRequest.URL = request.URL;
484
+ } else {
485
+ // This is the default behavior in case there is no file on disk with no extension.
486
+ // We assume that the extension is `png`.
487
+ mutableRequest.URL = [request.URL URLByAppendingPathExtension:@"png"];
488
+ }
481
489
  }
482
490
  if (_redirectDelegate != nil) {
483
491
  mutableRequest.URL = [_redirectDelegate redirectAssetsURL:mutableRequest.URL];
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(78),
26
26
  RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"rc.1",
27
+ RCTVersionPrerelease: @"rc.3",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -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;IZ)V
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 {
@@ -7342,6 +7342,7 @@ public class com/facebook/react/views/text/TextAttributeProps {
7342
7342
  public static final field TA_KEY_LETTER_SPACING S
7343
7343
  public static final field TA_KEY_LINE_BREAK_STRATEGY S
7344
7344
  public static final field TA_KEY_LINE_HEIGHT S
7345
+ public static final field TA_KEY_MAX_FONT_SIZE_MULTIPLIER S
7345
7346
  public static final field TA_KEY_OPACITY S
7346
7347
  public static final field TA_KEY_ROLE S
7347
7348
  public static final field TA_KEY_TEXT_DECORATION_COLOR S
@@ -7374,6 +7375,7 @@ public class com/facebook/react/views/text/TextAttributeProps {
7374
7375
  protected field mLetterSpacingInput F
7375
7376
  protected field mLineHeight F
7376
7377
  protected field mLineHeightInput F
7378
+ protected field mMaxFontSizeMultiplier F
7377
7379
  protected field mNumberOfLines I
7378
7380
  protected field mOpacity F
7379
7381
  protected field mRole Lcom/facebook/react/uimanager/ReactAccessibilityDelegate$Role;
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.78.0-rc.1
1
+ VERSION_NAME=0.78.0-rc.3
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -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("android", path, host, port, mDevSettings.isHotModuleReplacementEnabled());
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(String platform, String bundleEntry, String host, int port, boolean isEnabled);
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);
@@ -18,5 +18,5 @@ public class ReactNativeVersion {
18
18
  "major", 0,
19
19
  "minor", 78,
20
20
  "patch", 0,
21
- "prerelease", "rc.1");
21
+ "prerelease", "rc.3");
22
22
  }
@@ -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
- setLetterSpacing(mLetterSpacingInput);
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;
@@ -18,7 +18,7 @@ constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 78;
20
20
  int32_t Patch = 0;
21
- std::string_view Prerelease = "rc.1";
21
+ std::string_view Prerelease = "rc.3";
22
22
  } ReactNativeVersion;
23
23
 
24
24
  } // namespace facebook::react
@@ -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
- return [fontMetrics scaledValueForValue:requestedSize] / requestedSize;
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.1",
3
+ "version": "0.78.0-rc.3",
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.1",
112
- "@react-native/codegen": "0.78.0-rc.1",
113
- "@react-native/community-cli-plugin": "0.78.0-rc.1",
114
- "@react-native/gradle-plugin": "0.78.0-rc.1",
115
- "@react-native/js-polyfills": "0.78.0-rc.1",
116
- "@react-native/normalize-colors": "0.78.0-rc.1",
117
- "@react-native/virtualized-lists": "0.78.0-rc.1",
111
+ "@react-native/assets-registry": "0.78.0-rc.3",
112
+ "@react-native/codegen": "0.78.0-rc.3",
113
+ "@react-native/community-cli-plugin": "0.78.0-rc.3",
114
+ "@react-native/gradle-plugin": "0.78.0-rc.3",
115
+ "@react-native/js-polyfills": "0.78.0-rc.3",
116
+ "@react-native/normalize-colors": "0.78.0-rc.3",
117
+ "@react-native/virtualized-lists": "0.78.0-rc.3",
118
118
  "abort-controller": "^3.0.0",
119
119
  "anser": "^1.4.9",
120
120
  "ansi-regex": "^5.0.0",
@@ -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
- generateRCTThirdPartyComponents(libraries, outputPath);
955
- generateCustomURLHandlers(libraries, outputPath);
956
- generateAppDependencyProvider(outputPath);
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