Summary: Small perf wins for both iOS and Android.
Reviewed By: PeteTheHeat
Differential Revision: D14237532
fbshipit-source-id: 2be114d36adfa6e8540cb8cbca5412782791d8ce
Summary:
@public
The cloning features of YogaNode don’t seem to be used. Let’s remove them.
Reviewed By: SidharthGuglani
Differential Revision: D14165624
fbshipit-source-id: 5b710964a4abf1b35f3bcc25b143ffc719a03cec
Summary: The changes allows to get the State object on mounting layer and initiate the updates.
Reviewed By: mdvacca
Differential Revision: D14217185
fbshipit-source-id: 370644e06e350932e93c39adbe46544b071c28b3
Summary:
In React Native there are several use cases where React State is not the only input that affects the component tree. E.g., in case of a <Modal> component, the screen size directly affects the layout of components inside modal; in the case of uncontrolled <TextInput> component, the text inside the input affects the layout of the surrounding components. `State` is a special (legit!) workaround for all those similar cases. Native part of React Native maintains a special shared object between all nodes of the same family and use that during cloning and commits.
See coming commits to know how to use that.
In the near future State will fully replace LocalData concept but for simplicity they both exist for now.
Reviewed By: mdvacca
Differential Revision: D14217184
fbshipit-source-id: 6e018c5b68208d662462013bce0f4e2733d2f673
Summary:
A couple of small changes:
1. `onEnqueue` was decoupled from `enqueueEvent` for easier and unified overiding in subclasses (other methods will call `onEnqueue` soon);
2. `flushEvents` was decoupled from `onBeat` (we will put more stuff into `onBeat` soon).
Reviewed By: mdvacca
Differential Revision: D14205769
fbshipit-source-id: 574c2b2caaa6432bc7782b2f3bc147fa1fb82bd3
Summary: `LayoutConstraints::clamp` clamps the provided `Size` between the `minimumSize` and `maximumSize` bounds of this `LayoutConstraints`.
Reviewed By: mdvacca
Differential Revision: D14205770
fbshipit-source-id: 4799608cead393451d334e47dd6906255699a1e8
Summary: Currently, trying to fetch "all" photos will loop and never complete. Now it appears to produce the expected results (acting like the "All Photos" smart library in Photos) and doesn't loop. Confirmed console log results, showing no loops: P60994983
Reviewed By: PeteTheHeat
Differential Revision: D14221545
fbshipit-source-id: 31381b1ba2c673fd210cb95f3b7d0f8ffc23ec3f
Summary:
The following stack is meant to fix all "unsatisfied peer dependencies" that I could find in xplat/js.
Starting from Yarn v2 such problems will become much more noticeable, as they currently behave in unpredictable ways that can include the peer dependency being satisfied by a random package from the dependency tree. The v2 will enforce well-defined relationships between packages.
In this case, RN was missing some dependency required by `babel-preset-fbjs` through peer dependencies.
Reviewed By: pvdz
Differential Revision: D14136856
fbshipit-source-id: 5a7eeee913ebfe63573353683c152ad5512a66e3
Summary:
Placeholder's font not consistent with text's font, it leads to cursor dislocation. We need to keep consistent between placeholder and text.
[iOS] [Fixed] - Fixed placeholder font not consistent with text's font when in multiline mode
Pull Request resolved: https://github.com/facebook/react-native/pull/23654
Differential Revision: D14226174
Pulled By: hramos
fbshipit-source-id: 7cfb3b73d8799d22d5cbbfe557df8de3f5fcf034
Summary:
We already only support `iOS9+`, so we can remove all compatible codes now.
[iOS] [Fixed] - Remove compatible system code for iOS8 and before
Pull Request resolved: https://github.com/facebook/react-native/pull/23656
Differential Revision: D14224986
Pulled By: hramos
fbshipit-source-id: cac9ffe6788dd3eaf4f4f5f2b219f325ba78e85f
Summary:
This diff removes ListView and SwipeableListView from React Native:
* Removes the code and all examples
* Removes the exports on `react-native-implementation` but leaves an error message in dev mode only
* Uses `deprecated-react-native-listview` for `ListView` and `deprecated-react-native-swipeable-listview` for `SwipeableListView`
Both ListView and SwipeableListView are now fully removed from React Native in open source and we will continue to use the deprecated packages internally.
Reviewed By: TheSavior
Differential Revision: D14181708
fbshipit-source-id: 5030c33791f998567de058fee934449c16fa1d54
Summary:
We assume `map` is the type of `Map`, but actually it's not, so we would get type error.
[iOS] [Fixed] - [RNTester] fix getter of result from Image query cache
Pull Request resolved: https://github.com/facebook/react-native/pull/23602
Differential Revision: D14221747
Pulled By: cpojer
fbshipit-source-id: 06cf08078a330e4d5731ad72010c87e9e69fcd7b
Summary: That's bummer that we have to do it, but it's actually reasonable. Files in `core` and `events` depend on each other creating circular dependencies and other similar hard problem.
Reviewed By: mdvacca
Differential Revision: D14195022
fbshipit-source-id: 96a44ae28631cc9ccd7d7de72a94526f9e0dd12a
Summary: Due to the way (initial) surface implementation plays with ReactRootView (RRV), the react tag from the UIManagerModule is now set on the surface container view rather than on RRV as it was historically done. RRV still caches the react tag but just doesn't use it as an id on the view so `RRV.getViewId()` no longer equals `RRV.getReactTag()`.
Reviewed By: mdvacca
Differential Revision: D14110104
fbshipit-source-id: 6dbcc41c85fd7a6c32c7250f68f4a84bed4e075a
Summary:
This diff changes the pre-allocation of Images update the props on the ImageViews during the creation of ShadowNodes instead of during rendering.
The purpose of this change is to optimize TTI.
Reviewed By: shergin
Differential Revision: D14214844
fbshipit-source-id: b81005f2bf494f62f421dc24846e1561e13b9a87
Summary:
iOS pretty much always immediately updates location with the last cached location. This leads to the getCurrentPosition() API often returning this stale location. This change adds filtering to keep waiting until CLLocationManager provides a location fix that passes the requirements for each pending request.
This is potentially breaking in that clients that rely upon getCurrentPosition being extremely fast may find that location fixes take longer than before. However in such cases they should relax their requirements for maximumAge and/or accuracy.
Reviewed By: mmmulani
Differential Revision: D13889626
fbshipit-source-id: f566314ed5968151dad0839b99e0d3c9a562af13
Summary:
Not super clean, but not terrible.
Unfortunately this still relies on the old Paper UIManager calling delegate methods to flush the operations queues. This will work for Marketplace You since Paper will be active, but we need to fix this, along with Animated Events which don't work at all yet.
Random aside: it seems like taps are less responsive in fabric vs. paper, at least on iOS. There is a sporadic delay between the touches event coming in nativly to the JS callback invoking the native module function to start the animation - this will need some debugging.
Reviewed By: shergin
Differential Revision: D14143331
fbshipit-source-id: 63a17eaafa1217d77a532a2716d9f886a96fae59
Summary: It's handy to have all in one file but it also make it hard/impossible to fight with circular dependencies, so I had to slit it.
Reviewed By: mdvacca
Differential Revision: D14188546
fbshipit-source-id: 20809f1ea227c6f8f32922ed5760226248b718e3
Summary:
The previous implementation of the method cloned the root node twice (one time at the very end of the method and one time at the end of loop body).
The new one does it once and a bit more readable.
Reviewed By: mdvacca
Differential Revision: D14187969
fbshipit-source-id: 9859deadd4b041ac115c37108188aab70200c75d
Summary:
RootShadowNode does not have ComponentDescriptor counterpart (because it cannot be created via UIManager) and we used to always clone it manually.
However, apparently, some algorithms (e.g. clone algorithm inside RootShadowNode, which is used by setNativeProps) require valid clone function associated with the node.
So, we implement it.
Reviewed By: JoshuaGross
Differential Revision: D14187762
fbshipit-source-id: a9b6b332a18583217ff0e4f9c15aea0ffb113ba2
Summary:
The ConcreteViewShadowNode was changed to be independend of actual amount of template arguments of ConcreteShadowNode.
We will use it soon.
Reviewed By: JoshuaGross
Differential Revision: D14187761
fbshipit-source-id: b4c8051e2ae3803932713b0c255492466e80d3bd
Summary:
The ScrollView component seems to have been written for a default touch up / touch down scrolling behavior. However, when using snapToInterval, this default behavior of adding PanResponders while the ScrollView is animating or has an active touch causes bugs with the PanResponder hijacking touches it is not supposed to hijack.
Pull Request resolved: https://github.com/facebook/react-native/pull/19110
Differential Revision: D14071342
Pulled By: hramos
fbshipit-source-id: ac285d9967dd6e2a347943b2455d4f986062ef62
Summary:
This mechanism is heavily abused inside of the react-native and inside of the various native modules.
The main problem is that people don't remove their listeners and as result, we have memory leaks.
Some modules like UIManager, NativeAnimatedModule have resources holding Activity context. Those modules are held through a pretty long chain of dependencies.
In order to allow GC to collect those listeners, I replaced the CopyOnWriteSet by WeakHashMap and synchronized access. It is not such a big deal in terms of performance as those listeners are not called/modified too frequently but this prevents hard to debug memory leaks.
Changelog:
----------
Help reviewers and the release process by writing your own changelog entry. When the change doesn't impact React Native developers, it may be ommitted from the changelog for brevity. See below for an example.
[Android] [Fixed] - ReactContext - lifecycle listeners don't cause the leaks even if not removed.
Pull Request resolved: https://github.com/facebook/react-native/pull/22318
Reviewed By: mdvacca
Differential Revision: D13106915
Pulled By: hramos
fbshipit-source-id: d506e5035a7f7bea1b57a6308fb5d9b5fcb277a7
Summary:
Signed-off-by: yukai <yk3372@gmail.com>
In some Android device such as Samsung S8, the ModalHostView's child view can't fill the screen.
before:
![before](https://user-images.githubusercontent.com/1514899/38024961-3e756f8e-32b9-11e8-9555-50a7cf778288.jpeg)
The JS ModalHostView can't fill the bottom, the area is device's navigation bar.
In class ModalHostShadowNode, follow code calculate is error:
`Point modalSize = ModalHostHelper.getModalHostSize(getThemedContext());`
This way not care the device's navigation bar, so the height is smaller than real.
For Samsung S8, real height is 2220 and modalSize.y is 2076.
Pull Request resolved: https://github.com/facebook/react-native/pull/18615
Differential Revision: D14206830
Pulled By: cpojer
fbshipit-source-id: abe35ce1ab253aa1472d2c798543b515218be445
Summary:
Currently, the final field mMainComponentName is used. This field is
initialized in the constructor of ReactActivityDelegate, and the
ReactActivityDelegate itself is initialized in the constructor of
ReactActivity. This means that the only way you can pass a main
component name to ReactActivityDelegate, is when your ReactActivity
subclass is constructed. At this point in the lifecycle of an
activity, the getIntent() value that the activity was initialized by
returns null, making it impossible to set the mainComponentName
dynamically based on data passed to the activity via an intent.
The mMainComponentName final field is also only used in onCreate of
the delegate, so it's not actually needed by the ReactActivityDelegate
at construction time. So the above limitation is not fundamental, it's
just a side effect of the API design.
By allowing subclasses of ReactActivityDelegate to implement a
getMainComponentName method, the subclass then has full control of how
to initialize the value. So an implementation of getMainComponentName
could be:
public String getMainComponentName() {
return getIntent().getStringExtra("reactMainComponentName");
}
This commit doesn't remove anything and only adds a new method, so it
should be fully backwards compatible.
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.
<!--
Required: Write your motivation here.
If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->
Pull Request resolved: https://github.com/facebook/react-native/pull/19814
Differential Revision: D14206644
Pulled By: cpojer
fbshipit-source-id: 8532560f944362fe0cce263a7f9a503df8ae539f
Summary:
<!--
Required: Write your motivation here.
If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->
This PR resolves a warning `Implicit conversion loses floating-point precision: 'double' to 'CGFloat' (aka 'float')` when building not only this library **but also apps** for 32bit devices since it's declared in public header file.
Pull Request resolved: https://github.com/facebook/react-native/pull/19416
Differential Revision: D14206633
Pulled By: cpojer
fbshipit-source-id: a65a4774235fa7fb24fac2f9bf7e51ba2a027377
Summary:
Currently, if we has `defaultValue`, textAttributes like `letterSpacing` can works, but if textinput has not default text, when we typing the text, some attributes not applied.
[iOS] [Fixed] - Fix textAttributes not applied when typing text
Pull Request resolved: https://github.com/facebook/react-native/pull/23585
Differential Revision: D14206568
Pulled By: cpojer
fbshipit-source-id: 7db276d811684bf6e01f8d30287cca80095db87c
Summary:
Do not request interactive input when running on a CI
When I'm running the build on my CI server, many Terminal windows are remaining on the server because of the `read` command.
This PR prevent this behaviour when the `CI` environment variable is defined so that it doesn't alter the behaviour on local machines.
Pull Request resolved: https://github.com/facebook/react-native/pull/19663
Differential Revision: D14206458
Pulled By: cpojer
fbshipit-source-id: 476067ebebb07c6e708469fa8829a06e05c58200
Summary:
In iOS, seems we have no ways to check wether the cached item is from disk or memory, only `storagePolicy == NSURLCacheStorageAllowedInMemoryOnly ` we can think it's from memory. So we need to add a new result like `disk/memory`?
[iOS] [Added] - Add Image query cache result type
Pull Request resolved: https://github.com/facebook/react-native/pull/23608
Differential Revision: D14205902
Pulled By: cpojer
fbshipit-source-id: 29c253878b5c6776cd4776508e24c57e6bfa7dfa
Summary:
1. add role description for heading
2. add talkback navigation support for link and header
Fixes#22440
Pull Request resolved: https://github.com/facebook/react-native/pull/22447
Differential Revision: D14205822
Pulled By: cpojer
fbshipit-source-id: 86bfc3bfc851f3544b1962012abaf8d1a357a9d2
Summary: This diff changes the onMeasure method of the RootView to optimize the amount of times we call updateRootLayoutSpecs in Fabric
Reviewed By: shergin
Differential Revision: D14198155
fbshipit-source-id: ff2deee04540899c25d4e38b0bd93333f74c6ace
Summary: This diff adds a new metric in Fabric to measure time it takes to Fabric finish transaction in CPP
Reviewed By: shergin
Differential Revision: D14198153
fbshipit-source-id: 987d1db1ae669906192060cc9b9e077901da6787
Summary:
Inspired by [react-native-netinfo's config](https://github.com/react-native-community/react-native-netinfo/blob/master/.circleci/config.yml). Annotate each of the major sections in our Circle CI config to reduce friction when contributing to our open source test infrastructure.
I've also removed all single-use aliases. While the old layout improved readability when looking at a particular job, it also obscured the actual command being run, as well as introduced unnecessary friction (contributors would need to understand how aliases work, syntax is finicky).
I've also moved the oss sanity checks to the analysis job, as we don't want this test to block the checkout_code job from succeeding, which would block all other downstream jobs.
There should be no other material changes to the actual jobs.
[General] [Changed] - Updated open source test configuration
Pull Request resolved: https://github.com/facebook/react-native/pull/23606
Differential Revision: D14199783
Pulled By: hramos
fbshipit-source-id: 61072eec5c05b8731916a9d8f6bc09ae5191fbb5
Summary:
Add nullable annotations to BaseViewManager and ViewManager methods. This will improve Kotlin developer experience and help Android Studio to offer better autocomplete.
[Android] [Changed] - add nullable annotations to BaseViewManager and ViewManager methods. Might break ViewManagers in Kotlin.
Pull Request resolved: https://github.com/facebook/react-native/pull/23610
Differential Revision: D14198630
Pulled By: mdvacca
fbshipit-source-id: c596c88254e1d02f0af233a466f685200fac8917
Summary:
This commit fixes a bug introduced in a previous attempt (https://github.com/facebook/react-native/pull/23580) to address an issue where okhttp appended `charset=utf-8` to the Content-Type header when otherwise not specified.
In that commit, I converted all characters to UTF-8, however it should instead use an existing encoding when possible.
Related issues:
https://github.com/facebook/react-native/issues/8237#issuecomment-466304854
[Android][fixed] - Respect existing character set when specified in fetch() POST request
Pull Request resolved: https://github.com/facebook/react-native/pull/23603
Differential Revision: D14191750
Pulled By: hramos
fbshipit-source-id: 11c1bfd98ccd33cd8e54ea426285b7d2ce9c2d7c
Summary: "Critical" or "Fast" JNI methods are enticing by their name, but carry dangers that are not trivially visible.
Reviewed By: davidaurelio
Differential Revision: D14184560
fbshipit-source-id: 89ec70f53bb2cb89ff568d8b1fe222ede86c9824