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
Summary:
Updated the configuration for all projects on xplat/js to only consider tests that end with `-test.js`.
All tests were migrated in the previous diff of the stack.
Reviewed By: mjesun
Differential Revision: D13185676
fbshipit-source-id: baaba94fabc403acb30b0b5a0462788813d7a870
Summary:
Renamed test files to match `-test.js`, so people can add test helpers without blacklisting.
Codemod code: P60365841
Script executed:
```
cd xplat/js
./scripts/node/node rename-script.js > result.txt
```
Reviewed By: mjesun
Differential Revision: D13185673
fbshipit-source-id: 87451635aa538c2c1d1886e75574d0e5c889596e
Summary:
@public
Marking the node as dirty when isReferenceBaseline property is changed
Reviewed By: davidaurelio
Differential Revision: D13147742
fbshipit-source-id: 3bbff1cfceeadfbf77380519e4638f2984fc2009
Summary: As suggested by yungsters in D13138187
Reviewed By: mjesun
Differential Revision: D13192765
fbshipit-source-id: 8ab3dc74b3a9aaebf043bc3b5ed4f2590f480d10
Summary: There is only a single use of this function across RN, and one more use in a test file. I inlined this function in both places to reduce the dependency on fbjs.
Reviewed By: yungsters
Differential Revision: D13138137
fbshipit-source-id: 32660c965a975d17e236bdd13ff0b2a8d64751ee
Summary: There are no DOM Nodes in React Native so our Map polyfill does not need to consider that use case. I deleted the references to `isNode` and `IE. In case this is important for react-native-web, I suggest to shim the Map polyfill with an IE compatible one outside of react-native.
Reviewed By: yungsters
Differential Revision: D13138030
fbshipit-source-id: 661511ea03b4477bd55d0fdf5e485178fe59d96b
Summary: This module simply forwards to the `promise` module. I inlined the code to remove the dependency.
Reviewed By: yungsters
Differential Revision: D13137980
fbshipit-source-id: e3d6208068911711fc5f5378f2d5bb6ac38f2eb2
Summary:
[Folly upgrade](a70625abd7) introduced changes that have to be applied to `Install Third Party` script in order to use `New build system` from Xcode 10. Unfortunately, this might happen again if someone changes folly. Also removes non-existent files from folly podspec.
Pull Request resolved: https://github.com/facebook/react-native/pull/22394
Differential Revision: D13192463
Pulled By: hramos
fbshipit-source-id: ea0eeb6e1e7f6d7dfcdb6d1dee28b1a640ee7097
Summary: View recycling can be pretty aggressive and memory intensive, so we can properly react on system memory-pressure notification.
Reviewed By: mdvacca
Differential Revision: D13176278
fbshipit-source-id: 38ea1b27da988aeaaa5db6ac0b94389a0bd2799e
Summary:
Apparently, the previous behavior brings more problems than some *possible-in-the-future* features and flexibility.
The new model allows us to easily implement "nested text" feature.
(We temporary hope the old behavious for Android only for compatibility reasons.)
Reviewed By: mdvacca
Differential Revision: D13176277
fbshipit-source-id: 01f7bfb3c2e70cc89d76ecb78add016ee91cbd63
Summary:
The whole mounting iOS infra now uses `ComponentHandle` instead of `std::string` as a reference to particular `ComponentView` implementation. All changes are pretty straightforward, we use a different thing/type to refer to the particular class; no changes in the logic besides a new `RCTComponentViewFactory` that serves the same role of classes registry as Objective-C runtime served previously.
That has several benefits:
* It should be slightly faster, mostly because we don't need to convert `char *` strings to `std::string` and then to `NSString *`.
* We don't need string-based component-name maps anymore (at least on this layer). We can call classes as we want and it will work because of classes are now explicit about which ShadowNodes they are compatible with.
* Most importantly, it's explicit now! That means that no runtime magic is involved anymore and we can rely on static linting tool now and not be afraid of improper code stripping/overoptimization.
Reviewed By: mdvacca
Differential Revision: D13130760
fbshipit-source-id: aadf70525a1335b96992443abae4da359efdc829
Summary: The new method in the protocol enforces view component classes to expose a component handle of the component that the view component represents. That will allow us to wire up those classes with shadow views in runtime explicitly and in a much more performant way than it is now.
Reviewed By: mdvacca
Differential Revision: D13114663
fbshipit-source-id: 853187d978aab200f85719d9c1d9fea2e3ad4e55
Summary:
This diff changes the method to calculate the hash of an AttributedString (removing shadowNode and parentShadowNode from it).
This is necessary becuase otherwise hashcode of clonned parent keep changing in every state change, when the text doesnt change
With this change we are able to cache spannables in android properly
Reviewed By: shergin
Differential Revision: D13189110
fbshipit-source-id: c1f7372809ce98a5b4d091485cc15281a4ab5e1e
Summary: This diff adds support to cache the Spannable objects that are created during measure() and updateLocalData() for text
Reviewed By: shergin
Differential Revision: D13188599
fbshipit-source-id: 6547d8ce2bb8b1dfb3c91e64facff3ba0cd97472
Summary:
Removing two props that are not currently used
They are being set as quiet_NaN in C++ and this brings problems in the Android side
Reviewed By: shergin
Differential Revision: D13188600
fbshipit-source-id: e8412497a80300cfbc3770b829e9633206aaf427
Summary: This diff fixes re-measures of a text component result of a change of state. For details of the bug see: T36838266
Reviewed By: shergin
Differential Revision: D13188601
fbshipit-source-id: ea9a889540f600d4e4e788105d5fa22e6cd5448c
Summary: In this diff we expose the text local data hash to android, this will be used in the future to cache metadata when rendering text in android
Reviewed By: shergin
Differential Revision: D13161873
fbshipit-source-id: cd13a4beba75a3fe62ac9ff3def26f88e874834b
Summary: Simple diff that adds a systrace to start measuring the calculation of Yoga layout() in Fabric
Reviewed By: shergin
Differential Revision: D13124641
fbshipit-source-id: 6bd03e9f56524221f5d91606ffde50253673c1bb
Summary: This diff refactors the types used when Yoga requires to measure the size of a View in C++
Reviewed By: shergin
Differential Revision: D13124086
fbshipit-source-id: 89dfe80bb41b4fb2eaba84af630d52ef2509b1e1
Summary:
@public
Adds types for a marker API in Yoga.
This will allow us to register callbacks that Yoga can use to log performance data without hard-coding the backend system for that.
Reviewed By: SidharthGuglani
Differential Revision: D13118830
fbshipit-source-id: b42a42c609f0cf66212186f7f20ee572522d59e3
Summary:
> Configure project :ReactAndroid
> The Task.leftShift(Closure) method has been deprecated. This is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
> Task :ReactAndroid:buildReactNdkLib
> A problem was found with the configuration of task ':ReactAndroid:buildReactNdkLib'. Registering invalid inputs and outputs via TaskInputs and TaskOutputs methods has been deprecated and is scheduled to be removed in Gradle 5.0.
> - File '[...]/react-native/ReactAndroid/src/main/jni/react' specified for property '$1' is not a file.
Pull Request resolved: https://github.com/facebook/react-native/pull/22360
Differential Revision: D13176269
Pulled By: hramos
fbshipit-source-id: cf6d498049b955d3920d356f2d68f3bc43008c56
Summary: This is the tweak on the release process of metro: after publishing D13075199 and releasing a new version of Metro, this diff upgrades it in RN along with its yarn.lock file. This should allow us to publish new versions of metro without breaking the RN sanity scripts (or disable them).
Reviewed By: hramos
Differential Revision: D13084224
fbshipit-source-id: 19781ae142db11d7dd8b6ca4303366f7ccb32dcc