Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51788
Adds `flow` to the remaining files that are lacking it in the `packages/rn-tester` directory.
This also adds any necessary type annotations and fixes lint warnings.
Changelog:
[Internal]
Reviewed By: SamChou19815
Differential Revision: D75899307
fbshipit-source-id: 27a74ed0007b3b754446a45931c2c148312d5e3a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50832
Changelog: [iOS][Breaking]
these experiences did not end up shipping, so cleaning them up.
Reviewed By: fkgozali
Differential Revision: D73343958
fbshipit-source-id: ff0dc1394748c897aed9c66513b250dfc2192e0d
Summary:
Depracated usage of scrollInsets + an unused param.
## Changelog:
[INTERNAL] [FIXED] - Switch to verticalScrollIndicatorInsets and mark unused value as __unused in test file
Pull Request resolved: https://github.com/facebook/react-native/pull/47314
Test Plan:
Running the specific test itself, it passes:
<img width="1092" alt="Screenshot 2024-10-30 at 18 02 08" src="https://github.com/user-attachments/assets/e3ed27c6-9f00-4777-a72c-92f0da93a79f">
Reviewed By: NickGerleman
Differential Revision: D65231365
Pulled By: philIip
fbshipit-source-id: eed795ad65bd837fb9f38175081d961245ff3932
Summary:
Fix entails using non-synthesized getter, such that underlying backing is an std::atomic<RCTNetworkTaskStatus>.
In the greater scheme of things, I believe `RCTNetworkTask` should be improved as it has several `nonatomic` properties that are read and written to on different threads. Thread safety of this class seems to have been addressed on a per property basis, judging from the employment of `std::mutex` elsewhere in the implementation.
This is an attempt at fixing https://github.com/facebook/react-native/issues/44687.
## Changelog:
[iOS][FIXED] - Fix data race related to access on `RCTNetworkTask.status`.
Pull Request resolved: https://github.com/facebook/react-native/pull/44694
Test Plan: Added unit test in class `RCTNetworkTaskTests`.
Reviewed By: cortinico
Differential Revision: D59217353
Pulled By: javache
fbshipit-source-id: 1af77238ddd99db21e2e53f174a81e207d5832b2
Summary:
The fix entails making `AllocationTestModule.valid` an Objective-C atomic property and funneling access to the ivar via the synthesized property getter and setter.
While the data race was present in test code, it would make it more difficult to spot more severe data races with the TSan. Also, getting rid of a data race is always good.
## Changelog:
[iOS][Fixed] - Data race related to access of `AllocationTestModule.valid`
Pull Request resolved: https://github.com/facebook/react-native/pull/45191
Test Plan: `RCTAllocationTests` will test the implementation of `AllocationTestModule`.
Reviewed By: christophpurrer
Differential Revision: D59155083
Pulled By: javache
fbshipit-source-id: e3217cffd0801377a25f04bf8ed0b4e2d1d88498
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41182
Changelog: [Internal]
in my quest to get rid of all synthesized methodQueues, we have RCTBlobManager which exposes its underlying execution queue. in this diff, i add a config that replaces that queue with one that is managed by the module itself instead of the one generated by the infra.
Reviewed By: cipolleschi
Differential Revision: D50587693
fbshipit-source-id: 993a13c617afe48c3989d8cd5ad5fbda050603f4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40748
The ordering of `onLayout` events is non-deterministic on iOS Paper, due to nodes being added to an `NSHashTable` before iteration, instead of an ordered collection.
We don't do any lookups on the collection, so I think this was chosen over `NSMutableArray` for the sake of `[NSHashTable weakObjectsHashTable]`, to avoid retain/release. Using a collection which does retain/release seems to cause a crash due to double release or similar, so those semantics seem intentional (though I'm not super familiar with the model here).
We can replicate the memory semantics with ordering by using `NSPointerArray` (which is unfortunately not parameterized). This change does that, so we get consistently top-down layout events (matching Fabric, and Android Paper as of D49627996). This lets us use multiple layout events to calculate right/bottom edge insets deterministically.
Changelog:
[iOS][Changed] - Deterministic onLayout event ordering for iOS Paper
Reviewed By: luluwu2032
Differential Revision: D50093411
fbshipit-source-id: f6a9d5c973b97aede879baa8b952cc1be2447f28
Summary:
This PR is another one made with the intent to reduce the number of diffs between React Native and React Native macOS.
In https://github.com/facebook/react-native/commit/f7219ec02d71d2f0f6c71af4d5c3d4850a898fd8#diff-d091f6636e07dc62dd7d892489355707c43923ac15056fd2eb59d9a297d576a6 , we introduced `kRCTPlatformName`, which had already been in React Native macOS for a while (since we ifdef to either "ios" or "macos" in a number of places). This change moves the string up to a common header (dropping the "k" prefix) so we can refactor other strings that currently have a hardcoded "platform=ios" inside them.
## Changelog:
[IOS] [CHANGED] - Add RCTPlatformName to RCTConstants.h
Pull Request resolved: https://github.com/facebook/react-native/pull/39141
Test Plan: CI should pass
Reviewed By: NickGerleman
Differential Revision: D48656197
Pulled By: lunaleaps
fbshipit-source-id: b9ff08e2591d7553a1a452795f36d4405ddaa5b1
Summary:
See: http://blog.nparashuram.com/2019/10/debugging-react-native-ios-apps-with.html
When using direct debugging with JavaScriptCore, Safari Web Inspector doesn't pick up the source map over the network. Instead, as far as I can tell, it expects you to pass the source URL at the time you load your bundle: https://developer.apple.com/documentation/javascriptcore/jscontext/1451384-evaluatescript?language=objc . This leads to a very sub-par developer experience debugging the JSbundle directly. It will however, pick up an inline source map. Therefore, let's add a way to have React Native tell metro to request an inline source map.
I did this by modifying `RCTBundleURLProvider` to have a new query parameter for `inlineSourceMap`, and set to true by default for JSC.
## Changelog:
[IOS] [ADDED] - Added support to inline the source map via RCTBundleURLProvider
Pull Request resolved: https://github.com/facebook/react-native/pull/37878
Test Plan:
I can put a breakpoint in RNTester, via Safari Web Inspector, in human readable code :D
<img width="1728" alt="Screenshot 2023-06-14 at 4 09 03 AM" src="https://github.com/facebook/react-native/assets/6722175/055277fa-d887-4566-9dc6-3ea07a1a60b0">
Reviewed By: motiz88
Differential Revision: D46855418
Pulled By: huntie
fbshipit-source-id: 2134cdbcd0a3e81052d26ed75f83601ae4ddecfe
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37886
When using the native driver for animations that involve layout changes (ie. translateY and other transforms, but not styles such as opacity), because it bypasses Fabric, the new coordinates are not updated so the Pressability responder region/tap target is incorrect
**This diff:**
- Returning the final values from the native side, at the same place it sets the "finished" flag. This gets sent to JS in `animated/animations/Animation.js`.
Changelog:
[iOS][Changed] - return animated values to JS for natively driven animations
Reviewed By: rshest
Differential Revision: D46709214
fbshipit-source-id: f16f36a05cd052d1120ba6e04ec6dd72eb4a98e5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37103
Re backout the fix as there are some edge cases not handled properly internally.
## Changelog:
[iOS][Fixed] - Revert change in URL escaping
Reviewed By: javache, sammy-SC, rshest
Differential Revision: D45309232
fbshipit-source-id: d9f473d1f6409beb1069d9af7e649ee5b1b06d6e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36949
This change is a second attempt at fixing URL encoding and escaping that was already tried [here](https://github.com/facebook/react-native/commit/2b4e1f5ece7d160935b19d4862af8706a44cee59).
We had to roll it back due to some internal tests failing as it looks like Jest is manipulating the URL somehow.
We manage to replicate the issue, which occur when we pre-decode a url even if it is not partially encoded (we were too aggrsssive).
This fix ensure that we pre-decode the urls only if they present some `%` characters.
The problem here was that the e2e tests sends some urls with some `%` symbol which does not belongs to an escape sequence. For example: `anna://launch?height=25%`.
The previous code (v1) was trying to unescape this case. V2 fixes this.
This change should also fix#28508 for good.
## Changelog:
[iOS][Fixed] - Properly escape URLs
Reviewed By: mdvacca
Differential Revision: D45078923
fbshipit-source-id: 010a5c173784f8341a1a08bcbd06a6ad14299c75
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36898
This changes are a followup from D42281798 and the task T141309497.
In the previous diff, we were able to handle most cases thanks to `NSURLComponents`. `NSURLComponents` provides us with more flexibility so that we could handle the missing cases.
## Changelog:
[iOS][Fixed] - Handle doulbe `#` and partially escaped urls
Reviewed By: sammy-SC
Differential Revision: D44958172
fbshipit-source-id: 03628d86966c149d0785ad90fdbccbcb5e70106e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36795
This change bump the min iOS version for React Native to 13.4, to align with company guidelines.
## Changelog:
[iOS][Changed] - Moved the min iOS version to 13.4
Reviewed By: cortinico
Differential Revision: D44634663
fbshipit-source-id: 035e8fcbb395f7394f8253e3ec485ad9937531c2
Summary:
Changelog: [General][Removed] Remove experimental support for loading bytecode from Metro
Removes the experimental bundling strategy that offloads Hermes bytecode compilation to the packager server. The React Native parts of this experiment were never part of the public API, and the Metro parts never fully shipped in open source.
Followup from D43597007.
Reviewed By: robhogan
Differential Revision: D43604705
fbshipit-source-id: db3be553750ccbf286d876f75858299c5b750f19
Summary:
This is a change we have implemented in React Native macOS that I am now upstreaming: https://github.com/microsoft/react-native-macos/pull/1257
The library `ocMock` is currently imported as a checked in binary by RN-Tester to help run unit tests on iOS. That binary is only compiled for x86 on macOS, which meant we could not run tests on M1 / M2 Macs. Switching it so that we import from source as a pod should make maintenance easier for both iOS and macOS! :)
Original change notes:
>Previously, we've been unable to test RNTester for macOS on an M1 machine. This is because we were using a framework that was prebuilt for Intel architecture, so the test components would fail to build.
>
> The fix is to build OCMock from source directly instead of using a prebuilt version.
>
> This is only necessary on macOS. The iOS version is already built for ARM architecture, as iOS devices have been running exclusively on ARM for a while now.
## Changelog
[INTERNAL] [CHANGED] - Import OCMock as a pod
Pull Request resolved: https://github.com/facebook/react-native/pull/36239
Test Plan: CI should pass as it did before.
Reviewed By: dmytrorykun
Differential Revision: D43732219
Pulled By: cipolleschi
fbshipit-source-id: 028b5a7f384042145bf1966c8c2730d7437940ec
Summary:
Color support for AnimatedInterpolation was incomplete with native drivers, as only rgba type strings were supported. There was also an issue where color props instead a StyleAnimatedNode would never get applied. We were also potentially duplicating color parsing support, which is already centralized in normalizeColor / processColor.
Changelog: [iOS][Added] Enable AnimatedInterpolation to interpolate arbitrary color types.
Reviewed By: philIip
Differential Revision: D41649337
fbshipit-source-id: 505ba555b6a79113635fdfb35c6fe69c92d82234
Summary:
Color support for AnimatedInterpolation was incomplete with native drivers, as only rgba type strings were supported. There was also an issue where color props instead a StyleAnimatedNode would never get applied. We were also potentially duplicating color parsing support, which is already centralized in normalizeColor / processColor.
Changelog: [iOS][Added] Enable AnimatedInterpolation to interpolate arbitrary color types.
Reviewed By: sammy-SC
Differential Revision: D40632443
fbshipit-source-id: 4dfb29edca4b919474408b43c3917ac9406a147a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35106
This Diff remove the assert on the initializer in the EventEmitter in place of a more idiomatic check when the method is invoked.
It aims to solve an internal error and promotes best practices for the iOS platform.
## Changelog:
[iOS][Changed] Refactor RCTEventEmitter initialization
Reviewed By: sammy-SC
Differential Revision: D40762253
fbshipit-source-id: 83d26616ce147914948e536e9e4b1010758fb690
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35123
**Context**
On RN Desktop, images can be copy/pasted into text inputs.
When copy/pasting local files w/ semi-colons in the filename (`/downloads/devices:pre-call-IMG_346C38284B2B-1.jpeg`), RN would throw this error.
{F785684529}
The error was due to no having the correct asset loader due to the local file path being parsed incorrectly.
To parse the url, we convert the string URI to a `NSURL` using a custom convertor fn.
The conversion was matching any `:` and assuming it was a network url scheme:
https://www.internalfb.com/code/archon_react_native_macos/[fde4113acd89fb13ee11636c48b59eac49c21bae]/React/Base/RCTConvert.m?lines=97-111
When an image path with `:` in the name was passed to this, it was assuming it was a valid network url and not file path.
Because this is a local filepath, the image path needs to be a filesystem url. Since this was parsed as network url, it did not have the `file://` prefix and would not pass this check, causing the loader to throw.l
https://www.internalfb.com/code/fbsource/%5B60d9d5e67383%5D/xplat/js/react-native-github/Libraries/Image/RCTImageLoader.mm?lines=220-230
## Changelog
[iOS] [Added] - Add support for parsing files w/ `:` in filename
Reviewed By: christophpurrer, philIip
Differential Revision: D40729963
fbshipit-source-id: 2f3adcabc8f0f1f22cbfca69c3484e72b1d93d25
Summary:
`_labelsForTags` is an array with string labels used only for local profiling, that we had to manually keep it in sync with `RCTPLTag`. Refactor so labels are assigned with switch instead.
Changelog: [iOS] Refactor: Assign string label to each case in RCTPLTag enum for startup performance logging
Reviewed By: fkgozali
Differential Revision: D32889043
fbshipit-source-id: 81da592a160a31b91e78289be0990cc2ff960f29
Summary:
a year ago or so, there was a change that updated the way RCTBundleURLProvider creates the IP url depending on if HERMES_BYTECODE_VERSION existed, and this test was never updated, so fixing it accordingly
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D32638669
fbshipit-source-id: 3824b90570f60ad5299939b09b99fb56d2b3ddaa
Summary:
we couldn't run the RNTesterUnitTests before because these tests didn't respect the nullability specification. after this diff, we can run the tests.
as for the tests.... well 2 are still failing, i'm taking a look at them.
Changelog:
[iOS][Fixed] - fixed RCTImageLoaderTests
Reviewed By: sammy-SC
Differential Revision: D32635689
fbshipit-source-id: d68ae6a3e7f1370d7d76d68c7a6d9812928e6c12
Summary:
As we're working on C++ code for RNTester to integrate Fabric, we should enable CLANGFORMAT for the files over there.
Changelog:
[Internal] [Changed] - Enable CLANGFORMAT on fbsource/xplat/js/react-native-github/packages
Reviewed By: ShikaSD
Differential Revision: D32493605
fbshipit-source-id: 7b5d63f6d2fae1a1aa1e782738953c8cd2cdbe4b
Summary:
i saw this a lot in the codebase, it's not optimal bc we're using two selectors when we only need one.
fastmod --extensions m,mm '\[\[(.*) alloc] init]' '[${1} new]' --dir xplat/js/react-native-github/*
i manually updated the callsites that this codemod couldn't handle (e.g., where there were more than one of these instances in a single line)
Changelog: [Internal]
Reviewed By: RSNara
Differential Revision: D31776561
fbshipit-source-id: 1b16da240e8a79b54da67383d548921b82b05a9f
Summary:
This migrates all ObjC NativeModule setBridge: calls to the bridge compatible initialize: call. I filtered out ViewManagers.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D28595520
fbshipit-source-id: b0e5dd681fb3563894f1aa3da1728f0c694f04bb
Summary:
This diff removes all synthesize invokeJS = _invokeJS calls, and instead funnels them through synthesize callableJSModules = _callableJSModules. Now, all these NativeModules shouldn't have different branching in bridgeless mode vs bridge mode.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D28395445
fbshipit-source-id: 41a58d54c60be55e6bf5031e5417728f5eb6285c
Summary:
`RCTPropsAnimatedNode` uses the bridge to access it's current surface presenter to perform animations.
In bridgeless mode, the surface presenter is not owned by the bridge. Instead, pass the surface presenter through the ownership chain:
`RCTNativeAnimated*Module` -> `RCTNativeAnimatedNodesManager` -> `RCTPropsAnimatedNode`
`RCTSurfacePresenter` should not be strongly held by any of these animation internals. If it gets destroyed at a higher level, animations should not be completed.
Changelog: [Internal]
Differential Revision: D23272735
fbshipit-source-id: ce08ee3b59ac2ba70e31cebb7ba8e9f3a644c848
Summary:
## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->
This PR aims to migrate the RNTester App to `packages` directory. But is currently, open to inspect the CI issues and resolve the merge conflicts.
Currently done
- Working on iOS
- Working on Android
- Detox Tests working on iOS
Need to work on
- Errors generated by the CI builds
[General] [Changed] - Migrated the RNTester App to the packages directory.
Pull Request resolved: https://github.com/facebook/react-native/pull/29567
Test Plan: It runs on both ios and android for now and the detox iOS builds are working.
Reviewed By: cpojer
Differential Revision: D23034761
Pulled By: rickhanlonii
fbshipit-source-id: e04bb06e1c7ef15d340206090d1575a871b9e6f5