Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49187
`tolower` is not `constexpr`. Share some quick utilities for char to lowercase, and case insensitive comparision that does not create new string.
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D69134770
fbshipit-source-id: 57a84f2d1a441e5a4c07c0db96cb6c133770fb51
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49186
Next up for transforms, and for some future cases, it is convenient to be able to export a single marker type like `CSSTransform`, that can expand to a variant of multiple possible types of different shape (e.g. `CSSMatrix3D` vs `CSSScale`).
It is also best (for code size) to only have a single representation of compound types (e.g. `<CSSLength, CSSPercentage>` generates a separate copy of code compared to `<CSSPercentage, CSSLength>`).
This diff introduces `CSSCompoundDataTypes` which allows composing types, which are then flattened out to discrete types during parsing. For simplicity, `CSSCompoundDataType` cannot currently be nested inside of other `CSSCompoundDataType`, though this could be added in the future.
```
/**
* Marker for the <length-percentage> data type
* https://drafts.csswg.org/css-values/#mixed-percentages
*/
using CSSLengthPercentage = CSSCompoundDataType<CSSLength, CSSPercentage>;
```
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D69089416
fbshipit-source-id: 8645009f06eb14b1ac4437a4fc4dd6b9ad3f88a2
Summary:
This centralizes the invocation of yarn install to be via the `actions/yarn-install`.
It will make it easier to add a retry if we want for all the `yarn install` steps in all the workflows.
## Changelog:
[INTERNAL] -
Pull Request resolved: https://github.com/facebook/react-native/pull/49174
Test Plan: CI
Reviewed By: NickGerleman
Differential Revision: D69121525
Pulled By: cortinico
fbshipit-source-id: 135da2e172cdf95b2a0ef8fd3d25996ab9317167
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49155
This does some code cleanup for CSS keywords to reduce boilerplate, duplication, better isolate namespace, fix a typo, and ensure we get a warning (unused variable) if we miss handling a defined keyword.
We technically don't need `CSSKeyword` at all anymore, and don't need to overlay each keywords values to be the same, though having a pattern where each keyword set uses ordinal values from CSSKeyword forces folks to look and add the enum to the list, and include the header defining the data types for keyword sets, instead of each set looking a little magic.
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D69083181
fbshipit-source-id: b2764e87c2a127d73f816327c4edd45151ea8d82
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49151
This diff is... maybe an argument against a global list of interned keywords (it works better in some other contexts though), and this structure is likely to change later when we reintroduce what was previously `CSSPropertyDescriptor` (a list of allowed keywords per property).
But... we're going to roll with this for now to replace the ViewConfig processor (which string splits) in the most over-engineered way possible.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D68851566
fbshipit-source-id: 71022f051b112adc03bd182d433e3d890e6023f2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49152
For parsing a variable number of whitespace separated data types.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D68849561
fbshipit-source-id: be3314990d9e7c202c02deba463d79e50985c0b7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48991
This adds support for parsing the `<shadow>` data type. In combination with `CSSCommaSeparatedList`, we can now parse box shadow expressions.
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D68744811
fbshipit-source-id: bac7be0faf8cd8eee04f21651180151edeef7294
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48987
Adds a data type parser for a variable number of values of a given single data type (at least 1).
E.g. `CSSCommaSeparatedList<CSSShadow>` will represent the syntax of `<shadow>#` (ie the value produced by box-shadow).
Changelog: [internal]
Reviewed By: lenaic
Differential Revision: D68738165
fbshipit-source-id: 6dd17b3da24b1c24808e49834a29a237c0115fab
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48986
This adds a new `consume()` function to data type parsers which passes a raw parser. This can be used for types which are compounds of other data types, where we may want to accept more than the first token.
This will be used for shadow parsing, but also fixes a hypothetical future bug with ratios. E.g. `calc(foo) / calc(bar)` may be a valid ratio, not starting with a token. We instead just want to try to parse a number data type from the stream.
The form of parsing a preserved token + rest is removed, with the assumption that anything parsing more than a single token should use compound parsing.
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D68735370
fbshipit-source-id: 660e0b4a496136c8a559f4ba47bc1bd8d17aa116
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48985
This reverts some of the behavior I added in D68357624, since peeking a component value is non-obviously more expensive than manually copying the parser, and needing to peek will be a pain for flat lists of values (like for box-shadow).
Changelog: [internal]
Reviewed By: lenaic
Differential Revision: D68733518
fbshipit-source-id: 7b4a061d1649019274441ae0e82609f771dd2916
Summary:
Support distributing Expo Dev Clients to TestFlight. Expo Dev Clients are like custom versions of Expo Go that you can use to connect to a dev server or test remote updates with. Currently they can only be distributed through AdHoc provisioning because Apple rejects the use of private symbols. The symbols in question are used for simulator builds to support reloading when the "R" key is pressed (amongst other features). This is not imperative since there are a number of systems for reloading the app such as pressing R in the CLI window, but it's also not relevant to a physical phone where there is no keyboard.
## Changelog:
[IOS] [FIXED] - Remove private symbols for non-simulator and non-catalyst builds.
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
Pull Request resolved: https://github.com/facebook/react-native/pull/49154
Test Plan:
- I built an deployed an app with this patch enabled to TestFlight to ensure the submission wouldn't fail. This can be reproduced locally with:
- `npx create-expo`
- Add the patch (ensure it's set with a `prepare` script).
- Following `eas.json`:
```json
{
"cli": {
"version": ">= 14.7.0",
"appVersionSource": "remote"
},
"build": {
"development": {
"developmentClient": true,
"resourceClass": "large",
"autoIncrement": true
},
"production": {
"autoIncrement": true
}
},
"submit": {
"production": {},
"development": {}
}
}
```
- Then building and deploying to TestFlight: `npx eas-cli@latest build -p ios -s --profile development`
Reviewed By: huntie
Differential Revision: D69106388
Pulled By: cipolleschi
fbshipit-source-id: 773a897ff5061929367b72188f06a08213c7dd46
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49161
Avoid special strings, and default to null to mean undefined or unknown. This save us from bridging an unnecessary string but also makes the fallback name for logging network requests clearer.
Changelog: [Internal]
Reviewed By: bgirard
Differential Revision: D69058211
fbshipit-source-id: d83f424e0c2c23842554a8e4e616cad39719f311
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49125
Changelog: [internal]
This adds support for taking JS memory heap snapshots from Fantom tests via `Fantom.saveJSMemoryHeapSnapshot`. This can be used in one-off tests to do memory analysis and determine the existence of leaks:
```
// Warm up
Fantom.saveJSMemoryHeapSnapshot('/path/to/my/1.heapsnapshot');
// Do work
Fantom.saveJSMemoryHeapSnapshot('/path/to/my/2.heapsnapshot');
// Clean up
Fantom.saveJSMemoryHeapSnapshot('/path/to/my/3.heapsnapshot');
```
Load these snapshots in Chrome and select "Objects allocated between 1 and 2" in the dropdown to see the potentially leaked objects.
In the future we could introduce additional utilities to analyze the snapshots and do the detection automatically, e.g.:
```
// Warm up
const baseline = Fantom.takeJSMemoryHeapSnapshot();
// Do work
const before = Fantom.takeJSMemoryHeapSnapshot();
// Clean up
const after = Fantom.takeJSMemoryHeapSnapshot();
const leaks = findMemoryLeaks(baseline, before, after);
expect(leaks.sizeKB()).toBeLessThan(THRESHOLD);
```
Reviewed By: rshest
Differential Revision: D68953788
fbshipit-source-id: 6b3899297837c582a7b7235909d59b3e1631913d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49140
Similar to the change made in `useAnimatedProps`, except for `useAnimatedPropsMemo`. (This is just split out to make the changes easier to review.)
Changelog:
[Internal]
Reviewed By: javache
Differential Revision: D69058338
fbshipit-source-id: 033853673d8fe1442b37bb0c0adc7cb22557c334
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49143
Within the implementation of Animated, the `allowlist` value passed into `unstable_createAnimatedComponent` and `useAnimatedProps` is stable, meaning that it cannot change from commit to commit. However, this semantic is not codified because `allowlist` is a prop.
This refactors `useAnimatedProps` to be created by a new `createAnimatedPropsHook` function which accepts an `allowlist` argument, codifying that its value is stable for the lifetime of the hook returned.
This permits React to avoid checking whether `allowlist` has changed from commit to commit.
For now, I've left `useAnimatedProps` as a deprecated module that returns a hook with an empty `allowlist`.
Changelog:
[Internal]
Reviewed By: javache
Differential Revision: D69058336
fbshipit-source-id: dbcf4ca4e389f3682864a9794eacbe0af23659db
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49121
This change removes the scripts/circleci folder and the last poll-maven script which was not used.
## Changelog:
[Internal] - Remove the circleci folder script
Reviewed By: cortinico, huntie
Differential Revision: D69047603
fbshipit-source-id: a4f1f100d71d792edf42c8d4cb6a0b8d8e7e5260
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49123
Previously, we used to have CI workflows scripts in a `react-native/scripts/circleci` folder.
Now that we are not using CircleCI anymore, we move those scripts to the `.github/workflow-scripts` folder.
## Changelog:
[Internal] - Move ci scripts to the `.github/workflow-scripts` folder
Reviewed By: cortinico, huntie
Differential Revision: D69047581
fbshipit-source-id: 6a5d8525e526cc7521d42e2be9530deb09914fdc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49122
This change updates the Release testing and the release scripts by removing any reference to CircleCI
## Changelog:
[Internal] - Remove CircleCI references from Release and Release testing scripts
Reviewed By: cortinico, huntie
Differential Revision: D69047479
fbshipit-source-id: 14a394b879c03cd81a8d043036c43839a38602c7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49119
This change removes the .circleci folder and the workflow that we run on CircleCI
## Changelog:
[Internal] - Remove CircleCI config
Reviewed By: cortinico, huntie
Differential Revision: D69047483
fbshipit-source-id: 0020a4ff69d035e939e01079059ba2743aee55fe
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49118
We finished the migration away from CircleCI, so we are cleaning up the codebase.
This change updates references to CircleCI from gradle.
## Changelog:
[Internal] - Remove references from CircleCI in RNGP
Reviewed By: cortinico
Differential Revision: D69047484
fbshipit-source-id: 4ab40be62e6769eb3a8f65136464eed6628d47a4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49101
Changelog: [internal]
We can move this out of the deprecated directory. Also added a `.npmignore` entry so this won't be published to npm with the package.
Reviewed By: lenaic
Differential Revision: D68896208
fbshipit-source-id: ec85236aeeabdc9abcd870f0f4c1322eeb3cc659
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49100
Changelog: [internal]
This API isn't part of the DOM standard so can be moved out.
Reviewed By: huntie
Differential Revision: D68896484
fbshipit-source-id: 5d275beb909ce5c5ce0eddb6c6e04cf7491aa1cb
Summary:
Fixes a `ConcurrentModificationException` when iterating over `TextWatcher` `mListeners` array.
If you open Android open source code (`TextView` class), then we can see that Android iterates with `for/n` loop (not `for/:`):
```java
void sendAfterTextChanged(Editable text) {
if (mListeners != null) {
final ArrayList<TextWatcher> list = mListeners;
final int count = list.size();
for (int i = 0; i < count; i++) {
list.get(i).afterTextChanged(text);
}
}
notifyListeningManagersAfterTextChanged();
hideErrorIfUnchanged();
}
```
<hr>
We can catch the `ConcurrentModificationException` with old code, when for example we have 3 listeners:
- 0 is `EmojiTextWatcher` (seems like it's added by OS);
- 1 is `OnlyChangeIfRequiredMaskedTextChangedListener` (added by `react-native-text-input-mask`);
- 2 is a listener that attached by `react-native-keyboard-controller`.
On every afterTextChanged [input-mask-android](https://github.com/RedMadRobot/input-mask-android/tree/df452edc0c52a37e5082adcfc3d05d77b5aa34e8) [removes](https://github.com/RedMadRobot/input-mask-android/blob/df452edc0c52a37e5082adcfc3d05d77b5aa34e8/inputmask/src/main/kotlin/com/redmadrobot/inputmask/MaskedTextChangedListener.kt#L212) the listener and [adds](https://github.com/RedMadRobot/input-mask-android/blob/df452edc0c52a37e5082adcfc3d05d77b5aa34e8/inputmask/src/main/kotlin/com/redmadrobot/inputmask/MaskedTextChangedListener.kt#L231) it back.
The oversimplified version of the code can be next:
```java
public class MyClass {
public static void main(String args[]) {
ArrayList<Integer> mListeners = new ArrayList<>();
mListeners.add(0);
mListeners.add(1);
mListeners.add(2);
Iterator<Integer> iterator = mListeners.iterator();
while (iterator.hasNext()) {
Integer listener = iterator.next();
// Check if the listener is equal to 1
// 1 is OnlyChangeIfRequiredMaskedTextChangedListener and we simulate the behavior of this class
if (listener == 1) {
int i = mListeners.indexOf(listener);
if (i >= 0) {
mListeners.remove(i);
}
// Add the removed element at the end
mListeners.add(listener);
}
}
// Print the modified list
System.out.println(mListeners);
}
}
```
Key points are:
- if we have only [0, 1] listener, then it works well and `ConcurrentModificationException` will not be thrown, because we modify last element;
- if we have `[0, 1, 2]` then exception will be thrown.
So in this PR I decided to re-work code to match what Android has. With `for/n` approach `ConcurrentModificationException` will not be thrown, because we don't check array immutability in this case.
More information also can be found here: https://github.com/kirillzyusko/react-native-keyboard-controller/issues/324
## Changelog:
[ANDROID] [CHANGED] - avoid `ConcurrentModificationException` when iterating over `mListeners` `TextWatcher` array
Pull Request resolved: https://github.com/facebook/react-native/pull/49109
Reviewed By: cortinico
Differential Revision: D69050984
Pulled By: javache
fbshipit-source-id: 9c6a7a428467fa5e546d70549dfcc91d6b2e58d2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49132
Follows D68780147 and D68953084. We're able to safely remove this API by relocating the implementation into the one dependent internal test call site.
Changelog: [Internal]
Reviewed By: rubennorte
Differential Revision: D69049203
fbshipit-source-id: 82c4b15d7f6736aed21171eeec1c197d2f34b33e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49072
We have instance of apps crashing when enabling the New Architecture because of the TurboModule interop layer.
What's happening is that when the module is loaded, the TM Interop Layer tries to parse the method definition to expose them in JS. However, for some libraries in the Legacy Architecture, it is possible to define a method in Objective-C and to define a different signature in Swift.
For example, the [`RNBluetoothClassic` library](https://github.com/kenjdavidson/react-native-bluetooth-classic) defines a selector in objective-c which [has the signature](https://github.com/kenjdavidson/react-native-bluetooth-classic/blob/main/ios/RNBluetoothClassic.m#L134-L136)
```
RCT_EXTERN_METHOD(available: (NSString *)deviceId
resolver: (RCTPromiseResolveBlock)resolve
rejecter: (RCTPromiseRejectBlock)reject)
```
And the method is inmplemented in Swift with [the signature](https://github.com/kenjdavidson/react-native-bluetooth-classic/blob/main/ios/RNBluetoothClassic.swift#L502-L505):
```
func availableFromDevice(
_ deviceId: String,
resolver resolve: RCTPromiseResolveBlock,
rejecter reject: RCTPromiseRejectBlock
)
```
When the TurboModule interop layer tries to parse the method, it receives the `accept:resolver:rejecter:` signature, but that signature is not actually defined in as a method in the module instance, and it crashes.
This crash was not happening in the Old Architecture, which was handling this case gracefully. Notice that the specific method from the example is not working in the Old Architecture either. However, the app is not crashing in the old architecture.
This change adds the same graceful behaviors plus it adds a warning in development to notify the developer about which methods couldn't be found in the interface.
Fixes:
- https://github.com/facebook/react-native/issues/47587
- https://github.com/facebook/react-native/issues/48065
## Changelog:
[iOS][Fixed] - Avoid crashing the app when the InteropLayer can't find some methods in the native implementation.
Reviewed By: javache
Differential Revision: D68901734
fbshipit-source-id: 844d1bf29423d5c601b583540e86d57dfffd1428
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49041
Prevent the class of issues seen in D68797482 by making `#if FOO` where `FOO` is not defined an error.
Changelog: [Internal]
Reviewed By: NickGerleman, sammy-SC
Differential Revision: D68824244
fbshipit-source-id: 1291c5f2f84ecb023ba76a015716cc7c9ae0f89e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49127
These tests are marked as noexcept, but they can indeed throw exceptions: they trigger synchronous commits, which may cause exceptions in the mounting layer.
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D69049587
fbshipit-source-id: 02c6187c8d0e043c9840aad9c9e4d27866898b4a
Summary:
As pointed out by RyanCommits the ReactNativeFactory PR removed `enableFixForViewCommandRace` feature flag by mistake. Reference: https://github.com/facebook/react-native/pull/46298/files
This PR re-adds the feature flag.
## Changelog:
[IOS] [FIXED] - Re-enable enableFixForViewCommandRace feature flag
Pull Request resolved: https://github.com/facebook/react-native/pull/49126
Test Plan: Not needed, the feature flag was there before refactor.
Reviewed By: huntie
Differential Revision: D69049668
Pulled By: cipolleschi
fbshipit-source-id: b7bf382c76878e72619145283fa8cc2c1046b486
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49081
Follows D68780147. We are depending on this API in one internal E2E test. Rename as `__setInterceptor_DO_NOT_USE`.
Changelog: [Internal]
Reviewed By: rubennorte
Differential Revision: D68953084
fbshipit-source-id: 66b685a90b6e7f18646752dc90892963d16f9a83