Граф коммитов

18204 Коммитов

Автор SHA1 Сообщение Дата
Christoph Nakazawa 9a0ebe0aba Move ART JS files to FB internal
Summary: This is part of Lean Core.

Reviewed By: rubennorte

Differential Revision: D17343246

fbshipit-source-id: 1185e6c1f75e8272048ce1a24c2f195728d436c4
2019-09-13 07:47:57 -07:00
Christoph Nakazawa 56fb72b2c8 Move RCTNetInfo iOS to Facebook internal
Summary: This is the only remaining part of NetInfo that's in open source. Moving it to FB internal.

Reviewed By: motiz88

Differential Revision: D17343031

fbshipit-source-id: 482a2daa397aa9f1391a72775735027de996ddb3
2019-09-13 05:18:52 -07:00
Mehdi Mulani 8831cc6ac2 Combine rn_debug_flags and rn_feature_flags
Summary:
@public
Both of these are used for turning BUCK configs and build mode into compiler flags, so we should combine them to avoid confusion on where they are to be used.

Reviewed By: fkgozali

Differential Revision: D17262579

fbshipit-source-id: d145374fd619068f794018d79111720d30f6269c
2019-09-12 13:09:29 -07:00
Ram N 3e02f1f929 Make View Managers lazy
Summary: Today, View Managers are all initialized as soon as we start up the app. Making them lazy, so that we only intantiate them when they are really needed

Differential Revision: D17329940

fbshipit-source-id: 821bf121f04d58c7b871c7923fed81d8c735f8b4
2019-09-12 11:48:14 -07:00
Daniel Andersson 91e35b24e3 Include missing <cstdarg>
Summary: Include <cstdarg>, which defines the va_start and va_end macros.

Reviewed By: tmikov

Differential Revision: D17344433

fbshipit-source-id: f51fb53cc6e016eeef1a9270c1f2c468a5edc967
2019-09-12 10:53:22 -07:00
Amir Shalem b8d1dda57a Add standalone factory classes which generate YogaNode + YogaConfig
Summary:
Add standalone factory classes which generate YogaNode + YogaConfig, later on it will allow us to separate the yoga interface and actual implementation buck targets (see D17266406)

We've done such breakage change previously in D14122974.

Reviewed By: SidharthGuglani

Differential Revision: D17258196

fbshipit-source-id: b12f1a0d23c3f82b14cee0731a1daf1c015ee32c
2019-09-12 06:04:40 -07:00
Kacper Wiszczuk 83a16b16c9 fix: prevent activity recreation on theme change (#26413)
Summary:
On Android 10 whole activity is recreated when the user changes system theme. We should prevent it by adding `uiMode` in `android:configChanges` key in the default template.

## Changelog

[Android] [Fixed] - Android 10: Prevent activity recreation on theme change
Pull Request resolved: https://github.com/facebook/react-native/pull/26413

Test Plan: NOOP

Differential Revision: D17342811

Pulled By: cpojer

fbshipit-source-id: 2bed9b5f91e1b67451fefe34b02a1129d6c80d15
2019-09-12 05:10:58 -07:00
Janic Duplessis 6f5c357ba3 Add some missing dependencies to the fabric podspec (#26197)
Summary:
Managed to get fabric building in my app. Here are the changes needed in the podspec.

There were other issues with codegen but it would be too involved to fix for now. This is a good first spec to get it working better in OSS.

## Changelog

[iOS] [Fixed] - Add some missing dependencies to the fabric podspec
Pull Request resolved: https://github.com/facebook/react-native/pull/26197

Test Plan: Managed to get fabric building in a project.

Reviewed By: cpojer

Differential Revision: D17091504

Pulled By: osdnk

fbshipit-source-id: a5d0c46899e342e07ceafc2e4514a03fabf1471d
2019-09-12 04:17:25 -07:00
Moti Zilberman 5789e67760 Reuse preprocessed exception message in redbox after symbolication
Summary: Reuse preprocessed exception message when sending the symbolicated update to the redbox, in case `preprocessException` has actually modified it.

Reviewed By: cpojer

Differential Revision: D17318008

fbshipit-source-id: 8b4c606c662140fb44c5305e2f3c7faa0b60f0ee
2019-09-12 03:55:41 -07:00
Christoph Nakazawa e54ecf907e Move `react-native-implementation.js` to `index.js`
Summary: I am unsure whether there was a reason not to use an `index.js` file from the beginning. It always struck me as confusing and odd to have the main API hidden in a folder somewhere. This changes RN to use the standard `index.js` file that is common in almost all JavaScript packages.

Reviewed By: yungsters, rubennorte

Differential Revision: D17314423

fbshipit-source-id: 10eaf4fddd41e91163de7d10c0879b623dab00d7
2019-09-12 03:29:51 -07:00
zhongwuzw 607e258c6a Make surface presenter manage start of surface (#24372)
Summary:
1. Start surface when first run, before, when we first load js bundle, `_startAllSurfaces` would not be called because `bridge == _batchedBridge`.
2. I think this fixes https://github.com/facebook/react-native/issues/23910, so I add the `return` in swizzle method to check.

cc shergin.

## Changelog

[iOS] [Fixed] - Make surface presenter manage start of surface
Pull Request resolved: https://github.com/facebook/react-native/pull/24372

Test Plan: N/A.

Differential Revision: D17337865

Pulled By: shergin

fbshipit-source-id: 2a1e413c006cae74ef6ca4c2b6b5ee8a46434b7f
2019-09-11 21:27:51 -07:00
Valentin Shergin 791d0973cc Fabric: Making subprops of `EmptyLayoutMetrics` also empty/invalid
Summary:
This diff changes the value of `EmptyLayoutMetrics` to make it as unusual and useless as possible. This helps when we need to compare sub-values of `LayoutMetrics` to apply only changed ones.

For example, let say we need to make a transition between two `LayoutMetrics` values. Let's say the first (the source) one equals `EmptyLayoutMetrics`. In order to apply only changed part, we need to compare individual sub-values, like `frame` or `displayType`. Before this change, the default value of `borderWidth` was `{0, 0, 0, 0}`. So in case if the second (the destination) value is also `{0, 0, 0, 0}`, the operation will be skipped.
This is undesirable because all new values have to be applied anyway because `EmptyLayoutMetrics` designates that the actual previous values are unknowns.

This fixes some visual issues on iOS caused by this issue because recycled views sometimes have non-default layout values where the transition from `EmptyLayoutMetrics` to some arbitrary value skips some sub-values.

Reviewed By: JoshuaGross

Differential Revision: D17312176

fbshipit-source-id: 7f311baea202ec2662ca87be0ae0ae6c6dd42712
2019-09-11 18:29:22 -07:00
Valentin Shergin 9490ca66dd Fabric: Small simplification in UIView+ComponentViewProtocol
Summary: Now we use `std::isfinite` instead of a pair of `std::isnan` and `std::isinf` which improves readability.

Reviewed By: sammy-SC

Differential Revision: D17312174

fbshipit-source-id: 76175524de566745962e96e46effe0bce52a09ad
2019-09-11 18:29:22 -07:00
Valentin Shergin fc0b03a0d1 Fabric: Small perfromance optimization in `[RCTViewComponentView updateLayoutMetrics:oldLayoutMetrics:]`
Summary:
Before this change, we reapply all layout props for all newly mounted views (on `insert` instruction), now we use stored `_layoutMetrics` value to apply only changed subset.
This is only available for `RCTViewComponentView` subclasses (where we have an ability to store a previous value), all other implementation of `RCTComponentViewProtocol` will work as usual.

Reviewed By: JoshuaGross, sammy-SC

Differential Revision: D17312175

fbshipit-source-id: b202583c0c58987876d906b748ef3a749f8dad70
2019-09-11 18:29:22 -07:00
Ramanpreet Nara fc9c53d621 Refactor Promise returns
Summary:
Because we use the `PromiseWrapper` struct, we need to explicitly manage its lifecycle to ensure that it doesn't clear before the promise methods are invoked by the ObjC Runtime. This `PromiseWrapper` struct is unnecessary. We could just not have it and create the CallbackWrappers for resolve and reject within the `createPromise` function. Therefore, I moved all the logic from `PromiseWrapper` to the `RCTTurboModule::createPromise` function.

In the next diff, I'm going to keep a track of all the CallbackWrappers we create in instances of RCTTurboModule, and `destroy()` them in the destructor of RCTTurboModule. This should make sure that all `jsi::Function`s are released before we delete the `jsi::Runtime`, which should prevent Marketplace from crashing when we hit CMD + R. See: https://fb.workplace.com/groups/rn.support/permalink/2761112713937326/.

Reviewed By: fkgozali

Differential Revision: D17208729

fbshipit-source-id: ce80c9c01088f0e3dc47c7c29397b7a197d699ce
2019-09-11 14:58:17 -07:00
Sidharth Guglani 1de8436c2c Remove unused YogaNodeJNIPhantomRefs.java
Summary:
Removed unused file YogaNodeJNIPhantomRefs.java as this was causing oss build failures because of an import.

````:yoga:compileDebugJavaWithJavac/home/travis/build/facebook/yoga/java/com/facebook/yoga/YogaNodeJNIPhantomRefs.java:9: error: package com.facebook.jni does not exist
import com.facebook.jni.DestructorThread;
                       ^
/home/travis/build/facebook/yoga/java/com/facebook/yoga/YogaNodeJNIPhantomRefs.java:30: error: package DestructorThread does not exist
    new DestructorThread.Destructor(node) {
                        ^
2 errors
 FAILED

Reviewed By: pasqualeanatriello

Differential Revision: D17257330

fbshipit-source-id: 98b0c5d5b7dcd94bee559b58194c13b07f47723d
2019-09-11 10:27:51 -07:00
Samuel Susla c8ae58880d Migrate ARTSurfaceView to fabric
Summary:
Migrates ARTSurfaceView to Fabric,

This diff only migrates the necessary minimum for RCTVideo component to work. Other ART components are
ARTNode, ARTGroup, ARTRenderable, ARTShape and ARTText.

Reviewed By: mdvacca

Differential Revision: D17181298

fbshipit-source-id: c2656bbcaefde25e37a9e05a64d2691bc2343b67
2019-09-11 08:43:48 -07:00
jainkuniya 9349313c99 picker: Add `warnOnce` saying, it has been moved to `@react-native-community/picker` (#25899)
Summary:
`Picker` & `PickerIOS` are moved to `react-native-community/picker`(https://github.com/react-native-community/react-native-picker) as part of https://github.com/facebook/react-native/issues/23313,

## Changelog

[Picker] [deprecate] - Add `warnOnce` saying, it has been moved to `react-native-community/picker`
Pull Request resolved: https://github.com/facebook/react-native/pull/25899

Test Plan:
Import Picker from `react-native`: warning will be visible saying
```
Picker has been extracted from react-native core and will be removed in a future release. It can now be installed and imported from 'react-native-community/picker' instead of 'react-native'. See https://github.com/react-native-community/react-native-picker
```

Differential Revision: D17314510

Pulled By: cpojer

fbshipit-source-id: 15798698eaab9eee5fddef5be24d21ec52c4134a
2019-09-11 08:04:35 -07:00
Alec Larson 4fc3e7ae71 fix: avoid calling Timing.deleteTimer for setImmediate and requestIdleCallback (#26113)
Summary:
Fix a simple error where `types[index]` was being accessed after it was cleared, instead of before.

## Changelog

[iOS] [Fixed] - never call deleteTimer for setImmediate and requestIdleCallback
Pull Request resolved: https://github.com/facebook/react-native/pull/26113

Test Plan: None

Differential Revision: D17314489

Pulled By: cpojer

fbshipit-source-id: 74715f0f7cc2d5cee3b97a67313c5e96e9d6c555
2019-09-11 06:04:41 -07:00
gaodeng 796b3a1f88 iOS13 status bar has now 3 styles (#26294)
Summary:
iOS13 status bar has now 3 styles
UIStatusBarStyleDefault, UIStatusBarStyleLightContent, UIStatusBarStyleDarkContent

UIStatusBarStyleDefault now acts as an automatic style which will set it’s value dynamically based on the the userinterfacestyle(One of the traits) of the viewcontroller that controls the status bar appearance.

## Changelog

[iOS] [Fixed] - iOS13 new status bar style UIStatusBarStyleDarkContent
Pull Request resolved: https://github.com/facebook/react-native/pull/26294

Differential Revision: D17314054

Pulled By: cpojer

fbshipit-source-id: ea109e729bb551dff314bc00a056860a8febb0e9
2019-09-11 05:13:01 -07:00
jeswinsimon 20ab946f34 Support bare hosts. Add missing / between url (#26050)
Summary:
Fix for https://github.com/facebook/react-native/issues/26019 URL cannot handle "localhost" domain for base url. Also noticed another issue where `/` is not added between base URL and path if it is missing. Added fix for that too.

## Changelog

[Javascript] [Fixed] - `URL`: Bare Hosts are now supported.
Pull Request resolved: https://github.com/facebook/react-native/pull/26050

Test Plan:
* `new URL('home', 'http://localhost')` now returns `http://localhost/home` instead of throwing an error.
* `new URL('en-US/docs', 'https://developer.mozilla.org')` now returns `https://developer.mozilla.org/en-US/docs` and not `https://developer.mozilla.orgen-US/docs`.

Differential Revision: D17314137

Pulled By: cpojer

fbshipit-source-id: ef56c4f4032187a7efee32b28e2b3c935b6a2599
2019-09-11 05:09:36 -07:00
Siddhant Soni 314eba98b2 Added check to handle all cases of MissingWebViewPackageException (#26189)
Summary:
We have been experiencing the below crashes in our Flipkart Android app:

![image](https://user-images.githubusercontent.com/16662518/63784983-2be9a100-c90d-11e9-998d-2e5085f1dec6.png)
![image](https://user-images.githubusercontent.com/16662518/63784988-3146eb80-c90d-11e9-89d4-18693b566284.png)

Stack overflow thread for the issue that is causing this crash: [https://stackoverflow.com/a/56246743](https://stackoverflow.com/a/56246743)

The change I have done is an enhancement on the following PR which got merged to master: [https://github.com/facebook/react-native/pull/24533](https://github.com/facebook/react-native/pull/24533)

The exception handling for this crash already exists but it relies on having a specific string in the error message ("Webview not installed"). But the error message for the crashes above does not include this string.

I have added a check for all the crashes involving the `MissingWebViewPackageException`.
Refer the file: [https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/webkit/WebViewFactory.java#102](https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/webkit/WebViewFactory.java#102)

## Changelog

[ANDROID] [Fixed] - The ReactCookieJarContainer/ForwardingCookieHandler now handles all the cases of missing WebView exceptions gracefully.
Pull Request resolved: https://github.com/facebook/react-native/pull/26189

Test Plan:
No new tests have been added.
CI should pass.

This fix was made based on the exception stacktrace. I have not spent the time to acquire one of the devices that it is happening on.

Differential Revision: D17258881

Pulled By: cpojer

fbshipit-source-id: 3abb061e345329214025ebab2b3a908f9cce434d
2019-09-11 05:06:40 -07:00
Alec Larson 021cbccbf2 fix: use proper timestamp in frameElapsed calculation (#26114)
Summary:
Fix a bug where `CACurrentMediaTime` was being used to calculate the elapsed frame time, even though it's not comparable to `NSDate.timeIntervalSince1970` time.

## Changelog

[iOS] [Fixed] - callIdleCallbacks deadline calculation
Pull Request resolved: https://github.com/facebook/react-native/pull/26114

Test Plan: None

Differential Revision: D17314125

Pulled By: cpojer

fbshipit-source-id: 5061a3954371df2134f0c77dc260228668abe747
2019-09-11 04:54:21 -07:00
Hassan Bazzi 9bc803f0ba Rename yoga.podspec to Yoga.podspec (#26360)
Summary:
When doing RN init from scratch for 0.61, I noticed pod install was failing. This was because "Yoga.podspec" was mis-spelled to "yoga.podspec" in the yoga ReactCommon folder. Thus, `pod install` was failing

```
[!] No podspec found for `Yoga` in `../node_modules/react-native/ReactCommon/yoga
```
## Changelog

[iOS] [Fixed] - Fix Yoga.podspec case sensitivity
Pull Request resolved: https://github.com/facebook/react-native/pull/26360

Test Plan: `pod install` now runs successfully with a clean build of master.

Differential Revision: D17314027

Pulled By: cpojer

fbshipit-source-id: 8db2ac4dd9295afcc0e074c842dcda71b7b3b668
2019-09-11 04:12:17 -07:00
Adam Chelminski 42ee5ec934 Expose RCTNetworking as a public 'Networking' API (#25718)
Summary:
This PR introduces the `EventSource` web standard as a first-class networking feature in React Native. In the discussion we had in February at https://github.com/react-native-community/discussions-and-proposals/issues/99, cpojer indicated that the RN maintainers would be willing to accept a PR to offer this functionality.

The linked discussion goes into detail about why this change must happen in React Native Core as opposed to a community library, but the tl;dr is that `XmlHttpRequest` doesn't let you do streaming in a resource-efficient way, since it holds onto the entire response buffer until the request is complete. When processing a stream that might last for a long time, that's not ideal since there might be a lot of data in that buffer that is now useless to maintain.

For more information about EventSource and server-sent events, check out these links:
* [EventSource on MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventSource)
* [Using server-sent events on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
* [WHATWG spec for server-sent events](https://html.spec.whatwg.org/multipage/server-sent-events.html)

I've tried as best as I can to satisfy the linked specification so that this is as standard as possible.

One of the projects I maintain has an ideal use case for this feature. The SDK for MongoDB Stitch (a backend-as-a-service for the MongoDB database) has the ability to open a "change stream" to watch for changes that happen on a database. However, in our JavaScript SDK, this feature depends on `EventSource`, because the backend service implements the one-way streaming protocol with server-sent events. We know there is demand for this feature because users have requested it: https://github.com/mongodb/stitch-js-sdk/issues/209.

If this PR will be accepted, I am happy to update the `Networking` documentation at https://facebook.github.io/react-native/docs/network

## Changelog

[JavaScript] [Added] Implements the `EventSource` web standard in `Libraries/Networking`
[JavaScript] [Added] Exposes the `EventSource` implementation in `Libraries/Core/setUpXHR.js`
Pull Request resolved: https://github.com/facebook/react-native/pull/25718

Test Plan:
To test the `EventSource` implementation, I added a comprehensive set of unit tests that cover the basic functionality, as well as edge cases that are laid out in the spec. See `EventSource-test.js` for the cases that the tests handles. For convenience, I've also included the test descriptions as produced by the `jest` test output here.

```
 PASS  Libraries/Network/__tests__/EventSource-test.js
  EventSource
    ✓ should pass along the correct request parameters (527ms)
    ✓ should transition readyState correctly for successful requests (4ms)
    ✓ should call onerror function when server responds with an HTTP error (2ms)
    ✓ should call onerror on non event-stream responses (1ms)
    ✓ should call onerror function when request times out (1ms)
    ✓ should call onerror if connection cannot be established (1ms)
    ✓ should call onopen function when stream is opened (1ms)
    ✓ should follow HTTP redirects (2ms)
    ✓ should call onmessage when receiving an unnamed event (2ms)
    ✓ should handle events with multiple lines of data (1ms)
    ✓ should call appropriate handler when receiving a named event (1ms)
    ✓ should receive multiple events (1ms)
    ✓ should handle messages sent in separate chunks (1ms)
    ✓ should forward server-sent errors
    ✓ should ignore comment lines (1ms)
    ✓ should properly set lastEventId based on server message (1ms)
    ✓ should properly set reconnect interval based on server message
    ✓ should handle messages with non-ASCII characters (1ms)
    ✓ should properly pass along withCredentials option (3ms)
    ✓ should properly pass along extra headers (1ms)
    ✓ should properly pass along configured lastEventId (2ms)
    ✓ should reconnect gracefully and properly pass lastEventId (9ms)
    ✓ should stop attempting to reconnect after five failed attempts (2ms)
```

As a manual E2E test, I also added streaming support to the Stitch React Native SDK, and tested it with my React Native EventSource implementation, and confirmed that our `EventSource`-based streaming implementation worked with this `EventSource` implementation.
* Source code for E2E app test: https://gist.github.com/adamchel/6db456c1a851ed7dd20b54f6db3a6759
* PR for streaming support on our React Native SDK: https://github.com/mongodb/stitch-js-sdk/pull/294
* Very brief video demonstrating E2E functionality: https://youtu.be/-OoIpkAxmcw

Differential Revision: D17283890

Pulled By: cpojer

fbshipit-source-id: 0e9e079bdb2d795dd0b6fa8a9a9fa1e840245a51
2019-09-11 03:24:03 -07:00
Valentin Shergin 83f8d13a99 Fabric: Explicit Scheduler creation and destruction management in RCTSurfacePresenter
Summary: Previously, the `_scheduler` method in `RCTSurfacePresenter` was implemented as a lazy getter. The only problem with that is that Scheduler instance might be (re)created in the middle of the hot-reloading process (e.g. external request to relayout some Surface might trigger that). Since it does not make any sense to create an empty Scheduler during the reloading process, now the Scheduler creation only happens in constructor and right after the VM is reloaded.

Reviewed By: JoshuaGross

Differential Revision: D17299441

fbshipit-source-id: 273451bbb03e8cdf532131adfdf3bc60c34e997e
2019-09-10 21:33:42 -07:00
zhongwuzw 46d6e2a600 Remove cxx from iOS project (#25392)
Summary:
Remove cxx from iOS project, because we have the corresponding implementation in iOS. Otherwise, it would break the logical handling of iOS part.

## Changelog

[iOS] [Fixed] - Remove cxx from iOS project
Pull Request resolved: https://github.com/facebook/react-native/pull/25392

Test Plan: Fabric enabled Tester can work like loading image.

Reviewed By: mdvacca

Differential Revision: D17285463

Pulled By: shergin

fbshipit-source-id: b414406578dcce51f3b54fd06941225efc560e7f
2019-09-10 13:40:42 -07:00
Tianyu Yao 76ace4764b Upgrade eslint-plugin-relay to 1.3.11
Summary:
Bump eslint-plugin-relay version to 1.3.11 on fbsource
`js1 upgrade dependency --package eslint-plugin-relay@1.3.11`

And enable lint rule for checking second argument on relay hooks

Reviewed By: jstejada

Differential Revision: D17261273

fbshipit-source-id: 1d898535079ba5b7a7ee0d179e6e68f6a5e2bd46
2019-09-10 10:03:23 -07:00
Janic Duplessis 1bff38a5f1 Fix rntester buck build (#26221)
Summary:
CI buck build is currently broken, this fixes it.

## Changelog

[Internal] [Fixed] - Fix rntester buck build
Pull Request resolved: https://github.com/facebook/react-native/pull/26221

Test Plan: `buck fetch rntester && buck build rntester`

Reviewed By: cpojer

Differential Revision: D17091483

Pulled By: osdnk

fbshipit-source-id: 09fd86270e7b27d2632b936cc809d80299c7ab38
2019-09-10 04:00:33 -07:00
Samuel Susla c2d28074b3 Fix syntax errors in commands codegen
Summary:
I noticed two syntax errors in code gen while using it. This fixes them.
One of them is missing semicolon, the other one is name mismatch.

Reviewed By: TheSavior

Differential Revision: D17226188

fbshipit-source-id: 880dbf4c9b22efa7754de6413d01c04e7abbe411
2019-09-10 03:40:03 -07:00
Joshua Gross 84a05a11b9 Always use `forceUpdate` for Fabric JS animations (resubmit)
Summary:
This bypasses setNativeProps and causes all animations to go through the mounting layer in Fabric only. Resubmit of D17201061

Changelog:
[Internal]

Reviewed By: yungsters

Differential Revision: D17246910

fbshipit-source-id: 88effbaa9b04b277b07cd14427c59e464549ad4a
2019-09-09 22:24:48 -07:00
Valentin Shergin b8ca677d70 Fabric: Stop commiting an empty tree in ShadowTree destructor
Summary:
The code is moved from the destructor a separate method that we now call in the Scheduler::stopSurface.
That makes the code more readable and resilient to possible races and ownership-related changes.

Reviewed By: JoshuaGross

Differential Revision: D17272294

fbshipit-source-id: 948d76d074577beb3dda6defdf09261b5c8abb98
2019-09-09 20:26:25 -07:00
Valentin Shergin 28a5f122a8 Fabric: `MountingCoordinator::revoke()`
Summary:
MountingCoordinator is a borderline between Core and Mounting. Some of Core design constraints are impossible/impractical to enforce on Mounting layer, so we have to handle all of those cases in `MountingCoordinator`.

One of the constrains is that all ShadowNodes implicitly depend on associated ComponentDescriptor instances without retaining them (retaining is expensive and creates a retain cycle).
The problem is that the Mounting layer can call `MountingCoordinator::pull()` at any moment (even after the whole Core is already destroyed). To prevent this, the owner of a `MountingCoordinator` on the Core side calls `revoke()` right before being deallocated (right before the moment the owner cannot guarantee the constraint).

Reviewed By: JoshuaGross

Differential Revision: D17272295

fbshipit-source-id: ba8b02eab8f84cce68aa65c1ad36950cd2498049
2019-09-09 20:26:25 -07:00
Joshua Gross 27fca36a9a Attempt to collate Remove/Delete mounting items
Summary:
Collapse many Remove/Delete mount items into a single batched item.

Since a delete is always preceded by a remove mountitem, we can batch these into one instruction. Since deletes tend to come in large blocks, it might make sense to batch many into a single instruction.

Reviewed By: mdvacca

Differential Revision: D17254631

fbshipit-source-id: abfd54cdb0bbb9a4c0880ec8e8bbd681367aecd4
2019-09-09 19:54:34 -07:00
Joshua Gross d7d848e824 In Binding.cpp, retain reference to reactNativeConfig
Summary: Retain reference to reactNativeConfig to allow feature checks within core. This also rearranges the members of Binding to make them private instead of public.

Reviewed By: mdvacca

Differential Revision: D17275344

fbshipit-source-id: 67ad00aeebd3534a45a6ea8a28e14b7fcd9eb2e5
2019-09-09 19:54:34 -07:00
Joshua Gross 09aefa191b ReactNativeConfigHolder must retain underlying Java object as global_ref
Summary: We were using an alias_ref which is like a raw pointer (not managed/retained); as it turns out, everywhere (?) else we accept an alias_ref we convert it to a global_ref (see Binding.cpp, JMessageQueueThread). We've just gotten lucky to not have already hit use-after-free errors.

Reviewed By: mdvacca

Differential Revision: D17275200

fbshipit-source-id: 581a51da36e96c353ed1117e9e0f428e65d36d69
2019-09-09 19:54:33 -07:00
Joshua Gross 21977f895a Log multi-line MountItems properly; log every MountItem in a BatchMountItem
Summary:
Log every item in a BatchMountItem. There's a lot of useful debug information being hidden there currently.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D17254629

fbshipit-source-id: c72f0aa8506059da5225ebead24d3f8ead5bdebd
2019-09-09 19:54:33 -07:00
Kevin Gozali e92235ddf2 Move architecture indicator to internal only
Summary: Since it's only relevant/used internally at FB.

Reviewed By: JoshuaGross

Differential Revision: D17273015

fbshipit-source-id: 0ac6cc48d1c7625c5c867fd8b3a896b44b2b9940
2019-09-09 18:40:02 -07:00
Kevin Gozali d0c618a1f1 Add prefix to the architecture overlay
Summary: This indicator is not to be used globally, only to some folks. For now prefix it with (FB-ONLY) since it's only used internally at FB.

Reviewed By: PeteTheHeat

Differential Revision: D17266514

fbshipit-source-id: f22411c26f5f412a1a3da9666f57cffabd2cc017
2019-09-09 18:40:02 -07:00
Tim Yung 8924639613 RN: Improve `nativeImageSource` Return Type
Summary: Now that `ImageURISource` is a proper type, `nativeImageSource`'s return type should simply use that instead of being an untyped `Object`.

Reviewed By: cpojer

Differential Revision: D17246527

fbshipit-source-id: 6ec0c80a93b8794e6c243154875e3560ddacbc59
2019-09-09 14:58:38 -07:00
Ramanpreet Nara 1c2671c8c9 Clean up local references created for method calls
Summary: Whenever we invoke a method, we convert JS arguments into JNI objects. These JNI objects are all local references that need to be manually destroyed after the method call happens. Therefore, I'm using `JniLocalScope` to automatically do this whenever the stack is cleared after the call to `JavaTurboModule::invokeJavaMethod`. This should hopefully get rid of the JNI table overflow we're seeing in T52817336.

Reviewed By: mdvacca

Differential Revision: D17244061

fbshipit-source-id: 92ca78cdb23ad8dfe2425db46e086c10c9662fe2
2019-09-09 13:21:44 -07:00
Anandraj 75a7a52db4 fixing ATOMIC_VAR_INIT call (#26238)
Summary:
We're trying to build react-native on Windows (part of the Microsoft\react-native-windows project) with MSVC compiler with WITH_FBSYSTRACE set to true (to route the traces to ETW). This change is to fix a compilation error due to the non standard usage of ATOMIC_VAR_INIT macro called with no parameters. It's not absolutely clear to me the objective of this macro in the standard at all (to be used in c context ?), and which compiler does support this parameterless version (gcc?).

Also, I'm more inclined towards changing the statement to just "std::atomic_uint_least32_t m_systraceCookie{};". Please confirm.

## Changelog

[General] [Fixed] - Removing the non-standard usage of ATOMIC_VAR_INIT macro from code with systrace enabled
Pull Request resolved: https://github.com/facebook/react-native/pull/26238

Test Plan: Build verification should suffice as there is no semantic change introduced by this change.

Differential Revision: D17259213

Pulled By: cpojer

fbshipit-source-id: 9fe44f9220f18399a58f94f0f01d5fa93e6458e0
2019-09-09 07:55:25 -07:00
Jakob Krigovsky cc35d0f1bc Fix typos in comments about use_frameworks! (#26381)
Summary:
Fixes typos in code comments about CocoaPods’s `use_frameworks!`.

## Changelog

[Internal] [Fixed] - Fix typos in comments about `use_frameworks!`
Pull Request resolved: https://github.com/facebook/react-native/pull/26381

Test Plan: Considering this only changes code comments, I don’t think this pull request needs a test plan.

Differential Revision: D17258856

Pulled By: cpojer

fbshipit-source-id: fd9a7253ef9744685c233ebbec7df9eea50a8d28
2019-09-09 07:23:59 -07:00
Frieder Bluemle b584832ae9 Add RNTester Pods to gitignore (#26265)
Summary:
Pods directory showed up as untracked files after running `pod install`
in the `RNTester` directory. With this small change to `.gitignore`, it
will no longer show up.

## Changelog

Small repo-level change, no changelog needed (?)
Pull Request resolved: https://github.com/facebook/react-native/pull/26265

Test Plan:
Run `pod install` in `/RNTester`, verify that "Pods" no longer show up
as untracked files in `git status`.

Differential Revision: D17259103

Pulled By: cpojer

fbshipit-source-id: 72a3774bcb48c88c2c6629bf452ddb0cbc32f581
2019-09-09 07:20:20 -07:00
Benoit Dion 5f53cb0b85 Add missing available guard to RCTInputAccessoryViewContent (#26332)
Summary:
The new podspec includes all .h and .m files, `RCTInputAccessoryViewContent` was missing a tvOS guard.

## Changelog

[iOS] [Fixed] - Restore RCTText tvOS pod compatibility
Pull Request resolved: https://github.com/facebook/react-native/pull/26332

Test Plan: Build RCTText for tvOS

Differential Revision: D17258958

Pulled By: cpojer

fbshipit-source-id: 5e7408680133aa3ec111552d1413a928193945a7
2019-09-09 07:04:50 -07:00
Max Thirouin e6b2cf0418 Fix incorrect `module.name_mapper` in template .flowconfig (#26330)
Summary:
Has explained in https://github.com/facebook/react-native/issues/26233, current template is incorrect & can create error, like having require() of png that are considered as `string` instead of `number. This can probably hide tons of similar mistakes.

The change in this PR should resolve the previous behavior (& for example, some places in previous version of the flowconfig have the full path like here 35300147ca/template/_flowconfig (L61))

Closes https://github.com/facebook/react-native/issues/26233

## Changelog

```
[General] [Fixed] Fix incorrect `module.name_mapper` in template .flowconfig
```

Alternatively, message could be

```
[General] [Internal] Fix incorrect `module.name_mapper` in template .flowconfig
```

As it hasn't this "bug" hasn't been released in a public stable release. You decide
Pull Request resolved: https://github.com/facebook/react-native/pull/26330

Test Plan: I just tested this in my project, thymikee might be able to confirm & approve this PR.

Differential Revision: D17258891

Pulled By: cpojer

fbshipit-source-id: 3904ffbc6f076ee0e435311249d694b8604fc7b8
2019-09-09 06:45:38 -07:00
Mike Grabowski 16d8802b22 Update CircleCI config as per support request (#26329)
Summary:
This is a cherry-pick of the fix on 0.61-stable that fixes an issue with CircleCI.
fafc58b62d
Pull Request resolved: https://github.com/facebook/react-native/pull/26329

Differential Revision: D17258952

Pulled By: cpojer

fbshipit-source-id: 5116a143b582ab4835d7a53f4037a7b7e749f3a8
2019-09-09 06:42:29 -07:00
Frieder Bluemle 87f94d5587 Skip lint check for dynamic react-native version (#26222)
Summary:
The `dependencies` section in the `build.gradle` Android template contains this line:

    implementation "com.facebook.react:react-native:+"  // From node_modules

It causes the following Gradle Lint warning:

> Avoid using '+' in version numbers, can lead to unpredictable or unrepeatable builds

In this case, as the `// From node_modules` comment suggests, the version is _not_ determined by Gradle but by the version specified in `package.json` - Using "+" is completely fine and intentional.

Therefore it can safely be ignored, which is what the added `//noinspection` comment does.

## Changelog

[Android] [Fixed] - Skip lint check for dynamic react-native version
Pull Request resolved: https://github.com/facebook/react-native/pull/26222

Test Plan: Projects generated with the new template no longer cause the warning anymore.

Differential Revision: D17091476

Pulled By: osdnk

fbshipit-source-id: 910b4ecf22ccd11cade9427af68087ffcce8bc8e
2019-09-09 06:33:06 -07:00
Kevin Gozali 24ababc915 Back out "[RN] Remove RCTUIImageViewAnimated WeakProxy gating"
Summary:
Original commit changeset: 91eb08181f82
Original diff: D16940181

The original commit removed the gating logic to enable the "fix" to T48583301. However, v236 was burned, and v237+ no longer had this gating, making it impossible to measure the impact of the fix.

This diff reverted the original gating removal until we confirm the fix in prod. Note: this is to be picked to RC v238 (but will have merge conflict for sure, will send a separate diff for the branch).

Reviewed By: mmmulani

Differential Revision: D17251340

fbshipit-source-id: 359ac54aeb9c9e728c2735c688346a1f79ed2189
2019-09-07 19:04:45 -07:00
Eli White 16256f83f8 Revert D17201061: [RN][Fabric] Always use `forceUpdate` for Fabric JS animations
Differential Revision:
D17201061

Original commit changeset: c43b59913d82

fbshipit-source-id: 470e3fcddafceb0677585c0a1f482120b97e8d2a
2019-09-06 21:33:32 -07:00