Summary:
Fixes#22421
If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
_Pull requests that expand test coverage are more likely to get reviewed. Add a test case whenever possible!_
Pull Request resolved: https://github.com/facebook/react-native/pull/22423
Differential Revision: D13287099
Pulled By: TheSavior
fbshipit-source-id: e4ac0fb930107dde092541fd17d4c81907c8cc34
Summary:
`ShadowTree` class is already thread-safe, so we don't need to (we should not) guard concurent access to it.
We should guard concurrent write-access to the collection of them though.
Note that unordered_map is "thread-compatible" collection, so concurrent reading access is okay.
Reviewed By: mdvacca
Differential Revision: D13269745
fbshipit-source-id: 4779626018da0e42b81a835e538f6c1d1a8e25f7
Summary: Trivial diff that cleans up measure function in C++ and Android
Reviewed By: shergin
Differential Revision: D13200340
fbshipit-source-id: 6c0888439640241cdedf514898a1ba3dac231d6a
Summary: Right now JSBundleLoader is tightly coupled to CatalystInstanceImpl; this diffs adds an interface, JSBundleLoaderDelegate, that CatalystInstanceImpl implements so that we can use the bundle loader with other classes.
Reviewed By: mdvacca
Differential Revision: D13216752
fbshipit-source-id: fc406ef30f12ed9d3ed13a062dedd7b33f3b7985
Summary: This change attempts to fix a crash within RCTImageCache's new dateWithHeaderString method. This is a speculative fix as there aren't any concrete repro steps.
Reviewed By: hramos
Differential Revision: D13278666
fbshipit-source-id: cdb69b1296c946d89e14c074329280994d87ddcd
Summary: Added more information to ending tags so that they can be connected with the starting tags.
Reviewed By: mdvacca
Differential Revision: D7121038
fbshipit-source-id: 72d51952955e22a4c8d66c4f9e75a3fd9d34df7f
Calling -[UIScrollView setContentOffset] with NaN values can cause a crash. That's not clear why exactly the computation returns NaN sometime, but the implemented sanitizing should help to detect this problem during development (and this also prevents the app from crashing).
See attached task for more details.
Reviewed By: fkgozali
Differential Revision: D13242729
fbshipit-source-id: 747bf1b42e02597e9f1300eee24547563ab29b27
Summary:
`JSBigString` is using functions from `unistd.h`, like `getpagesize`, `dup`, `open`, etc. but was not directly including it.
It was being included from inside the glog `logging.h` header, which in turn was getting included by the Folly headers `JSBigString` was using.
This was discovered while building CxxReact with a custom shimmed Glog.
Pull Request resolved: https://github.com/facebook/react-native/pull/22330
Differential Revision: D13115346
Pulled By: shergin
fbshipit-source-id: 9fe4e3b28f74c0ca351ac6308484e375eace4db4
Summary:
Adding an “UNSAFE_” prefix to `componentWillMount`.
If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
- [x] yarn test
- [x] yarn flow
- [x] yarn flow-check-ios
- [x] yarn flow-check-android
[General] [Fixed] - adding an UNSAFE_ prefix
Pull Request resolved: https://github.com/facebook/react-native/pull/22125
Differential Revision: D13237831
Pulled By: mmmulani
fbshipit-source-id: b4ca1e4628f93e89fd5680c40b0e3f7c7db6ad38
Summary:
The reasoning behind this change is that right now, having both added and modified modules inside of a single `modules` field doesn't allow for basic operations like combining two deltas.
For instance, say I have three different bundle revisions: A, B and C.
Module 42 was added in B, and then removed in C.
A->B = `{modules: [42, "..."], deleted: []}`
B->C = `{modules: [], deleted: [42]}`
A->C = `{modules: [], deleted: []}`
However, were we to compute A->C as the combination of A->B and B->C, it would result in `{modules: [], deleted: [42]}` because we have no way of knowing that module 42 was only just added in B.
This means that the `deleted` field of delta X->Y might eventually contain module ids that were never present in revision X, because they were added and then removed between revisions X and Y.
The last time I changed the delta format, we had a few bug reports pop out from people who had desync issues between their version of React Native and their version of Metro. As such, I've tried to make this change backwards compatible in at least one direction (new RN, old Metro). However, this will still break if someone is using a newer version of Metro and an older version of RN. I created T37123645 to follow up on this.
Reviewed By: rafeca, fromcelticpark
Differential Revision: D13156514
fbshipit-source-id: 4a4ee3b6cc0cdff5dca7368a46d7bf663769e281
Summary: Fixes a minor Flow type error when `minimist` is typed via `flow-typed`.
Reviewed By: TheSavior
Differential Revision: D13188680
fbshipit-source-id: 9ad35a3222c8937163a998a2751efd95945af3c7
Summary: Upgrades to `chalk@^2.4.1`. Verified no dependencies to the breaking changes in `chalk@2.0.0`.
Reviewed By: cpojer
Differential Revision: D13192150
fbshipit-source-id: 27a1a53d50a3c7628528a4f21e7166d452b2f205
Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in `TouchEventEmitter`.
Reviewed By: sahrens
Differential Revision: D13123042
fbshipit-source-id: 594b89b6e3986d6a04846194701e3a727b152cec
Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in `ScrollViewEventEmitter`.
Reviewed By: sahrens
Differential Revision: D13123049
fbshipit-source-id: 2839976d0119c48fa2538dbaa53afbc24982c598
Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in ViewEventEmitter.
Reviewed By: sahrens
Differential Revision: D13123048
fbshipit-source-id: 3c323912d3e65b684f99df6cda99c785876164af
Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in SwitchEventEmitter.
Reviewed By: sahrens
Differential Revision: D13123046
fbshipit-source-id: f2e4905a96191540ceec633bae1871c93be724db
Summary:
Now the event delive pipeline supports `JSI::Value`-based payload. Instead of passing `folly::dynamic`, now we are passing `std::function<jsi::Value(jsi::Runtime &runtime)>` as factory that can build a `JSI::Value` with given `jsi::Runtime` and any captured data.
The old (now legacy) way of calling `EventEmitter::dispatchEvent(..., const folly::dynamic &payload, ...)` is also supported.
Reviewed By: sahrens
Differential Revision: D13123043
fbshipit-source-id: d65348bb215013042abb2fcfe5083a8c697333d0
Summary: Now instead of passing `reactTag` through the whole event pipeline, we store it inside `EventTargetWrapper` (and it does not leave `UIManagerBinding`). It helps with reducing the complexity of `EventEmitter` and will help us in migrating to JSI.
Reviewed By: sahrens
Differential Revision: D13123045
fbshipit-source-id: aa9ee94d5660ff3090369c1e55cf748d2e72b987
Summary:
That's generally better because:
* Avoids exposing ShadowNode to mounting layer;
* Enables hashing and comparing the AttributedString based on actual meaningful data (not on just a pointer to ShadowNode).
Reviewed By: mdvacca
Differential Revision: D13205230
fbshipit-source-id: 7b79c1aad97b10d81e3faa10408be61b74f815cf
Summary: Trivial. We need this for future use as part of AttributedString's hash.
Reviewed By: mdvacca
Differential Revision: D13205231
fbshipit-source-id: 14a3decae72741030284a30abdb936616bafb3fe
Summary:
ShadowView, ShadowViewMutation, and Differentiator were decoupled to separate module.
That enables us to use ShadowView more widely without facing a circular dependency problem.
Reviewed By: mdvacca
Differential Revision: D13205229
fbshipit-source-id: 7373864bf153a7813c2f97edb263a41454ce0b88
Summary: Pretty straightforward wiring UIManager and the new feature in ShadowTree: we get the node, clone with the new props and then replace this.
Reviewed By: sahrens
Differential Revision: D13114788
fbshipit-source-id: 3a34fb879f3ec564c26278034a19b88518302de8
Summary: This method is the core of the future features: `setNativeProps` and `LocalState`.
Reviewed By: sahrens
Differential Revision: D13114789
fbshipit-source-id: 2138496c43c171fe27784b1959d86d6eec4638ee
Summary: Use array+map like other examples for DRY.
Reviewed By: TheSavior
Differential Revision: D13222132
fbshipit-source-id: 15171e496eaef8794c02e853950f666d77372923
Summary:
Instead of assigning all the constants exported by a NativeModule to the native module JavaScript object itself, we want to instead export a `getConstants()` method that can be used to access native module constants. This change simplifies the API of native modules. Eventually, we'll remove the ability to access constants as native module object properties alltogether, but that's comes later.
**Note**: I didn't need to make any cpp changes because `JSIExecutor::NativeModuleProxy::get` calls `JSINativeModules::getModule` (here: https://goo.gl/QwPDWF), which eventually calls `JSINativeModules::createModule`, which uses `global.__fbGenNativeModule` (here: https://goo.gl/pSxMgE), which is just an alias to `genModule` in `NativeModules` (here: https://goo.gl/u2wjCs).
Reviewed By: fkgozali
Differential Revision: D13207152
fbshipit-source-id: 375aab1346232819187a5d5b272b33c55992346a
Summary: The wrappers exposed by `rn_defs.bzl` should mangle visibility to include the cell.
Reviewed By: scottrice
Differential Revision: D13219109
fbshipit-source-id: ded17e79a1d388d6b76fbdf2ab0d75e586092fcd
Summary:
In #22117 we changed the PR template to use `Changelog` instead of `Release notes` and now danger bot is complaining as it wasn't updated there.
cc turnrye
Pull Request resolved: https://github.com/facebook/react-native/pull/22395
Differential Revision: D13195006
Pulled By: TheSavior
fbshipit-source-id: 36b9675c1e30c86fb8d002b121cc29239d6f78dd
Summary:
This diff fixes a bug that produces TouchEvents on text to stop working after a react state has happened.
An easy way to reproduce this is opening a YellowBox, minimizing it and trying to open it again
Reviewed By: shergin
Differential Revision: D13198663
fbshipit-source-id: 19b08818bbff8014ab8227b3db1119edc4193389
Summary: On Android, `Switch` does not currently read its role as a "button". This fixes that and makes it consistent with iOS.
Reviewed By: sahrens
Differential Revision: D13136253
fbshipit-source-id: 0de5d54772d204168138cb2af7815cc458f72682
Summary:
Modified the ESLint configuration to only enable the Jest environment for files we consider now tests, which are files with the `-test.js` suffix under `__tests__`. Also enabled some globals for test helpers (any file under `__tests__`).
This will allow us to catch misspelled tests, while allowing test helpers to use most Jest APIs.
Also disabled the Jasmine environment so people stop using Jasmine APIs and we can rollout Circus soon.
Reviewed By: aaronabramov
Differential Revision: D13199591
fbshipit-source-id: 12a32cf5835630b9987452b0c33d3f8085001689
Summary:
This may be controversial.
Right now, RelayPrefetcher is initialized [here](https://fburl.com/p01iunr1), after bridge is initialized. I want to create a FBRelayPrefetcherModule instance eagerly (diff 3 in stack), and then pass that into the bridge module registry. This way, native side gets to use RelayPrefetcher before bridge is init, and JS still accesses the same instance of FBRelayPrefetcherModule.
The only other option is drastically change bridge init, to allow passing in some eagerly initialized instances.
Reviewed By: shergin
Differential Revision: D13164277
fbshipit-source-id: b45111cd68d78820e61e4fca7e54a7e8df32a3f0
Summary: Set the default text radius to 0 so that text shadows aren't applied to every text node
Reviewed By: mdvacca
Differential Revision: D13027589
fbshipit-source-id: 4f7386059ac1654b8f77dddf9eb1b772f6049e23
Summary:
Similar to #21950, this adds displayName to `ActivityIndicator`, so it displays the correct component name in snapshots instead of `Component`.
Fixes#21937 (a little bit more than it was already fixed).
Pull Request resolved: https://github.com/facebook/react-native/pull/22417
Differential Revision: D13205376
Pulled By: TheSavior
fbshipit-source-id: 21e71d4980d159a1f33d32d83346b48257ec21d4
Summary:
Previously, we stored a pointer to ShadowNode inside NSAttributedString's attributes to make possible retrieving an EventEmitter associated with some text fragment.
That worked fine besides only one caveat: the internal implementation of NSAttributedString is quite strange and that causes a memory leak. Because of some reason, NSAttributedString does not release stored attributes after own destruction (maybe OS uses some kind of caching).
So, now, instead of storing a strong pointer to ShadowNode inside NSAttributedString, we store a weak pointer to EventEmitter. Storing a weak pointer is okay because a desired lifetime of EventEmitter is guaranteed by LocalData stored inside a View. Storing a weak EventEmitter instead of weak ShadowNode will also help us with migration to ShadowView (we cannot store ShadowView weakly because it's a stack allocated object).
Reviewed By: sahrens
Differential Revision: D13196886
fbshipit-source-id: f8714e4b3709765629d6456edf0c635bf5f7c53b
Summary:
Consider this:
* ParagraphShadowNode retains LocalData,
* LocalData contains AttributedString,
* AttributedString contains Fragments,
* Fragment can contain a pointer to parent shadow node, so it can be the ParagraphShadowNode.
In this case it's a retain cycle.
We actually don't need to store pointers to not TextShadowNodes, so we don't now.
Later, after we fully migrate to ShadowView, we can remove this condition because it will become harmless.
Reviewed By: sahrens
Differential Revision: D13196885
fbshipit-source-id: d386ce0a067df0a72e6619d62d56038aaf80eccb
Summary: Over-retaining a LocalData object inside the View can cause a crash during tearing down JS VM because LocalData can indirectly retain EventEmitter objects which were not properly "disabled".
Reviewed By: sahrens
Differential Revision: D13196887
fbshipit-source-id: 001d9fadf775c89f750c84fe8da9b84d4636631c
Summary: RCTViewComponentView retains an EventEmitter, so we have to clear this up after we recyled the view.
Reviewed By: sahrens
Differential Revision: D13196884
fbshipit-source-id: e9f2e2400be864c5c6177227255012101ed8c4d1