Summary: This pull request removes the hard-coded version of the `metro-react-native-babel-preset` as defined in the `init` command. That way, the version always matches React Native version specified in its `package.json`, making it match Metro version.
Differential Revision: D9759540
Pulled By: hramos
fbshipit-source-id: 90835442e2db1900851cbfb8c3c625229184d851
Summary:
Upgrades `react-devtools` for React Native and Nuclide to v3.3.4.
Notably, this brings working support for the React Profiler!
Reviewed By: bvaughn
Differential Revision: D9721317
fbshipit-source-id: 898666d12a33d8b874fcb133e9353f483285edc2
Summary: ImageBackground assigned its Image the same `width` and `height` styles as itself. This became an issue for ImageBackground instances that were assigned (non 100%) percentage size values. For example, if the `width` and/or `height` of the ImageBackground was set to be 50%, it would be half the size of the current component it is in (as intended), but the Image would be 50% of the ImageBackground, which is only 25% the size of the ImageBackground's parent component.
Reviewed By: shergin
Differential Revision: D9307123
fbshipit-source-id: cec3802d30b72c44f66dd3a53693ebd669cc8db4
Summary:
When text nodes are nested, as below, `onPress` handlers need to be correctly invoked:
```
render() {
return (
<Text onPress={() => console.warn('hi')}>
hi
<Text onPress={() => console.warn('ramanpreet')}>ramanpreet</Text>
</Text>
);
}
```
In the above example, clicking on "hi" should warn "hi", and clicking on "ramanpreet" should warn "ramanpreet". This diff implements that behaviour.
Reviewed By: shergin
Differential Revision: D9696905
fbshipit-source-id: 2daf24e76c3b3c37aa36cd1540e54876a367faf7
Summary:
This diff includes two changes:
1. `TextShadowNode` represents virtual texts. For the time being, virtual text nodes only need touch capabilities so that they can handle `onPress` events for their children. Therefore, we should set the `TextShadowNode`'s `EventEmitterT` to `TouchEventEmitter`.
2. Since `ParagraphShadowNode` extends an instance of the `ConcreteViewShadowNode` template, it automatically uses the `ViewEventEmitter` if no event emitter is specified. I think it's better to make the event emitter explicitly specified. So, I've included that change in this diff.
Reviewed By: shergin
Differential Revision: D9696906
fbshipit-source-id: ac053ffdde4c2fbc6351f177c07a2ada4445cbb8
Summary:
This diff includes two changes:
1. Even though `RCTViewComponentView` conforms to `RCTTouchableComponentViewProtocol`, it never implemented this protocol. This diff makes the correction.
2. Make the necessary changes to `RCTSurfaceTouchHandler` required by the changes in `RCTTouchableComponentViewProtocol`. This means modifying the `ActiveTouch` struct to hold `SharedTouchEventEmitter`s. It also means passing in the touch point to the `componentView`'s `touchEventEmitterAtPoint` method.
Reviewed By: shergin
Differential Revision: D9696909
fbshipit-source-id: 3d4a833f7dbae6d0238a0807eb2220250ccbae3d
Summary: In the future, we may want some components (like Virtual Text) to handle only touch events. Therefore, I've extracted `TouchEventEmitter` from `ViewEventEmitter`.
Reviewed By: shergin
Differential Revision: D9696903
fbshipit-source-id: f6acc90d8ff53b5e6badaa472a5e099fb7cf03ff
Summary:
When a user clicks on some text, `RCTSurfaceTouchHandler` will call into a method on `RCTParagraphComponentView`. That method (i.e: `touchEventEmitter`) would be responsible for identifying the closest ancestral `<Text/>` component to which we should dispatch the `onPress` event, given the point where the user clicked. To answer this query, we'll use a data structure called `UIAttributedString`.
This data structure represents a string, and a corresponding mapping from sequences of its characters to some arbitrary data. In this attributed string, we'll map sequences of characters to their closest ancestral `ParagraphShadowNode` or `TextShadowNode`. That way, when we get a click event on `RCTParagraphComponentView`, we can just look at the character that was clicked, and use that information to do a lookup in the attributed string to find the shadow node who's EventEmitter is responsible for processing the click event.
Reviewed By: shergin
Differential Revision: D9696904
fbshipit-source-id: a199649981ad271afa85414ce4c3f056851348be
Summary: Previously, `BaseTextShadowNode::getAttributedString` used to recurse on a list of `SharedShadowNode`s (i.e: the children). In the `RawText` base case of this recursion, we'll need to record the parent of the current `RawText` (so that we can dispatch the `onPress` event to it). Therefore, we need to start recursing using the `SharedShadowNode` itself, and not its children.
Reviewed By: shergin
Differential Revision: D9696908
fbshipit-source-id: dbf3f9c21a7ae4de421d0355c4e5900b3947dc2a
Summary:
Switches to the `nullthrows` package instead of using `fbjs/lib/nullthrows`.
The version of `nullthrows` in `fbjs` is outdated and already missing features that exist in the standalone `nullthrows` package.
Also, this mitigates the inevitable collision between `nullthrows` (as a Haste module) and `nullthrows` (as a `node_modules` dependency).
Reviewed By: zertosh
Differential Revision: D9733178
fbshipit-source-id: 1b589d48c1ed57cebf2088b796ad72e212534c0a
Summary:
Motivation:
--------------
PR #20767 bumped the version of the Android Gradle Plugin to v3 which uses the newer Gradle dependency configurations `implementation` and `api` which make `compile` obsolete.
While the PR updated the template Gradle configuration, it did not cover the `link` command which will still link native modules using `compile` resulting in a warning message beeing displayed during an app build.
Since `compile` will be eventually removed by Gradle, this commit updates the `link` command to attach native modules using `implementation`.
Pull Request resolved: https://github.com/facebook/react-native/pull/20853
Differential Revision: D9733888
Pulled By: hramos
fbshipit-source-id: 22853480d7ba7be65e3387effda2fd6c72b6906a
Summary:
@public
Besides `pointerEvents` there are other two props that affect hit-testing mechanism: `zIndex` and `clipToBounds`.
The default UIKit implementation does not take this into an account (it always assume that `clipToBounds` is true and `zIndex` is same). `betterHitTest` does it right.
Reviewed By: sahrens
Differential Revision: D9688876
fbshipit-source-id: dadfd5e5541ddd1a744fbd8c6b10949c0e266069
Summary:
@public
In RN we have special `pointerEvents` prop that controls whether the View can be the target of touch events.
This is a pretty straight-forward implementation of that.
Reviewed By: sahrens
Differential Revision: D9688877
fbshipit-source-id: 1524647b0a33e4dd14563f531d636469bf3bdef7
Summary:
@public
Trivial.
We should not use the name of the effort in the API interfaces where it's not neccecery.
Reviewed By: sahrens
Differential Revision: D9652991
fbshipit-source-id: 52b99e39f92926f9fc99626690eb4385195558f6
Summary:
@public
Apparently, we have to call `ReactFabric.unmountComponentAtNode(tag)` instead of `AppRegistry.unmountApplicationComponentAtRootTag(tag)`.
Reviewed By: sahrens
Differential Revision: D9652730
fbshipit-source-id: f56dba7dbe5421a7d939b91178db5104476fe550
Summary:
@public
RCTSurfaceRegistry always promised this in the documentation but never actually did.
Reviewed By: sahrens
Differential Revision: D9652732
fbshipit-source-id: f3d06b95192e024273dc0e3a1c2753ca92370338
Summary:
@public
Now we simply skip `uiManagerDidFinishTransaction` calls if they refer to unregister surfaces. In the future, after we have proper asynchronous scheduling and sync unmounting (and if we chose to have sync unmounting), we can avoid this situation (and assert in this cases).
Reviewed By: sahrens
Differential Revision: D9652731
fbshipit-source-id: e376ea1ae4f93960a903e6397d843bd7c4b72400
Summary:
@public
We don't need this anymore.
The same functionality is now implemented as `ShadowView::operator==` in much more reasonable way.
Reviewed By: sahrens
Differential Revision: D9649821
fbshipit-source-id: 8cd5f3cb4f583fd10d2d1e060aba914541341b5b
Summary: Adding a QPL point for initializing Hermes to both (MP) HOME_TTI and (RN) CORE.
Reviewed By: yungsters
Differential Revision: D9725795
fbshipit-source-id: 673f54950a2d9ebfa496a000a0d47aabf290bfc8
Summary: Follow up for 0df92afc1c -- the file refences need to be removed from Xcode project.
Reviewed By: shergin
Differential Revision: D9728433
fbshipit-source-id: ed4e69ff14413b1c4e64250c3f9716375d95fbc2
Summary:
One of our automated project tools noted that these were all missing their copyright headers.
Pull Request resolved: https://github.com/facebook/react-native/pull/21000
Differential Revision: D9721495
Pulled By: hramos
fbshipit-source-id: 6ccf0f37165a0fe16cf06bd996d615f2286101dc
Summary:
This also relink the require() onto `RamBundle.js` from Metro so we can remove `unbundle.js` from there completely.
Pull Request resolved: https://github.com/facebook/react-native/pull/21013
Reviewed By: hramos
Differential Revision: D9721443
Pulled By: jeanlauliac
fbshipit-source-id: 3e42ebde4cb2c735ef0934ba3b1e20f1054440df
Summary:
This script is not yet used. Regardless, Node 10 has been working fine for a while now.
Pull Request resolved: https://github.com/facebook/react-native/pull/21001
Differential Revision: D9721549
Pulled By: hramos
fbshipit-source-id: 44b5e2f9ec9b622a364491840f8bd8092f0399ff
Summary:
Basically, saw this commit this morning and had a chance to discuss it with matthargett and AndrewJack and overall I agree with their criticism about 3 days being too little time for people to react to it.
Pull Request resolved: https://github.com/facebook/react-native/pull/21015
Differential Revision: D9721393
Pulled By: hramos
fbshipit-source-id: 524c0b87987a8b76fa8d5e223fb5ed5a56a8c648
Summary:
@public
Just movin' stuff around.
This shouldn't render any actual metrics yet on Android, need native changes for that.
Reviewed By: achen1
Differential Revision: D9584669
fbshipit-source-id: 4b6169b14d1f2053258191f67e1f361a4b714a8e
Summary:
@public
Apperently, we don't need to store and parse this because we are already doing this for `yogaStyle` field.
Reviewed By: sahrens
Differential Revision: D9649549
fbshipit-source-id: a84a5518674f4c2d574a060cdbebb9562121f5f4
Summary:
@public
Now all configurations or border styles are supported by RCTViewComponentView (and all subclasses).
Reviewed By: sahrens
Differential Revision: D9631868
fbshipit-source-id: 3a5b141ac5ffa9c28f4ebb0718f2fc935b8f1a75
Summary:
@public
Empty (nullptr) color should be treated as `Clear` color ({0, 0, 0, 0} - black, fully tranparent), so `colorComponentsFromColor()` was changed to accomodate this (previously it crashed).
Reviewed By: rsnara
Differential Revision: D9631865
fbshipit-source-id: e211f34a89e9f5f86d9fca2789c7163db4feaab1
Summary:
@public
We will use that in RCTFabric module.
Reviewed By: sahrens
Differential Revision: D9631866
fbshipit-source-id: a8e4074189359ad6014d0506d6a1e020b5d0d330
Summary:
@public
Apparently, it's how it should be.
Reviewed By: rsnara
Differential Revision: D9631870
fbshipit-source-id: 46f58270104d699fbc9abe21062c12f791460536
Summary:
@public
Previously, ViewProps class coundn't represent whole spectre of possible values of border metrics (e.g. the border color was unified).
Now it's complete and direction-specific.
Reviewed By: sahrens
Differential Revision: D9628361
fbshipit-source-id: 6d3b3d4d7e3008e2168cbca732ff99fe5ea595e8
Summary:
The React Native Web View takes a method option to determine if HTTP GET or HTTP POST should be used.
For iPhone this is not case sensitive, meaning that `method: "post"` is allowed.
For Android "post" is not understood and therefore the request will be using HTTP GET.
I suggest we ignore case for the method, or throw an Exception.
Pull Request resolved: https://github.com/facebook/react-native/pull/21010
Differential Revision: D9700895
Pulled By: hramos
fbshipit-source-id: 3fa904e7946dd40958cb44f9a234ee66cb68fab2
Summary: An experiment was added to A/B test eager modules. Removing this experiment, as the next diff on this stack has a different way to add eager modules per route.
Reviewed By: achen1
Differential Revision: D9685803
fbshipit-source-id: ca6c91ca377b6dfaf5accda1e1f6bbfe17b1d616
Summary:
Some of the native modules are accessed using `getNativeModule()` may not have an `ReactModule` annotation. As a result, such native modules cannot be found.
This diff adds a better error message, and also adds the annotation to Mobile Home's `PushNotificationManager` that is accessed using the `getNativeModule()`
Differential Revision: D9697256
fbshipit-source-id: 2e2f7d2f1eb705c9c515ff40d9acbc53055c26d8
Summary: setupReactContext wasn't ending because D9664719 added incorrect end markers. Need to use either Systrace.endSection() or SystraceMessage.endSection().flush().
Differential Revision: D9695854
fbshipit-source-id: e0f7d492bc58536ce242962438edac7eec671867
Summary:
This fixes issues #18954 and #15497
The transformation from Set to (an reversed) Array does not work on Android devices when the remote debugging was started with `react-native run-android`.
<!--
Required: Write your motivation here.
If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->
Add the following code to your App.js and run the app with `react-native run-android` in an Android device:
```
componentDidMount() {
BackHandler.addEventListener('hardwareBackPress', () => {
console.warn('Callback called. Do not close app. Do nothing at all.');
return true; // Do not close the app.
});
}
```
After adding this, the app should NOT close when you press the back button. Without this fix, the app closes (which is the default behaviour).
See also the comments from Victoriayangx in #18954 and #15497.
<!--
Does this PR require a documentation change?
Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->
<!--
Required.
Help reviewers and the release process by writing your own release notes. See below for an example.
-->
[ANDROID] [BUGFIX] [BackHandler] - Fix that BackHandler was not called on Android
<!--
**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**
CATEGORY
[----------] TYPE
[ CLI ] [-------------] LOCATION
[ DOCS ] [ BREAKING ] [-------------]
[ GENERAL ] [ BUGFIX ] [ {Component} ]
[ INTERNAL ] [ ENHANCEMENT ] [ {Filename} ]
[ IOS ] [ FEATURE ] [ {Directory} ] |-----------|
[ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} |
[----------] [-------------] [-------------] |-----------|
EXAMPLES:
[IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
[ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
[CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
[DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
[GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
[INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
Pull Request resolved: https://github.com/facebook/react-native/pull/19077
Reviewed By: yns88
Differential Revision: D9692298
Pulled By: hramos
fbshipit-source-id: 4526b07a4924055ebc9c42e02615c27aa5c97fbb
Summary:
Legacy navigator impl. There are other alternatives that should be used instead.
Part of the slimmening effort as described here: https://github.com/react-native-community/discussions-and-proposals/issues/6
Reviewed By: TheSavior
Differential Revision: D9677824
fbshipit-source-id: 24ae500751d2a8c398f246d36604a58f0b3c113b
Summary:
This version of metro contains experimental support for inlining import statements, which will unblock RAM bundling for opensource users that use imports, yay!!!
Publishing as a minor version, since there are no breaking changes. This way, this will also be available already in RN 0.57, since it depends on Metro 0.57 (https://fburl.com/t2j2k2sw).
/cc @[805780135:Eli White], @[1268286274:David Vacca], @[121800083:Héctor Ramos]
Reviewed By: mjesun
Differential Revision: D9682357
fbshipit-source-id: ddd450649e55ee37701667cdff0e81165875e76d
Summary: The logic in NativeModuleRegistryBuilder.processPackage was getting pretty complex with lot of branches. Moved the logic to get actual packages into each of the packages, instead of having it in NativeModuleRegistryBuilder.
Reviewed By: achen1
Differential Revision: D9618140
fbshipit-source-id: 4be82ec65b0bd92f11f8b77044004e10c9d3b1a1
Summary:
Added systrace to the following sections
1. When Marketplace Home Fragment is created
2. On initialization of Catalyst Instance
Reviewed By: achen1
Differential Revision: D9665376
fbshipit-source-id: e48e9f50dad42c71fb2151538f65bc54939adc1e