Commit Graph

3786 Commits

Author SHA1 Message Date
David Vacca 9c827f6201 Prevent initialization of constants for view managers for users with static view config enabled
Summary:
This diff prevents the pre-calculation of ViewManager's constants for users with static view config enabled.
We still load viewManager classes and create viewManger objects for perf reasons

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D25414068

fbshipit-source-id: a91f6113e35b42625c03d13bd67b63e3f9f75098
2020-12-08 22:03:13 -08:00
Joshua Gross 99f2f5ffdd deleteRootView: use concurrent pattern with mTagToViewState
Summary:
Instead of doing a "containsKey then get", just get the rootViewTag and see if it's non-null. Theoretically, since it's a
concurrent data-structure, it could be removed from the ConcurrentHashMap between "containsKey" returning true and the "get".

This does not fix any known, existing problems.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25378703

fbshipit-source-id: 62a44e68e4443dac5a557263cc4bb33de9eea993
2020-12-07 17:59:09 -08:00
Joshua Gross 3cdef265ae Remove premature optimization in FabricUIManager; could be causing stopSurface inconsistencies
Summary:
There is an optimization in FabricUIManager.surfaceActiveForExecution that ensures it returns the same value (true or false)
for a given SurfaceId for a single frame (the value is cached until the next frame).

It seems like this can be causing a few different crashes, in a couple different ways:

1) If StopSurface is called off the UI thread, in the middle of a batch of operations (probably less likely to cause problems)
2) If StopSurface is called on the UI thread, in between different operations; the latter operations will still execute because the `true` value of `surfaceActiveForExecution` was cached.

I don't think that this optimization was providing much for us, and could be causing crashes. Remove it for now and we'll analyze impact on crashes and perf.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25379970

fbshipit-source-id: 2c15c971bd0c828e1d38a34662d93293271041b2
2020-12-07 17:10:00 -08:00
Riley Dulin 72d29ee7d7 Destroy jni::global_ref while inside a ThreadScope
Summary:
The `BlobCollector` native module stored a `jni::global_ref` as a member,
and its destructor automatically destroys it.
However, as noted in JSI documentation, there is no guarantee that the destructor
is run on a JVM-registered thread. The destructor knew this and used a `jni::ThreadScope`
to do some other JNI behavior, but the global_ref needs to be destroyed during
that ThreadScope as well.

Changelog: [Internal]

Reviewed By: neildhar

Differential Revision: D25372698

fbshipit-source-id: f4eba0b2da154c6eac54d7faeb9ea5bb9260bec9
2020-12-07 15:42:57 -08:00
David Vacca 5fb82e7425 Ensure ReactRootView.getId() is accessed on the UIThread
Summary:
Ensure ReactRootView.getId() is accessed on the UIThread

changelog: [internal] intenral

Reviewed By: JoshuaGross

Differential Revision: D25321379

fbshipit-source-id: 889e59c655324352a7b9ac5bed769750786b8190
2020-12-07 13:41:42 -08:00
David Vacca 503a6f4463 Optimize iteration of ReadableNativeMaps
Summary:
Props are transferred from C++ to Java using ReadableNativeMaps. The current implementation of ReadableNativeMaps creates an internal HashMap the first time one of its methods is executed.
During the update of props ReadableNativeMaps are consumed only once and they are accessed through an Iterator. That's why there is no reason to create the internal HashMap, which is inefficient from performance and memory point of view.

This diff creates an experiment that avoids the creation of the internal HashMap during prop updates, additionally it removes a lock that was being used in the creation of the internal HashMap. I expect this change to have a positive impact in TTRC and memory (in particular for ME devices)

This diff reduces the amount of ReadableNativeMaps's internal HashMaps created during initial render of MP Home by ~35%.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D25361169

fbshipit-source-id: 7b6efda11922d56127131494ca39b5cec75f1703
2020-12-06 11:28:11 -08:00
David Vacca b636397a0d Add annotations and thread safety checks in the initialization / teardown methods of ReactInstanceManager
Summary:
Add annotations and thread safety checks in the initialization / teardown methods of ReactInstanceManager

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D25321380

fbshipit-source-id: 113a7c224ae04009cda9e15676208abcef6af211
2020-12-04 19:58:10 -08:00
David Vacca 74a756846f Fix race condition on startSurface
Summary:
The root cause of this bug is a race condition between the onMeasure method and setupReactContext.

ReactInstanceManager.attachRootView() method is responsible of the initialization of ReactRootViews and it is invoked by ReactRootView.onMeasure() method in the UIThread

Important initialization steps:
1. Clear the Id of the ReactRootView
2. Add the ReactRootView to the mAttachedReactRoots
3. Call StartSurface (if the bridge has been initialized)

Sometimes, when this method is invoked for the first time, the bridge is not initialized, in those cases we delay the start of the surface.

Once the bridge is initialized, StartSurface is called by the setupReactContext() running in the NativeModuleThread.

Since onMeasure can be called multiple times, it is possible that we call "StartSurface" twice for the same ReactRootView, causing the bug reported on T78832286.

This diff adds an extra check to prevent calling "StartSurface" twice. The fix is done using an AtomicInteger comparison and it is gated by the flag "enableStartSurfaceRaceConditionFix". Once we verify this works fine in production we will clean up the code, remove the flags and maybe revisit the API of ReactRoot.

changelog: [Android] Fix race-condition on the initialization of ReactRootViews

Reviewed By: JoshuaGross

Differential Revision: D25255877

fbshipit-source-id: ca8fb00f50e86891fb4c5a06240177cc1a0186d9
2020-12-04 19:58:10 -08:00
Ramanpreet Nara 374808f307 Delete redundant dependency in turbomodules/core:coreAndroid
Reviewed By: ejanzer

Differential Revision: D25274090

fbshipit-source-id: 6f18ebee410b0866d5c5f96cc80631116f4251ff
2020-12-04 12:00:01 -08:00
Andrei Shikov fbf37092a8 Disable non-Fabric view operations after catalyst instance is destroyed
Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D25248836

fbshipit-source-id: 9afb0c18e7825d32857f746b038268758afaaaa8
2020-12-04 11:03:34 -08:00
Joshua Gross bd2b459561 Non-Fabric: ensure every requestLayout is followed by a performLayout
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25319526

fbshipit-source-id: 5527d90d84ef53847b1a478bfa16c27e3ca4720b
2020-12-04 00:29:42 -08:00
David Vacca 0d3aa35a03 remove unnecessary check
Summary:
EZ check to remove unnecessary check

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D25315988

fbshipit-source-id: a635ce9fd7ad50109bee55f82ccf3556cc7a4b0d
2020-12-03 20:50:01 -08:00
Xiaoyu Yin 7008ffb663 Protect methods from proguard
Summary:
These methods were being striped from proguard, which causes release builds to instacrash

Changelog: [Internal] Protect methods from Proguard

Reviewed By: RSNara

Differential Revision: D25314933

fbshipit-source-id: 173160eab953b7c24e02f5e6ef3bf335c1f85526
2020-12-03 16:42:55 -08:00
Joshua Gross 2e6eea8390 Remove enableStopSurfaceOnRootViewUnmount feature flag
Summary:
This feature flag (enableStopSurfaceOnRootViewUnmount) was used to gate usage of the "stopSurface" API, which is now fully supported, and has been used
in the FB app for several months. This is safe to ship in code.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25275192

fbshipit-source-id: fa22bfd00aa023297bc19c83c138f133e9ff1645
2020-12-02 20:10:00 -08:00
Joshua Gross 067d2eee03 Remove enableDrawMutationFix feature flag and ship it
Summary:
This was added to prevent mutating the UI during draw or measure, and appears to have been effective. Keep the comments, ship the feature, remove flags.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25258409

fbshipit-source-id: 36ad8a03d1eb82bc9dcd769372c03f1ebe8b8da8
2020-12-01 19:52:45 -08:00
Xiaoyu Yin b9b2215174 Add DoNotStrip annotations to TurboModulePerfLogger
Summary:
Prevent proguard from stripping these methods

Changelog: [Internal] Add DoNotStrip annotations to TurboModulePerfLogger

Reviewed By: RSNara

Differential Revision: D25101027

fbshipit-source-id: 673e97446a36fe0e8c10916aa7eb4c39c2187ba8
2020-11-30 14:15:24 -08:00
Emily Janzer c0a2998387 Move TurboModuleManager to use RuntimeExecutor instead of jsContext (#30416)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/30416

This diff changes the constructor param for TurboModuleManager from jsContext (a long representing the `jsi::Runtime` pointer) to a RuntimeExecutor. It also updates callsites to use the new RuntimeExecutor created by CatalystInstance. This is only used for installing the TurboModule JSI binding; it's not currently used for JS invocation in TurboModules, which is handled separately by JSCallInvoker. Ultimately we may be able to implement JSCallInvoker *with* the provided RuntimeExecutor, but there's some additional logic in JSCallInvoker that we don't have here yet.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D21338930

fbshipit-source-id: 1480c328f1a1776ddf22752510c0f3b35168a489
2020-11-20 14:32:59 -08:00
Tim Yung f6b8736b09 RN: Update ViewConfig for ScrollView
Summary:
Updates `ReactScrollViewManager` and the `ViewConfig` for `ScrollView` so that they are equivalent.

- `inverted` was missing.
- `contentOffset` was missing differ on Android. (However, there does not seem to be any perceivable behavior difference besides the native `ViewConfig` being different.)

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25084470

fbshipit-source-id: 8bea3b7a692c1038819a4147b174583a4faa71e9
2020-11-19 02:52:00 -08:00
Joshua Gross bbd0f03481 Removing pre-API 21 code
Summary:
We don't support pre-API 21/Android <5/pre-Lollipop anymore; delete related code or checks.

No need for this to make it to the changelog, this announcement was already made.

Changelog: [Internal]

Reviewed By: ejanzer

Differential Revision: D24965249

fbshipit-source-id: e537e62e8eb18878c29afe17b8c7861d095a37b7
2020-11-16 12:43:14 -08:00
Joshua Gross 752e7ab1f9 Experiment to replace Fabric MountItem lists with concurrent queues (re-land)
Summary:
Currently, queuing any sort of MountItem or getting the list of MountItems requires synchronization. Since these can be queued up at any point from the JS thread, there will, in theory, be constant contention between JS and UI thread.

To see if this is true, I'm creating an experiment instead of just switching over to concurrent structures. After seeing results, we can hopefully make a decision and delete the non-concurrent stuff or improve on it somehow.

The original was unlanded in D24973616 (https://github.com/facebook/react-native/commit/26787e2260412d9d2fe831e68a8616505d3cab36) due to a typo, which has been fixed now. The typo was that in Blocking Mode, we queued up all PreMountItems to the concurrent PreMountItems queue.

Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D24974851

fbshipit-source-id: d081c081bbd0de445bb92408f0ec822056b905a5
2020-11-14 12:19:56 -08:00
Andrei Shikov 26787e2260 Back out "Experiment to replace Fabric MountItem lists with concurrent queues"
Summary:
Changelog: [Internal]

Original commit changeset: fcbdeda51f91

Reviewed By: rubennorte

Differential Revision: D24973616

fbshipit-source-id: 4d21211d329c77dba50972a26b1daeccfffad912
2020-11-14 08:59:02 -08:00
Koichi Nagaoka d85d5d2e19 Fix cannot working Modal's onDismiss. (#29882)
Summary:
Fixes: https://github.com/facebook/react-native/issues/29455

Modal's onDismiss is not called on iOS.
This issue occurred the commit https://github.com/facebook/react-native/commit/bd2b7d6c0366b5f19de56b71cb706a0af4b0be43 and was fixed the commit https://github.com/facebook/react-native/commit/27a3248a3b37410b5ee6dda421ae00fa485b525c.
However, the master and stable-0.63 branches do not have this modified commit applied to them.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - Modal's onDismiss prop will now be called successfully.

Pull Request resolved: https://github.com/facebook/react-native/pull/29882

Test Plan:
Tested on iOS with this change:

1. Set function Modal's onDismiss prop.
1. Set Modal's visible props is true. (show Modal)
1. Set Modal's visible props is false. (close Modal)
1. The set function in onDismiss is called.

Reviewed By: shergin

Differential Revision: D24648412

Pulled By: hramos

fbshipit-source-id: acf28fef21420117c845d3aed97e47b5dd4e9390
2020-11-13 23:56:09 -08:00
Joshua Gross 47000756fe Add more systrace sections to FabricJSIModuleProvider
Summary:
Adding more Systrace sections to get perf information during critical paths.

Changelog: [Internal]

Reviewed By: ejanzer

Differential Revision: D24960195

fbshipit-source-id: 099e9cfac8ac87287e48e9915e6b28fe7a448783
2020-11-13 21:53:37 -08:00
Joshua Gross c609952ddb Add Systrace sections to UIImplementationProvider
Summary:
Add Systrace sections to initialization of non-Fabric UIImplementationProvider. This path is sometimes invoked during startup of Fabric so I'd like to gather more information about its impact.

Changelog: [Internal]

Reviewed By: ejanzer

Differential Revision: D24959965

fbshipit-source-id: a8555b8db284d00f97c71ca859cb2020409cb110
2020-11-13 21:53:36 -08:00
Joshua Gross 66e536739e Add additional debug logging for startSurface crashes
Summary:
There are a very, very small number of crashes in production that are hitting this line. I would like to understand what the existing tag ID is (perhaps it's eqal to the ID being set, which would indicate "double-start"). If not, it indicates that fragments are being reused somewhere, or something else odd is going on with lifecycles.

Changelog: [Internal]

Reviewed By: ejanzer

Differential Revision: D24953785

fbshipit-source-id: 079c86cdb571749662cca46feeaebdd6cb1281f4
2020-11-13 21:53:36 -08:00
Joshua Gross 23def0f8f0 Experiment to replace Fabric MountItem lists with concurrent queues
Summary:
Currently, queuing any sort of MountItem or getting the list of MountItems requires synchronization. Since these can be queued up at any point from the JS thread, there will, in theory, be constant contention between JS and UI thread.

To see if this is true, I'm creating an experiment instead of just switching over to concurrent structures. After seeing results, we can hopefully make a decision and delete the non-concurrent stuff or improve on it somehow.

Changelog: [Internal]

Reviewed By: ejanzer

Differential Revision: D24942110

fbshipit-source-id: fcbdeda51f91f4bd430a20d7484854fb1e94a832
2020-11-13 21:53:36 -08:00
Dulmandakh 2798e7172b remove ReactFragmentActivity (#30331)
Summary:
Remove ReactFragmentActivity class, which was deprecated at least since 0.58.

## Changelog

[Android] [Changed] - remove ReactFragmentActivity class.

Pull Request resolved: https://github.com/facebook/react-native/pull/30331

Reviewed By: makovkastar

Differential Revision: D24914082

Pulled By: fkgozali

fbshipit-source-id: 6833b76552a1fc19680f96501d4b8e2ff03c2c39
2020-11-13 09:55:40 -08:00
Joshua Gross f1fbfebccb Add ReactRootView perf markers
Summary:
Add three markers for ReactRootView perf logging: onMeasure, attachToReactInstanceManager, and updateLayoutSpecs.

It is suspected that one or all of these have regressed under Fabric in some cases.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D24909635

fbshipit-source-id: 6b6c0cc792c4b2d72f2360d6cffc02ef00e8a88b
2020-11-12 15:54:58 -08:00
Joshua Gross 68126ed470 Skip execution of IntBufferBatchMountItem if surface has stopped
Summary:
Fixes crashes in surface teardown / navigating away from a surface.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D24907216

fbshipit-source-id: 7bd7578c81687c7e64e8f70fecf8446bb333a1ed
2020-11-12 15:54:58 -08:00
ajpaulingalls 0e9296b95d Update the cached dimensions when orientation changes (#30324)
Summary:
Currently the dimensions are created once, and then cached.  This change will reload the dimensions when the device orientation changes to insure that dimension update events follow orientation changed events.

this should help address the following issues, that I know of:
https://github.com/facebook/react-native/issues/29105
https://github.com/facebook/react-native/issues/29451
https://github.com/facebook/react-native/issues/29323

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - Dimension update events are now properly sent following orientation change

Pull Request resolved: https://github.com/facebook/react-native/pull/30324

Test Plan: Open up RNTester app.  Select the Dimensions API list item.  Rotate the device and verify that the dimensions are correct based on orientation.

Reviewed By: fkgozali

Differential Revision: D24874733

Pulled By: ejanzer

fbshipit-source-id: 867681ecb009d368a2ae7b67d94d6355e67dea7b
2020-11-11 11:03:19 -08:00
Lulu Wu 8e956b3afd Back out "Change StatusBar default style handling strategy"
Summary:
Original commit changeset: 76e7d0d45fd3

Changelog: [Internal]

Reviewed By: makovkastar

Differential Revision: D24783092

fbshipit-source-id: 876eaeaffbed63599553456f189f3675aa406e13
2020-11-09 07:24:22 -08:00
Kevin Gozali 803a26cb00 TM Android: Avoid creating TM instance if the module is not TM enabled
Summary:
There is a flow where TM registry is creating a module instance (as registered in the TurboReactPackage), only to discard it if it's not a TM enabled module. This may be fine for many modules, but for module like `UIManagerModule`, this may cause a race condition or other issues, including potential perf regression when accessing UIManager from JS (e.g. for getting native viewConfigs).

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D24811838

fbshipit-source-id: 6e1cce6993a6e5c9763773f175083bf52925c910
2020-11-09 02:24:41 -08:00
Ramanpreet Nara 610dcf488b Implement method dispatch using TurboModuleSchema
Summary:
This is the final diff in the JS TurboModule codegen stack for Android. It implements method dispatch using the TurboModuleSchema object.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D22837486

fbshipit-source-id: f91b03f064941457d4b8c5e37e011468559dee71
2020-11-08 14:24:05 -08:00
Ramanpreet Nara cb7f3f4499 Setup TurboModule JS Codegen experiment
Summary:
## Android API
```
// Before we initialize TurboModuleManager
ReactFeatureFlags.useTurboModuleJSCodegen = true
```

## iOS API
```
// Before we initialize RCTBridge
RCTEnableTurboModuleJSCodegen(true);
```

## How is the JS Codegen actually enabled?
The above native flags are translated to the following global variable in JavaScript:
```
global.RN$JSTurboModuleCodegenEnabled = true;
```

Then, all our NativeModule specs are transpiled to contain this logic:
```
interface Foo extends TurboModule {
  // ...
}

function __getModuleSchema() {
  if (!global.RN$JSTurboModuleCodegenEnabled) {
    return undefined;
  }

  // Return the schema of this spec.
  return {...};
}

export default TurboModuleRegistry.get<Foo>('foo', __getModuleSchema());
```

Then, in our C++ JavaTurboModule, and ObjCTurboModule classes, we use the TurboModule JS codegen when the jsi::Object schema is provided from JavaScript in the TurboModuleRegistry.get call.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D24636307

fbshipit-source-id: 80dcd604cc1121b8a69df875bbfc87e9bb8e4814
2020-11-06 13:28:15 -08:00
Ramanpreet Nara f1e292b9c1 Set up experiment to dispatch promise methods asynchronously to NativeModules thread
Summary:
TurboModule methods that return promises are synchronously run on the JavaScript thread. Back in D22489338 (https://github.com/facebook/react-native/commit/9c35b5b8c4710dfe6a4b689a5565aa78ae5b37d3), we wrote code to make them dispatch on the NativeModules thread. That code, however, was just left disabled. In this diff, I wire up the TurboModules infra to a MobileConfig, which should allow us to assess the performance impact of async dispatch of promise methods to the NativeModules thread in production, before we roll it out more widely.

Changelog: [Internal]

NOTE: This diff was reverted, beacuse we landed it it without D24685387.

Reviewed By: ejanzer

Differential Revision: D24787573

fbshipit-source-id: 324bd22ce79c2c16c7f7b6996496d255a2c6256e
2020-11-06 13:28:15 -08:00
Hank Chen 00d9deaf6b Android: font-family is not apply when secureTextEntry is true (#30164)
Summary:
This pr fixes: https://github.com/facebook/react-native/issues/30123 .

When secureTextEntry is true, setInputType will set the inputType of textInput to password type.
Password type default font-family will be monospace font, so we need to setTypeface after the setInputType.

## Changelog

[Android] [Fixed] - Font family is not apply when secureTextEntry is true.

Pull Request resolved: https://github.com/facebook/react-native/pull/30164

Test Plan:
Before this pr:
![alt text](https://i.imgur.com/mAxLhnB.png)

After this pr:
![alt text](https://i.imgur.com/zoGYDxN.png)

Please initiated a new project and replaced the App.js with the following code:
```
iimport React from 'react';
import {SafeAreaView, TextInput} from 'react-native';

const App = () => {
  return (
    <SafeAreaView>
      <TextInput
        id={'email'}
        placeholder={'Email'}
        secureTextEntry={false}
        style={{fontFamily: 'Helvetica', fontSize: 14, fontWeight: '400'}}
      />

      <TextInput
        id={'password'}
        placeholder={'Password'}
        secureTextEntry={true}
        style={{fontFamily: 'Helvetica', fontSize: 14, fontWeight: '400'}}
      />
    </SafeAreaView>
  );
};

export default App;
```

Thanks you so much for your code review!

Reviewed By: cpojer

Differential Revision: D24686222

Pulled By: hramos

fbshipit-source-id: 863ebe1dba36cac7d91b2735fe6e914ac839ed44
2020-11-06 12:26:41 -08:00
Alessandro Sisto 2af406b88d Revert D24685389: Set up experiment to dispatch promise methods asynchronously to NativeModules thread
Differential Revision:
D24685389 (https://github.com/facebook/react-native/commit/052e578ed666f2749ec06d1d928bb622cada8841)

Original commit changeset: 8ceb2e6effc1

fbshipit-source-id: e48186dd0e928fe95cc7f2420fc02c00a62b8360
2020-11-06 06:26:29 -08:00
Ramanpreet Nara 052e578ed6 Set up experiment to dispatch promise methods asynchronously to NativeModules thread
Summary:
TurboModule methods that return promises are synchronously run on the JavaScript thread. Back in D22489338 (https://github.com/facebook/react-native/commit/9c35b5b8c4710dfe6a4b689a5565aa78ae5b37d3), we wrote code to make them dispatch on the NativeModules thread. That code, however, was just left disabled. In this diff, I wire up the TurboModules infra to a MobileConfig, which should allow us to assess the performance impact of async dispatch of promise methods to the NativeModules thread in production, before we roll it out more widely.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24685389

fbshipit-source-id: 8ceb2e6effc125abecfa76e5e90bd310676aefc9
2020-11-06 01:24:25 -08:00
Lulu Wu 7324b92dc4 Change StatusBar default style handling strategy
Summary:
Changelog: [Android] - Change StatusBar style handling strategy

Previously Android status bar can set to `dark-content` or `default`, I made the following changes:

- Added `light-content` to get align with iOS
- Changed the behavior of `default` from setting status bar with 'SYSTEM_UI_FLAG_LIGHT_STATUS_BAR' to not doing anything, I did this because 1, `setStyle('default')` is found called even without explicitly declared <StatusBar> on that surface, which I think should fail silently 2, my idea is that user should set status bar style to `dark-content` or `light-content` explicitly instead of using `default`.
- Fixed the bug found in Dating Settings's Second Look.

Reviewed By: RSNara

Differential Revision: D24714152

fbshipit-source-id: 76e7d0d45fd3b8c3733efaee81426f5f449cc7d8
2020-11-04 12:48:50 -08:00
generatedunixname89002005325676 00456211e5 Daily arc lint --take CLANGFORMAT
Reviewed By: zertosh

Differential Revision: D24679750

fbshipit-source-id: 42d5a8aa40ec99be9a51a8e3eed54f2fc8e29e3a
2020-11-02 03:48:06 -08:00
Joshua Gross dd9fd2acac Fix dispatchDraw crash
Summary:
For over a month I've been searching for a crash that occurs during Android's native `dispatchDraw` method on View. The stack traces didn't show anything useful - everything in the stack trace was native Android code,
not React Native code.

This also seems to only repro on certain vendors, and only on a very few React Native screens - I'm still not sure why either of those are the case, but from my repro, a *very* specific set of interactions needs to happen
to trigger this crash. See comments inline and an example stack trace.

Luckily, the fix is trivial. Since this code is used for animations, accessibility, and a number of other important interactions, I'm gating this change for now.

In general we must be careful to only mutate the View hierarchy only when we /know/ for certain it is safe to do so. Indirectly mutating the View hierarchy during measure, onMeasure, layout, dispatchDraw, etc, can all be
very dangerous. This is one of the last "escape hatches" that can cause view hierarchy modifications unexpectedly, so I think it's a very good idea to "secure" this further, and only update props synchronously here - and
ensure that other MountItems like `Delete` are definitely /not/ executed here.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D24639793

fbshipit-source-id: b6219ce882e8d2204b4d10bf99f6a1120a33cb5a
2020-10-30 20:40:24 -07:00
Joshua Gross 2cd89d040b Experiment: use int buffer to represent MountItems instead of concrete classes
Summary:
I've had my eyes on this optimization for a while: during TTRC especially, but really during any heavy render path, Fabric will create hundreds to thousands of MountItem class instances in order to construct a BatchMountItem.

This results in: hundreds/thousands of round-trip JNI calls, hundreds/thousands of Object allocations, etc. This will also result in increased memory and GC pressure.

Theoretically, by reducing the number of JNI calls and reducing allocations, we may be able to get some small wins in memory and CPU usage during very hot paths.

I am motivated to do this, in part, to indirectly measure the cost of JNI calls as well as allocating many objects vs an int buffer. I am unaware of such a measurement that we can use to make architectural decisions for React Native Android overall.

The other reason this could be a positive change: if it's successful and we can delete the old path, we'll be able to delete a bunch of Java classes entirely which is great for APK size wins.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D24631230

fbshipit-source-id: 86a46ffcaef4ecbec2e608ed226aed0b5c4b832e
2020-10-30 20:40:24 -07:00
Pasquale Anatriello 2707c17b07 Fix clone issue in YogaNodeJNIBase
Summary:
Changelog:
Fix the cloneWithChildren implementation that was not copying the list of children on the java object.

We were missing on copying the list of children when cloning. This is pretty bad as it means that the clone operation was mutating the old node as well as the new. When multiple threads were involved this could cause crashes.

Reviewed By: SidharthGuglani

Differential Revision: D24565307

fbshipit-source-id: 4e2e111db389e25c315ce7603b4018ac695bb0f1
2020-10-29 09:26:41 -07:00
Andrei Shikov c2b75901cf Change the order of handling exception and clearing react instance manager
Summary:
Changelog: [Internal]
Added better explanation to help debugging ViewManager crashes

Reviewed By: makovkastar

Differential Revision: D24539229

fbshipit-source-id: 36a010324cbf29dfe63784682715b963394a87fb
2020-10-28 17:42:05 -07:00
generatedunixname89002005325674 1903f6680d Daily arc lint --take GOOGLEJAVAFORMAT
Reviewed By: zertosh

Differential Revision: D24561115

fbshipit-source-id: f9b1a529e4421be77c5baae5f3eab450602fb988
2020-10-27 15:01:48 -07:00
Emily Janzer bb8d0f5732 Set color filter so that the arrow matches the text color
Summary: We support setting the text color in the ReactPicker component, but we don't apply the text color to the little arrow icon that appears next to it. This diff applies the color tint from the picker's primary text color (set with a style prop on the main picker component, *not* the 'color' prop on the Picker.Item) to the background of the picker, which tints the arrow icon.

Reviewed By: makovkastar

Differential Revision: D24480642

fbshipit-source-id: 7ce84d616ae677da8975be9444428392020c57dc
2020-10-27 14:57:37 -07:00
Kevin Gozali f023519e49 TurboModule Android: Enable TurboModule by default on RNTester
Summary:
This does a few things:
* Remove USE_CODEGEN flag so that TurboModule is enabled by default for RNTester
* Use the codegen output for Java/JNI spec files
* Remove the checked in com.facebook.fbreact.specs Java/JNI files

Changelog: [Changed][Android] RNTester now enables TurboModule by default using codegen.

Reviewed By: RSNara

Differential Revision: D24382083

fbshipit-source-id: 87e3e0581bac3287ef01c1a0deb070c1d7d40f2d
2020-10-26 23:47:54 -07:00
Kevin Gozali 6c17110d2e Codegen Android: used generated output instead of the checked-in spec files
Summary:
This moves all deps on the checked in fbreact/specs files to use the generated output (during build time) instead.

TLDR:
`react_native_target("java/com/facebook/fbreact/specs:FBReactNativeSpec")` ==> `react_native_root_target("Libraries:generated_java_modules-FBReactNativeSpec")`

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D24520293

fbshipit-source-id: 3fb34f172f1ab89b7198dfb4fccf605fbc32d660
2020-10-26 22:02:05 -07:00
Jason Safaiyeh dd4298a377 Remove left over code from deprecating Android < 21 (#30243)
Summary:
Came to learn RN is deprecating Android 19, 20: https://github.com/facebook/react-native/commit/a17ff44adcf003dd4e4ef2301e1f80b77913f712

Did a quick check of left over code from the deprecation.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Deprecated] - Cleanup usages of deprecated Android API

Pull Request resolved: https://github.com/facebook/react-native/pull/30243

Reviewed By: fkgozali

Differential Revision: D24548084

Pulled By: JoshuaGross

fbshipit-source-id: 3054ca1455bcff2bd5c9791633942dc0cca7cb2c
2020-10-26 18:49:11 -07:00
Joshua Gross 4b58038515 Log stack trace when unmountReactApplication is called in Fabric
Summary:
Sometimes stopSurface crashes when unmountReactApplication is called under Fabric; knowing the stack trace up to this point might assist in debugging.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D24532027

fbshipit-source-id: f350e77fb1a2de52eb146b449f1d2f6e960fa017
2020-10-26 12:33:31 -07:00