Summary:
In our Codegen generators, we were using `codegenModuleName` to refer to the name of the spec file. Calling this `hasteModuleName` makes it more clear what this name refers to (i.e: the name of the spec file). This diff performs that rename.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D24386282
fbshipit-source-id: fe2beda9a0abf63a5cf88fa0664f83416c9f1aa2
Summary:
The previous implementation always replaced the prop set on every props update coming from Animated. Now, we merge the new set of props with the previous one.
Changelog: [Internal] Fabric-specific internal change.
Reviewed By: sammy-SC
Differential Revision: D24370751
fbshipit-source-id: 779272d47c776cc42071d3c93d06443b6c96a877
Summary:
The specific file filtering in the CLI only covers the case where the input is a directory. We should filter when files are provided as well.
Changelog: [Internal]
Reviewed By: hramos
Differential Revision: D24399225
fbshipit-source-id: 186e39c157faf90bdd825ec5c5860017d49e9404
Summary:
On Hermes, RN can directly use the Promise from global w/o the need of polyfilling it.
PromiseRejectionTrackingOptions are extracted to its own file so it can be shared by
both codepaths and preserve the behaviors that it's only imported on dev.
Some zero-overhead type gymnastics are used to flow-type it properly.
Changelog:
[General] - made promise polyfill conditionalized on Hermes
Reviewed By: cpojer
Differential Revision: D24068716
fbshipit-source-id: 3e0b1675493908324f27cc5b7300d8cc42a03acc
Summary:
In Chrome, there's a garbage can icon in the memory profiler page that you can
click to force a garbage collection.
Hermes was previously not responding to that button. Add support for this inspector
message type.
The collection it starts is fully synchronous and will block JS from running. It typically
completes quite fast for small heaps, and about 1 second for heaps over 100 MB big.
Changelog:
[Internal][Added] Add support for garbage collection during heap profiling with Hermes
Reviewed By: neildhar
Differential Revision: D24349262
fbshipit-source-id: fe62b8df4d2b67ab3930e5d57f94478b2a88a549
Summary:
So that it's easier for C++ targets to depend on libglog.so for debugging purpose.
Changelog: [Internal]
Differential Revision: D24382033
fbshipit-source-id: 00ad6b2365d571583d6d1aaa40fac2c96974abf1
Summary:
The GenerateModuleJavaSpec.js mistakenly treated nullable getConstants() properties as required, such that the Java spec will throw an exception when the properties are missing. This fixed it.
Note that the JavaPoet-based generator got this correct already.
Changelog: [Internal]
Differential Revision: D24381941
fbshipit-source-id: c95d2181c66443e2191318f09b6454a5296009e4
Summary:
Fixed URL of ChainReactConf website on the ECOSYSTEM.md
## 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
-->
[Internal] [Fixed] - Fix URL of ChainReactConf Website
Pull Request resolved: https://github.com/facebook/react-native/pull/30199
Test Plan: URL leads to the ChainReactConf website
Reviewed By: makovkastar
Differential Revision: D24386708
Pulled By: cpojer
fbshipit-source-id: 27a48e84547ef3bc067845b3c302dd57decc34b2
Summary:
#changelog: [internal]
When I built ThreadStorage I didn't know about existence of `thread_local` keyword. Because it achieves the same goal, using built in c++ features is preferred over building our own.
Reviewed By: JoshuaGross, shergin
Differential Revision: D24380680
fbshipit-source-id: e961fc34c6d3f085fc9b918b20bb4827de0d5624
Summary:
The NativeModules spec parser uses `moduleName` to refer to the name of the NativeModule spec. This is confusing, because the NativeModules spec also has a `moduleNames` array, which refers to names of the NativeModules that get required in the spec.
This diff renames `moduleName` to `hasteModuleName` within the NativeModule spec parser.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D24386279
fbshipit-source-id: 8e4eb8dfc647241bf2bdae54dc8d9ab0122f49f9
Summary:
If a native module schema has `excludedPlatforms` defined, honor it and skip the module that doesn't belong to the platform.
E.g. NativeImagePickerIOS shouldn't generate anything for Android codegen output.
Similarly, IntentAndroid shouldn't generate anything for iOS codegen output.
Changelog: [Internal]
Reviewed By: RSNara
Differential Revision: D24373092
fbshipit-source-id: cfeb455a18c92f60191d988af2e9ce7ea5021304
Summary:
Some existing NativeModules have either Android or IOS suffix to denote the exclusive intent for that platform. For now, note this in the codegen schema output, so that the generator can skip irrelevant modules. Long term, each Flow type for module Spec should denote the intended/excluded platforms directly.
Changelog: [Internal]
Reviewed By: RSNara
Differential Revision: D24370568
fbshipit-source-id: 8f725bdb39107d73c1aba0689db7f47ed7c374b0
Summary:
The manual lookup logic was needed before we properly parse the module names from the spec js files. This is no longer necessary after the commit stack starting with 3a75b376cc
Changelog: [Internal]
Reviewed By: RSNara
Differential Revision: D24370567
fbshipit-source-id: fc307d93cdda240a977e37dfe602502bd3f7c2a4
Summary:
Fabric has a feature that preallocates views before mounting even need them. We never tested the impact of this feature thought. This diff adds a way to enable/disable it and run an experiment.
Changelog: [Internal] Fabric-specific internal change.
Reviewed By: JoshuaGross
Differential Revision: D24355612
fbshipit-source-id: fefd653e57232044cd7b28b160e12a4ef85dbb8b
Summary:
Changelog:
[General][Added] - Adds the Hermes runtime bytecode version number to the JS bundle requestURL. This allows Metro with Bytecode to work with prebuilt binaries.
Reviewed By: cpojer
Differential Revision: D24327852
fbshipit-source-id: e8ee8db4f9b01f0500ab9dd851b5818c4adf3303
Summary:
Adding support to the pointData to Android React Native
Changelog: [internal]
Reviewed By: swillard13
Differential Revision: D24256346
fbshipit-source-id: b970f771047cff580d9ebe7d6e2ad737394d6416
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).
## Changes
1. NativeModule generators now use the new RN Codegen NativeModule schema.
2. Tangential: We're no longer removing the `Native` prefix from the NativeModule filename, assuming that that's the module name (problem: wrong), and prefixing again with Native (problem: redundant), when we're generating code. Instead, like the internal codegen, we simply pass the filename to the Codegen output. Our linters enforce that all NativeModule specs are contained with files that start off with `Native`.
3. `GenerateModuleCpp` was fixed to use the actual module name as opposed to the spec name. I added a comment inline.
Changelog: [Internal]
(Note: this ignores all push blocking failures!)
Reviewed By: PeteTheHeat
Differential Revision: D24236405
fbshipit-source-id: ccd6b5674d252c350be0ec8a86e7ca5f2f614778
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).
Changelog: [Internal]
(Note: this ignores all push blocking failures!)
Reviewed By: PeteTheHeat
Differential Revision: D24236504
fbshipit-source-id: 0ca70101a855fb713fa15ed63849b138eb73dc6c
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).
## Changes
Previously, the "Module" schema could either contain a `components` property, or a `nativeModules` property. The existence of the `components` property was used to determine (1) if the generators would run and (2) filter schemas on which the generators would run. Now, we simply check whether the type of the "Module" schema is `Component`.
Changelog: [Internal]
(Note: this ignores all push blocking failures!)
Reviewed By: PeteTheHeat
Differential Revision: D24236508
fbshipit-source-id: 68cb3f25178b6757c9a4aee767bb6173db4932a6
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).
Changelog: [Internal]
(Note: this ignores all push blocking failures!)
Reviewed By: PeteTheHeat
Differential Revision: D24236507
fbshipit-source-id: 2ffa0414db731a6ee844a2d1a5b07dc32bc763cb
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).
Changelog: [Internal]
(Note: this ignores all push blocking failures!)
Reviewed By: PeteTheHeat
Differential Revision: D24236502
fbshipit-source-id: 288c6d9588bde177732fe8165d3374eeacad999d
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).
Changelog: [Internal]
(Note: this ignores all push blocking failures!)
Reviewed By: PeteTheHeat
Differential Revision: D24236509
fbshipit-source-id: 1b603e8728d7be1e8bdede5878f57d6556b5c52f
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).
## Changes
1. Update the RN Codegen Module Parser
2. Update all RN Codegen Module Parser Jest tests & snapshots.
Changelog: [Internal]
(Note: this ignores all push blocking failures!)
Reviewed By: PeteTheHeat
Differential Revision: D24236505
fbshipit-source-id: e24a39b4837c75a90fb4c957c56dfcf789511cc9
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).
## Changes
1. Update the RN Codegen Component Parser
2. Update all RN Codegen Component Parser snapshots.
Changelog: [Internal]
(Note: this ignores all push blocking failures!)
Reviewed By: PeteTheHeat
Differential Revision: D24236503
fbshipit-source-id: 975d97dd29bb5ca08e5de96e7814290c3dc4357b
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).
## Description
The Codegen deals with "Modules". Hence:
```
type SchemaType = {
modules: {
[moduleName]: ...
}
};
```
Each "Module" has a name, and represents a file. The `moduleName` is the base name of the file. This file can contain a component specification or a NativeModule specification. Hence:
```
type SchemaType = {
modules: {
[moduleName]: ComponentSchema | NativeModuleSchema
}
};
```
The `ComponentSchema` can contain specifications for many different components. Hence:
```
type ComponentSchema = {
type: 'Component'
components: {
[componentName]: ComponentShape
}
}
```
The `NativeModuleSchema` contains
1. Type aliases (no surprises/nothing new).
2. One Flow interface that extends `TurboModule`.
3. Potentially many different NativeModule requires (for now) via `TurboModuleRegistry.get(Enforcing)?<specName>('moduleName')`.
Hence, the shape looks like:
```
type NativeModuleSchema = {
type: 'NativeModule',
aliases: NativeModuleAliasMap, // nothing new
spec: NativeModuleSpec,
moduleNames: $ReadOnlyArray<string>
}
type NativeModuleSpec = {
properties: $ReadOnlyArray<...>,
}
```
## Major Notes
1. We now parse the NativeModule requires (TurboModuleRegistry.get(Enforcing)?<Spec> calls) and record them in the schema.
2. A Codegen "Module" can contain either a Component schema, or a NativeModule schema, but **not** both.
## Snapshot Updates
The changes to the schema are visible in the snapshots updated in D24236505.
Changelog: [Internal]
(Note: this ignores all push blocking failures!)
Reviewed By: fkgozali
Differential Revision: D24236510
fbshipit-source-id: bd344d67136418725d840e7332fd2f6957326bb4
Summary:
changelog: [internal]
Prevents 2 type converions:
1. int <-> size_t
2. int <-> int32_t
# Why is using size_t better when working with indexes.
## 1. Type conversion isn't for free.
Take this example
```
size_t calculate(int number) {
return number + 1;
}
```
It generates following assembly (generated with armv8-a clang 10.0.0):
```
calculate(int): // calculate(int)
sub sp, sp, #16 // =16
str w0, [sp, #12]
ldr w8, [sp, #12]
add w9, w8, #1 // =1
mov w8, w9
sxtw x0, w8
add sp, sp, #16 // =16
ret
```
That's 9 instructions.
If we get rid of type conversion:
```
size_t calculate(size_t number) {
return number + 1;
}
```
Assembly (generated with armv8-a clang 10.0.0):
```
calculate(unsigned long): // calculate(unsigned long)
sub sp, sp, #16 // =16
str x0, [sp, #8]
ldr x8, [sp, #8]
add x0, x8, #1 // =1
add sp, sp, #16 // =16
ret
```
Compiler now produces only 7 instructions.
## Semantics
When using int for indexing, the type doesn't say much. By using `size_t`, just by looking at the type, it gives the reader more information about where it is coming from.
Reviewed By: JoshuaGross
Differential Revision: D24332248
fbshipit-source-id: 87ef982829ec14906ed9e002ea2e875fda4a0cd8
Summary:
In D24324247 (56c363e39a), I split NativeLinking into NativeLinkingManager and NativeIntentAndroid. There was this line in NativeLinking.js, that I didn't migrate correctly:
```
export default ((Platform.OS === 'android'
? TurboModuleRegistry.getEnforcing<Spec>('IntentAndroid')
: TurboModuleRegistry.getEnforcing<Spec>('LinkingManager')): Spec);
```
I separated this conditional statement into two others:
```
export default TurboModuleRegistry.getEnforcing<Spec>('IntentAndroid');
export default TurboModuleRegistry.getEnforcing<Spec>('LinkingManager');
```
The problem here is that now on iOS, we're hard requiring IntentAndroid, and on Android, we're hard requiring LinkingManager. Understandably, this started throwing errors in our e2e infra. This diff fixes this problem by:
1. Changing the relevant `getEnforcing` calls into `get` calls.
2. Wrapping all usages of NativeIntentAndroid, and NativeLinkingManager, which are already guarded by `Platform.OS` checks, by a nullthrows. This should satisfy flow. **Note:** NativeIntentAndroid is only used on Android, where it must be available. Similarly, NativeLinkingManager is only used on iOS, where it must be available.
Changelog: [Internal]
build-break
overriding_review_checks_triggers_an_audit_and_retroactive_review
Oncall Short Name: fbandroid_sheriff
Differential Revision: D24338558
fbshipit-source-id: b0d22cba77e67837834269deaa317dc73d2457dc
Summary:
We will need it soon.
Changelog: [Internal] Fabric-specific internal change.
Reviewed By: sammy-SC
Differential Revision: D24290775
fbshipit-source-id: a312e537a3c3954e709a10c8792b3462b574054a
Summary:
RCTSurfaceTouchHandler is not a thread-safe object and must be used (and initialized) on the main thread. Therefore we need to move the initialization to `view` method which is guaranteed to be called on the main thread.
Changelog: [Internal] Fabric-specific internal change.
Reviewed By: sammy-SC
Differential Revision: D24290776
fbshipit-source-id: fc1f2f157599aff6fca053451f89bf7cca3c812a
Summary:
Changelog: [internal]
Fabric uses view commands instead of setNativeProps. This diff removes what's left of setNativeProps from the core.
Reviewed By: JoshuaGross
Differential Revision: D24309999
fbshipit-source-id: 70e54f0a984f8c36f77ba2cd59f59fc6923bc832
Summary:
Although the interface for both NativeModules is the same, we'd like to enforce 1 `TurboModuleRegistry.get` call per NativeModule spec file. Therefore this diff splits the one spec into two.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D24325260
fbshipit-source-id: f18718e4235b7b8ccbfc44a7e48571ecf483a36c
Summary:
The iOS and Android NativeModules are very different. It's better to split the two interfaces, than to have one merged interface.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D24324247
fbshipit-source-id: 097273829ffc719eff006ed2dde55f0dd6bd7d95
Summary:
This NativeModule is actualy not used! Removing this now.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D24324362
fbshipit-source-id: 1322c5e072961f1c6c54bfc6dbd562d42f9e5b3f
Summary:
The codegen output for the native modules in `Libraries/` has been verified to work with RNTester.
Publishing a new version as a prerequisite to start using the codegen at build time in open source.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D24314972
fbshipit-source-id: edd0066c1cf33ba8e536cc5f145c057ca992eec1
Summary:
RCTNetworking.startObserving and RCTNetworking.stopObserving don't exist. The main purpose of RCTEventEmitter.addListener is to call these methods, and increment the `_listeners` counter, so that we can start dispatching events when `_listeners > 0`. In D24272560, I made RCTEventEmitter dispatch events even when _listeners <= 0. This is sufficient for us to stop calling these two RCTNetworking methods entirely.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D24272663
fbshipit-source-id: de9c968bc71e6e6d69a22b934644e6dfa3266b3f
Summary:
## Rationale
For every 1 call to RCTNetworking.sendRequest, we execute 6 calls to RCTNetworking.addListener. This is followed by at least one call to RCTNetworking.removeListeners. Aside from incrementing and decrementing the `_listeners` integer, these two methods accomplish nothing else: RCTNetworking doesn't implement the `startObserving` and `stopObserving` methods.
This diff makes RCTEventEmitter dispatch events without looking at the listeners integer. In the future, this will allow us to stop making these ~8 unnecessary NativeModule calls for every Network request we send.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D24272560
fbshipit-source-id: 7996eba5abfa4669a89c43a3ffa536c0faa214a8
Summary:
With Xcode 12 being the latest, Detox 15.x has issues - in particular, it means that if you try to `yarn install` the dependencies for the repo, you'll be greeted by this error:
```bash
error /<stuff>/react-native/node_modules/detox: Command failed.
Exit code: 1
Command: node scripts/postinstall.js
Arguments:
Directory: /<stuff>/react-native/node_modules/detox
Output:
/<stuff>/Library/Detox/ios/5824c837515589f21c08f09b716a6eda088aa31f was found, but could not find Detox.framework inside it. This means that the Detox framework build process was interrupted.
deleting /<stuff>/Library/Detox/ios/5824c837515589f21c08f09b716a6eda088aa31f and trying to rebuild.
Extracting Detox sources...
Building Detox.framework from /<stuff>/Developer/OSS/react-native/node_modules/detox/ios_src...
child_process.js:637
throw err;
^
```
With the {emoji:1f44d} of hramos & alloy I've prep'd up a small defensive PR that can be quickly merged before cutting 0.64, that bumps the version of Detox from 15.4.4 to the highest version available within the reach of "no breaking changes" in changelog.
The main reason why with 16.x this error doesn't happen is that from [16.0.0](https://github.com/wix/Detox/releases/tag/16.0.0):
> Detox now comes as a prebuilt framework on iOS, thus lowering npm install times and saving some build issues that happen due to unexpected Xcode setups.
It would have been better to update directly to latest (at the time of writing 17.7.1) but there are at least two versions that had changelogs that seem to involve bigger changes:
* https://github.com/wix/Detox/releases/tag/17.4.7
* https://github.com/wix/Detox/releases/tag/16.8.0
Hopefully CI will will show that the bump doesn't break any test �
## 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
-->
[Internal] [Changed] - Bumped Detox in the repo to 16.7.2 for Xcode 12 compatibility
Pull Request resolved: https://github.com/facebook/react-native/pull/30084
Test Plan: Running yarn in the main repo with Node 14 & Xcode 12, without this change, will cause the error copy-pasted above. After upgrading to this version, the error disappear.
Reviewed By: cpojer
Differential Revision: D24293226
Pulled By: hramos
fbshipit-source-id: 2b4d23b033be621274966262ec19200bee44df58
Summary: Changelog: [RN][iOS] Allow gate to be set for Fabric logging from the React Module
Reviewed By: fkgozali
Differential Revision: D24256546
fbshipit-source-id: 7b290efb9abd3035559f743e6e5b6701e02053e1
Summary:
This diff ended up being a bit more complicated than I anticipated, since the source files in `ReactInternal` were depending on `RCTEventDispatcher`. I made the following changes:
1. Make `RCTEventDispatcher` a `protocol`, keep it in `ReactInternal`.
2. Rename the `RCTEventDispatcher` NativeModule to `RCTEventDispatcherModule`, make it conform to the `RCTEventEmitter` `protocol`, and move it to `CoreModules`.
3. Where necessary, replace categories of `RCTEventDispatcher` with functions.
Changelog:
[iOS][Added] - Make RCTEventDispatcher TurboModule-comaptible
Reviewed By: fkgozali
Differential Revision: D18439488
fbshipit-source-id: b3da15c29459fddf884519f33b0c3b8c036b5539
Summary:
There are a few places where we have JNI table ref leaks, and more places where we can aggressively clean up smart pointers immediately instead of waiting for them to be cleaned up at some later point.
In theory these smart pointers should be cleaned up immediately, but in cases where many components are being measured at once, the JNI table could grow until all measure calls are done. In extreme cases this
could cause a crash, which I want to avoid. At the very least, freeing memory more aggressively in this case can't hurt.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D24293775
fbshipit-source-id: 159741ba955e5a6fe02caf6e65d1e4d6d4afadee
Summary:
This should fix a race condition uncovered by ASAN build that results in `m_shutdown` being referenced after destruction.
This mirrors a similar fix made in react-native-macos: ea7767a211
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D24263156
fbshipit-source-id: 5fb1e7053c107dfb7050242fce8fcf0435e5592c
Summary: This completes the Picker stack. Use a handwritten view config to avoid calling `requireNativeComponent` in Bridgeless mode.
Differential Revision: D23663596
fbshipit-source-id: 5d0811014fd6f66956803a1db5fee8fd1119d5bc
Summary:
This builds on the last diff to remove type a type union from Picker. This diff focuses on Picker internals.
Changelog: [JS] Remove type union in PickeriOS/PickerNativeComponent
Reviewed By: sammy-SC
Differential Revision: D24254615
fbshipit-source-id: f788a2e123135c1e8b9909870c40f53b2dea0227
Summary:
Flow type unions don't play well with Fabric components. This diff removes a union in `Picker.js` and fixes all the flow errors.
Before this diff, all these surfaces would crash with the new Fabric Picker impl, because the impl asserts that this field is a string.
Reviewed By: sammy-SC
Differential Revision: D24236317
fbshipit-source-id: 6e646c84fcd16658aaabe5e93507f5f33b346a65
Summary:
This adds support for a controlled `<Picker/>` component .
Changelog: [iOS][Fabric] Fabric Picker support
Reviewed By: sammy-SC
Differential Revision: D24005475
fbshipit-source-id: c50e9918f74f6ef5cdfbfe67cb6c132c12d64916
Summary:
This adds support for `<Picker style={}/>` prop for text styling. It reuses most of conversion logic from BaseText. This means that it actually supports more styles than Paper Picker supported. (Paper picker only supported ~4 styles, this supports everything that Text supports, so 10+ styles).
The only tricky thing is that Picker supports multiple ways of setting text color. Both
<Picker
itemStyle={{color: '#008BD0'}} >
<Picker.Item label="Java" value="java" />
<Picker.Item label="JavaScript" value="js" />
</Picker>
and
<Picker>
<Picker.Item label="Java" value="java" color={'#008BD0'} />
<Picker.Item label="JavaScript" value="js" />
</Picker>
technically work in Paper. I've decided to maintain this behaviour (since there's lots of product code callsites to both options).
Changelog: [iOS][Fabric] Fabric Picker support
Reviewed By: sammy-SC
Differential Revision: D23980319
fbshipit-source-id: e469a837e28af0ad97cf0e171df26ee19adff3ab