Summary:
LocalData isn't used by any components. We've moved towards State.
Changelog: [internal]
Reviewed By: mdvacca
Differential Revision: D19250603
fbshipit-source-id: f95da375117dcb8f6540a6c75d3a80bba630672c
Summary:
Add Native Commands handlers to TextInput.
It is intentionally done in a way so that it can be easily swapped for codegened implementation once we properly type TextInput.
We also add native commands to view managers for backwards compatibility.
Changelog: [Internal]
Reviewed By: TheSavior, shergin
Differential Revision: D19412026
fbshipit-source-id: 8dc64275cf1da599b1bd5992a41035d51dd4148f
Summary:
Adds a bare minimum test that verifies correct behaviour of `getRelativeLayoutMetrics`.
Changelog: [internal]
Reviewed By: shergin
Differential Revision: D19449128
fbshipit-source-id: afde997a770921d580575eb0cdd04fce6252cb5a
Summary:
# Logs
```
[tid:com.facebook.react.JavaScript][ConcreteViewShadowNode.h:119] width: 0 tag: 1432 debugValue: r1
[tid:com.facebook.react.JavaScript][ConcreteViewShadowNode.h:119] width: 375 tag: 1432 debugValue: r2
[tid:com.facebook.react.JavaScript][ConcreteViewShadowNode.h:119] width: 375 tag: 1432 debugValue: r2
[tid:com.facebook.react.JavaScript][UIManager.cpp:197] width: 0 tag: 1432 debugValue: r1/sealed <----------------- FIRST TAP
[tid:com.facebook.react.JavaScript][UIManager.cpp:197] width: 0 tag: 1432 debugValue: r1/sealed <----------------- FIRST TAP
[tid:com.facebook.react.JavaScript][ConcreteViewShadowNode.h:119] width: 375 tag: 1432 debugValue: r4
[tid:com.facebook.react.JavaScript][ConcreteViewShadowNode.h:119] width: 375 tag: 1432 debugValue: r5
[tid:com.facebook.react.JavaScript][ConcreteViewShadowNode.h:119] width: 375 tag: 1432 debugValue: r6
[tid:com.facebook.react.JavaScript][ConcreteViewShadowNode.h:119] width: 375 tag: 1432 debugValue: r7
[tid:com.facebook.react.JavaScript][ConcreteViewShadowNode.h:119] width: 375 tag: 1432 debugValue: r8
[tid:com.facebook.react.JavaScript][UIManager.cpp:197] width: 375 tag: 1432 debugValue: r7/sealed <----------------- SECOND TAP
[tid:com.facebook.react.JavaScript][UIManager.cpp:197] width: 375 tag: 1432 debugValue: r7/sealed <----------------- SECOND TAP
```
# What’s happening here?
Opening a *BottomSheet* and tapping the first item. As you can see before the item is tapped, it has *width* set to 375 in revision *r2*.
When the tap happens, JavaScript is requesting an old revision of ShadowNode, which still has width 0.
# My assumption.
1. Native creates node with *width* 0 and returns handle to *JS*.
2. Native *clones* the node, sets its *width* to 375, doesn’t tell *JS* about it. This update is due to state change.
3. *JS* tries to get the size of the node, but asking for first revision of the component it receives width 0.
# Other observations
1. Manually setting width to 375 in UIManager::getRelativeLayoutMetrics fixes the problem.
2. This happens only on device, I wasn’t able to reproduce this on simulator.
# Fix
Find the newest revision of ShadowNodeFamily, and return its layoutMetrics.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D19433873
fbshipit-source-id: 4558cf6e704051e9b3968e83821d8d25b3dadcda
Summary:
# Problem
The issue is in implementation of `LayoutableShadowNode::getRelativeLayoutMetrics`.
If you have view tree (A has a child B), and you call `B.getRelativeLayoutMetrics(A)`, the expected result is B's origin within A. The implementation wasn't reflecting that, it was reflecting B's origin within A + A's origin within its parent.
# Fix
When iterating over ancestors of ShadowNode, the last ancestor should be skipped.
AncestorList is a list that starts with provided ancestor and ends with parent of `this`. To skip provided ancestor we iterate to `rend() - 1`.
# Why does it work in some cases?
This function is triggered from `UIManager.getRelativeLayoutMetrics` without `ancestorShadowNode` provided, we find the RootShadowNode, which has origin `{0, 0}`.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D19447900
fbshipit-source-id: 4a9606dc1fab3fecfb85d337b014188d80e5b355
Summary:
Changelog: [Internal]
Refactor the setup code for tests to a single place.
Now there is fixed set of nodes where we test different methods of ShadowNode.
Reviewed By: shergin
Differential Revision: D19464966
fbshipit-source-id: 749e9f56ac2e5489647885b2ddcb1309eb20909a
Summary:
Changelog: [Internal]
1. Replace ASSERT_* with EXPECT_*. Assert is a fatal assertion. Expect is non-fatal assertion. So if assert fails, tests do not continue and therefore provide less information.
2. Rename tests in `RawPropsTest.cpp` from `ShadowNodeTest` to `RawPropsTest`.
Source: https://github.com/google/googletest/blob/master/googletest/docs/primer.md#basic-assertions
Reviewed By: shergin
Differential Revision: D19464967
fbshipit-source-id: add83751ebdb0a12fbf8f70b851747aa5624366a
Summary:
This fixes a crash caused by a `JSError` exception not being successfully caught in a different dynamic library from where it was thrown. Since the libraries were compiled with hidden symbols and loaded with `RTLD_LOCAL`, the exception typeinfo becomes unique to each module.
Reading on this subject:
https://gcc.gnu.org/wiki/Visibilityhttps://stackoverflow.com/questions/14268736/symbol-visibility-exceptions-runtime-error
Reviewed By: mhorowitz
Differential Revision: D19343161
fbshipit-source-id: 4eb3bc2576bbcca2c3aef4f52b5a27dfde214c6a
Summary:
This diff ensures the measurement and rendering of FB emojis is correnct in RN Android.
Before this commit we were customizing Spannable object with FB emojis right before rendering the text into the TextView, this diff ensures that the Spannable is "customized" as soon as it is created, ensuring the measurement of the Text.
changelog: [internal]
Reviewed By: JoshuaGross
Differential Revision: D19354107
fbshipit-source-id: 92e07cf30503404f7820f25eaa9efdc02f6bddbd
Summary:
After some more testing, I discovered a problem in D19395326 because the native map that DeviceInfoModule was storing in `mPreviousDisplayMetrics` had been consumed when the event was emitted to JS. This caused the comparison to fail, so it would emit the event again when the dimensions hadn't changed.
In this diff, I'm storing a Java-only copy of the native map before emitting the event to JS so this shouldn't happen.
Changelog: [Android][Fixed] Fix bug in updating dimensions in JS
Reviewed By: mdvacca
Differential Revision: D19462861
fbshipit-source-id: 2e47479df93377b85fe87f255972dd31e874e3a8
Summary:
ReactRootView currently caches the last seen DisplayMetrics so we can compare them against the current values in DisplayMetricsHolder to determine if the screen dimensions have changed. (If they have changed, we emit an event to notify JS of the new dimensions).
However, ReactRootView initializes these member variables with empty DisplayMetrics, which means that the first time we check against them in onGlobalLayout, we will *always* emit an event to JS.
This seems reasonable if you only have one ReactRootView, but if you create a new RRV for each RN screen in your app, then you're going to get updated dimensions on each navigation event, even though the screen dimensions have probably not changed.
In this diff, I'm no longer storing the DisplayMetrics in ReactRootView at all, but instead am using temporary variables to check the new DisplayMetrics values against the old.
Changelog: [Android][Fixed] Only update dimensions in ReactRootView if they've changed
Reviewed By: JoshuaGross, mdvacca
Differential Revision: D19395326
fbshipit-source-id: c01aee73064764503c9b49208032c790b83a1d29
Summary:
```
Welcome to Gradle 6.1!
Here are the highlights of this release:
- Dependency cache is relocatable
- Configurable compilation order between Groovy, Java & Scala
- New sample projects in Gradle's documentation
For more details see https://docs.gradle.org/6.1/release-notes.html
```
## Changelog
[Android] [Changed] - Update Gradle wrapper to 6.1
Pull Request resolved: https://github.com/facebook/react-native/pull/27800
Test Plan: Build project
Differential Revision: D19460735
Pulled By: mdvacca
fbshipit-source-id: b5e71cf97c0208947d6e524a74907b74f6a71c8d
Summary: As titled. The work to write the spec and make this module compatible were done in D18148890.
Reviewed By: RSNara
Differential Revision: D19442016
fbshipit-source-id: 369bb4247d6590d41ec414f93c79d98d4a6bed88
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/27783
Use Xcode 11.3.0 to run tests, using an iPhone 8 simulator running iOS 13.3.
Snapshot tests disabled as they're failing on Circle CI.
Changelog:
[iOS] [Changed] - Use Xcode 11.3 and iOS 13.3 simulator in iOS tests
Reviewed By: PeteTheHeat
Differential Revision: D19411972
fbshipit-source-id: 3ddef9e6fbdbd3c35271732fc6d6d74de099230e
Summary: Changelog: [Fix] Fix status bar color not updating when navigating between two screens with the same status bar color.
Reviewed By: RSNara
Differential Revision: D19439424
fbshipit-source-id: 44388f1f94c87c12102471d72183bb6c152a46b6
Summary:
For some reason, I think this method is being optimized away, which is really strange considering that it's being used in getModule.
Changelog:
[Internal]
Reviewed By: ejanzer
Differential Revision: D19454855
fbshipit-source-id: 414b4888f7aacf730dd22939e2e2140b94dff4e7
Summary:
In bridgeless mode, `RCTTurboModuleManager` is initialized with a nil bridge. This has mostly worked, since `RCTBridge` doesn't do too many things for TMM (some notifs and perf markers). The one important thing it provides is a `_jsInvoker`.
In bridgeless mode, up until this point `_jsInvoker` has been nil, and turbo modules were not able to call functions on the JS thread. This diff fixes that.
Reviewed By: RSNara
Differential Revision: D19437174
fbshipit-source-id: 86bfc0a47bd9576e7d3203b860e86446eb0b63dd
Summary:
We should also call `TurboModuleManager.getLegacyCxxModule('foo')` when we call `TurboModuleManager.getModule('foo')` is called.
This fixes a Marketplace crash. See: D19432594
Changelog:
[Android][Fixed] - Ensure TMM.getModule also queries CxxModuleWrappers
Reviewed By: ejanzer
Differential Revision: D19434549
fbshipit-source-id: cff741cf1587d2a0dbcdc5eb95016c8aa283b727
Summary:
In order to be sure that 0.62 does not require an exact-by-default codebase, we should get rid of any `{}` occurrences inside of react-native-github. If all the object types in react-native-github are either explicitly exact `{||}` or explicitly inexact `{...}` then those object types will have consistent semantics regardless of the Flow settings in the client codebase.
Changelog: [Internal]
Reviewed By: rickhanlonii
Differential Revision: D19347283
fbshipit-source-id: 4c199bd7f1684b70df1b1c717941d0d477f67117
Summary:
Changelog: [Internal] Upgrade Chrome devtools protocol for Hermes
Update to the most recent version of the devtools protocol, r730699.
This just adds a few parameters to the stable API.
They have reasonable defaults that shouldn't break the existing functionality.
Reviewed By: willholen
Differential Revision: D19387559
fbshipit-source-id: 49d9ebf4a1a20f349ea6e46be6d5f36184ba8afb
Summary:
Changelog: [Internal]
Before, we were relying on checking out the `devtools-protocol` Github repo at a specific commit and
making special changes to the JSON file.
In order to make it easier to update, use the officially published npm package.
I found the closest package version that was published, but it had two differences:
* `Runtime.getHeapUsage` was either missing (in earlier versions) or experimental (in later versions)
* `isDefault` and `isPageContext` were removed. I'm not sure what these were used for anyway, the comment leads me to believe they're probably not necessary anymore
There were some customizations made previously to annotate `recursive` on some properties. The npm package doesn't set these,
so I wrote some checks to add it back in if it can be detected. This was mostly to handle one special case: `Runtime.StackTrace`.
The workaround seems to be fine for that case.
Reviewed By: willholen
Differential Revision: D19386890
fbshipit-source-id: db0d85f6bc71cba77ee67d85efe2f38376d7cc87
Summary:
Changelog: [Internal]
This separate `.flowconfig` file was causing versioning issues.
Delete it so that `msggen` can share the same flowconfig as the rest
of React Native.
Reviewed By: willholen
Differential Revision: D19413710
fbshipit-source-id: 748cb50a3151df1c67ee7176e57e259e48f50be7
Summary:
Re-landing the reverted change:
This removes all callsites that rely on runtime checks to detect the target deployment version. We no longer need to check for iOS 10+ in a few places. Note: for this to compile, the hosting app needs to target iOS 10.0+.
Changelog: [iOS] [Deprecated] - Deprecate iOS 9
Reviewed By: sammy-SC
Differential Revision: D19411136
fbshipit-source-id: ec0a957dc57819f0ee7d138c858209cabe3e5102
Summary:
Use correct path to testNotUTF8Convertible which is being skipped.
## Changelog
[Internal] - Use correct path to testNotUTF8Convertible which is being skipped.
Pull Request resolved: https://github.com/facebook/react-native/pull/27767
Test Plan: Circle CI
Differential Revision: D19404469
Pulled By: hramos
fbshipit-source-id: 70cf06c90dac74ac7963b9a35a543e11b21ba471
Summary:
This removes all callsites that rely on runtime checks to detect the target deployment version. We no longer need to check for iOS 10+ in a few places. Note: for this to compile, the hosting app needs to target iOS 10.0+.
Changelog: [iOS] [Deprecated] - Deprecate iOS 9
Reviewed By: hramos
Differential Revision: D19271321
fbshipit-source-id: 424ad7e2161261d148cb436cc20b4c531a4ba5b7
Summary:
`test_android`'s Test Collection step fails when it attempts to convert buck's output to the junit-compatible format that Circle CI expects. Executing the script from the `okbuck` location should help here.
## Changelog
[Internal] - Use correct location for buck_to_junit in test_android CI step
Pull Request resolved: https://github.com/facebook/react-native/pull/27766
Test Plan: Circle CI
Differential Revision: D19403837
Pulled By: hramos
fbshipit-source-id: 44e599ab653e7412340c3dcfdc45c5d37bcea1ee
Summary:
This converts all NativeModules excluding the following into TurboModules:
```
// Deleted
"fbsource/fbandroid/java/com/facebook/catalyst/modules/relaynativecache/RelayNativeCacheReaderModule.java"
// Owners of FBC will migrate these by themselves
"fbsource/xplat/fbc-mobile-app/android/app/src/main/java/com/fbc/i18n/FBCi18nAssetsModule.java"
"fbsource/xplat/fbc-mobile-app/android/app/src/main/java/com/fbc/react/CellScanResultsModule.java"
"fbsource/xplat/fbc-mobile-app/android/app/src/main/java/com/fbc/react/WiFiScanResultsModule.java"
// Don't have Buck owners
"fbsource/xplat/js/react-native-fbsdk/android/src/main/java/com/facebook/reactnative/androidsdk/FBAccessTokenModule.java"
"fbsource/xplat/js/react-native-fbsdk/android/src/main/java/com/facebook/reactnative/androidsdk/FBGraphRequestModule.java"
"fbsource/xplat/js/react-native-fbsdk/android/src/main/java/com/facebook/reactnative/androidsdk/FBLoginManagerModule.java"
"fbsource/xplat/js/react-native-fbsdk/android/src/main/java/com/facebook/reactnative/androidsdk/FBShareAPIModule.java"
"fbsource/xplat/intl/oss-fbt/__github__/react-native-fbt-android-native-module/android/src/main/java/com/reactlibrary/FbtAndroidNativeModule.java"
```
This should conclude the Android TurboModule migration.
Changelog:
[Android][Added] - Make remaining NativeModules TurboModule-compatible
Reviewed By: PeteTheHeat
Differential Revision: D19383442
fbshipit-source-id: 71beaee087f6436b197a65f0d68527d9964bb6ce
Summary:
For every untyped NativeModule Java file, we ensure that its owner depends on the owner of its JS spec.
Changelog:
[Internal]
Reviewed By: PeteTheHeat
Differential Revision: D19382937
fbshipit-source-id: 0a1d840bff2f9e8db0f06c910448e9b25415d18c
Summary:
Trivial: bump Circle CI Homebrew cache key to move past cache error in CI builds.
Changelog:
[Internal] - Bump Homebrew cache key on Circle CI
Pull Request resolved: https://github.com/facebook/react-native/pull/27764
Differential Revision: D19401723
Pulled By: hramos
fbshipit-source-id: cec18ea68ac141ab85ad694ac261d98cbf0e4440
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/27434
Pull Request resolved: https://github.com/facebook/react-native/pull/27295
- Use Xcode version 11.2.1 in both internal and external tests.
- Update snapshot reference images to use iPhone 8 test device.
Xcode 11.3.0 will be available in Sandcastle in the next week or so.
Changelog:
[Internal] - Bump Xcode version used in tests to 11.2.1.
[Internal] - Update iOS Snapshots.
Reviewed By: cs01
Differential Revision: D18849584
fbshipit-source-id: 9e3b92f080a4dc6a15dac0535b7562ff6a5c08a9
Summary:
This diff fixes the redbox error: Views nested within a <Text> must have a width and height
This error is reproducible when rendering a View with no fixed size, inside a <Text>. e.g.
```
function PlaygroundContent(props: {}) {
return (
<View style={styles.container}>
<Text>
<View>
<Image source={fbicon.filled('chevron-down', 10)} />
</View>
</Text>
</View>
);
}
```
changelog: Add support to render <View> with no fixed size nested within a <Text>
Reviewed By: shergin
Differential Revision: D19387760
fbshipit-source-id: a9cee8410e56a2d362d6b8f993e602719c416925
Summary:
In D15393464, we introduced `NativeHeapCapture`, but it had a few problems:
1. It required `JSCHeapCapture` by doing `TurboModuleRegistry.get<Spec>('HeapCapture')`, when it should have done `TurboModuleRegistry.get<Spec>('JSCHeapCapture')`.
2. It had an additional method `captureHeap`, which didn't exist on the Android NativeModule.
This diff corrects those mistakes.
Changelog:
[Both][Fixed] - Fix JSCHeapCapture
Reviewed By: PeteTheHeat
Differential Revision: D19383511
fbshipit-source-id: 30e69afbcdba673f3f32c16bde4f0342568ab97d
Summary:
In codegen we generate structs that represents events. These structs are later dispatched by generated `EventEmitter`.
They had unpleasant naming, for example `SliderOnValueChangeStruct`. This diff changes the code generated so it becomes `SliderEventEmitter::OnValueChange`, this better expresses the relationship of the two classes.
Changelog: [Internal]
Motivation: Better express relationship between EventEmitter and classes that represent events.
Reviewed By: rickhanlonii, shergin
Differential Revision: D19373850
fbshipit-source-id: a5eea085013dbc119169e2b06ba9f9fe44c7fcd9
Summary:
Adds Keyframes to interop whitelist of supported components.
In `RCTKeyframesManager.m` we look into subviews in order to find `RCTKeyframesView`, this is because the view returned from paper's `UIManager` is interop itself.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D19309355
fbshipit-source-id: f9b598ee6ad5340a4e4b3914330c70eea9f43926
Summary:
interop layer doesn't deal with `nil` being sent as event, example https://fburl.com/diffusion/t5zx6xm0.
This later triggers following assertion https://fburl.com/diffusion/dr5xzgic.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D19309356
fbshipit-source-id: 82b3841c337f949ce7ca0b875c98f608edddb599
Summary:
With plugins being used for components, there is danger that someone will remove buck target as dependency and component in the target won't be available for Fabric.
That's where `plugin_assertion` comes into play. For now I hardcoded a list of components. In the future, this list will be generated from JS components that are used in the app.
Changelog: [Internal]
Reviewed By: shergin
Differential Revision: D19197548
fbshipit-source-id: 0d31f53b573c343561715a8fb6fc7f0abfdb5b76
Summary:
Fabric doesn't support setNativeProps, so we are using view commands instead.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D18044169
fbshipit-source-id: d5f199b930244d02f174ea8a7ef732e9a8ef2476
Summary:
As a part of the migration from setNativeProps in Fabric and Paper, we are replacing it by view commands in the RefreshControl component on Android.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D18475450
fbshipit-source-id: ad89547fada3444f725fd9b00e8482cfc8f4d7fc
Summary:
As a part of the migration from setNativeProps in Fabric and Paper, we are replacing it by view commands in the Checkbox component on Android.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D18451749
fbshipit-source-id: 49d786ef3383df95b10260ba2b7f68489ad31789
Summary:
Ran `arc f` against some CPP files to be modified with the next diff
to reduce the churn on it.
## Changelog
[Android] [Changed] - Formatted cpp/h code with clang-format
Reviewed By: javache
Differential Revision: D19371785
fbshipit-source-id: b7f7b92c4cb9ec7f8da728bb577db29cf11fbb39