Commit Graph

3324 Commits

Author SHA1 Message Date
Ramanpreet Nara ee93ee603b Re-check in all codegen output
Summary:
This diff:
1. Updates `update-specs.js` to also check in the JNI TurboModules codegen output.
2. Updates all the checked in OSS codegen.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D19907536

fbshipit-source-id: 179e01aff05f4c970c20f1482f096dbca10caed3
2020-02-25 12:57:43 -08:00
David Vacca 0e69922125 Disable rendering of inline views in Classic RN code for views that are rendered in Fabric
Summary:
This diff disables the rendering of TextInlineViews in ClassicRN when the users is running with Fabric enabled.

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D20087254

fbshipit-source-id: b4664b17b4c845d212f72e75eee58860fe31abee
2020-02-25 12:54:57 -08:00
David Vacca 8bc7ad605d Extend Fabric measure function to support attachment positions parameters
Summary:
This diff changes the Fabric measure API in order to support attachments parameters

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D20087252

fbshipit-source-id: 20e1526aaa3695d38d0805416df8a32adb8296ad
2020-02-25 12:54:57 -08:00
generatedunixname89002005287564 2e2b331db5 Daily arc lint --take GOOGLEJAVAFORMAT
Reviewed By: zertosh

Differential Revision: D20092187

fbshipit-source-id: 636d70cf85ae4e7c1be941cf04580dd91e68c8bf
2020-02-25 06:09:22 -08:00
Nikita Kraev 79efa43428 Update ImageEditingManager to use internal storage before falling back to external for cache
Summary:
Changelog: [Android] [Changed] - Internal storage now will be preferred for caching images from ImageEditor.

Now we try to write to internal cache directory first.
If that fails (due to no memory error or other IOException), we attempt to write to external storage (if that is allowed).

I introduced additional configuration flag, `allowExternalStorage` which is true by default.
And i updated documentation for new behaviour - see
 `ImageEditor.cropImage(..)` comment.

Reviewed By: makovkastar

Differential Revision: D19878158

fbshipit-source-id: 7e338ce68f535f74c62b5eecd5a94af7e7396f8b
2020-02-25 05:46:59 -08:00
David Vacca 6aea6256a6 Unify measure functions in Fabric Android
Summary:
Until now, there were two measure functions that differ in only one parameter (rootTag). The rootTag is used to use the context associated to the tag as part of the calculation of layout, otherwise it just uses the ReactApplicationContext.
This diff unifies both method into an unique method that

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D20081281

fbshipit-source-id: b1f6a6cedbf78f36f36fd0f93407c23c6996d76b
2020-02-24 18:18:32 -08:00
Ramanpreet Nara 8bb78553a2 Make DeviceInfoModule extend code-generated Java spec
Summary:
I think this NativeModule was converted before we checked in the Java codegen output for TurboModules. I'm making `DeviceInfoModule` extend `NativeDeviceInfoSpec` to properly make it a TurboModule.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D19911145

fbshipit-source-id: fcec8c5b991bd9fd991e690dfa51f1bd36117e5f
2020-02-24 13:54:29 -08:00
David Vacca 13afc454f1 Disable preallocation of virtual Nodes
Summary:
This diff disables preallocation of virtual nodes, I'm doing this as an intermediate step to eradicate virtual nodes from the android mounting layer.

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D20048996

fbshipit-source-id: 8fe0b03bcfcfd83a3093d1503ac93a20a5e9a57e
2020-02-21 21:07:40 -08:00
David Vacca d42e2fa92a Extend MountingManager to not fail when trying to update event emitter of a non created view
Summary:
This diff extends the MountingManager to not fail when trying to update event emitter of a non created view. This is necessary as intermediate step to remove virtual nodes out of the RN Fabric Android
changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D20048998

fbshipit-source-id: c2a3633400ac67c2f46ec52ed3ad80289ff6aeb9
2020-02-21 21:07:40 -08:00
David Vacca f19fb2454d Cleanup MC.enable_inline_view_dynamic_size and ReactFeatureFlag.supportInlineViewsWithDynamicSize
Summary:
This diff cleans up mobile config and ReactFeatureFlags that are not used anymore

changeLog: [internal]

Reviewed By: JoshuaGross, makovkastar

Differential Revision: D20026794

fbshipit-source-id: 3d941db195075a9cf49b7ecc0bf1ee839fcca189
2020-02-21 10:50:20 -08:00
David Vacca c918f45046 Enable support for TextInlineViews with dynamic sizes by default
Summary:
This diff enables support for TextInlineViews with dynamic sizes by default, removing old code and calls to MCs.

changelog: [internal]

Reviewed By: JoshuaGross, makovkastar

Differential Revision: D20026795

fbshipit-source-id: 48adf356b418866d937be9b478d9186342a07de8
2020-02-21 10:50:20 -08:00
Joshua Gross 3d21a60d41 EZ, Fix typos in logs
Summary:
Fix typo to make grepping easier.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D20025729

fbshipit-source-id: 56d219e771dad133bf74fd1df327c2bbd0f8fd9e
2020-02-21 10:19:38 -08:00
Rick Hanlon ae03bf88a5 Fix null pointer exception in LogBox
Summary: Changelog: [Internal]

Reviewed By: makovkastar

Differential Revision: D20029904

fbshipit-source-id: 515b5b9d16742b411b594040c31d5c7dcee41925
2020-02-21 09:50:12 -08:00
generatedunixname89002005287564 c18fa702fb Daily arc lint --take GOOGLEJAVAFORMAT
Summary: Changelog: [Internal]

Reviewed By: zertosh

Differential Revision: D20027840

fbshipit-source-id: 94501d8aadf271d3a10e1bd5b1a254e1e3914d7b
2020-02-21 05:22:41 -08:00
Emily Janzer dd9832c400 Use bridgeless-friendly API for getting EventDispatcher in SwipeRefreshLayout
Summary: Switching SwipeRefreshLayout to use the bridgeless-friendly API for getting the EventDispatcher.

Reviewed By: mdvacca

Differential Revision: D20016310

fbshipit-source-id: 2f674f45768640fb6219df690fa34f74206fdf19
2020-02-20 20:20:02 -08:00
Emily Janzer 769e368889 Don't subscribe to lifecycle events in NativeAnimatedModule (for now)
Summary: Right now, animations don't work on Android in bridgeless mode because NativeAnimatedModule directly uses the UIManagerModule for various things. Previously, I added a bridgeless check to the module's `initialize()` method to avoid adding a listener on the UIManager; in this diff, I'm moving that check so that we also skip adding the lifecycle listener on the context in bridgeless mode, too. I'll remove this check once we come up with a replacement for the UIManagerModule API.

Reviewed By: JoshuaGross

Differential Revision: D19964171

fbshipit-source-id: 7c461f535e370b0e607c28905c505239cce0e157
2020-02-20 20:20:02 -08:00
Joshua Gross 6239ace5a3 For T62192299, log on AppRegistry.runApplication
Summary:
Fabric debugging.

I also have an agenda of removing all instances of `ReactConstants.TAG`, because it's overly broad and not helpful during debugging.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D20016401

fbshipit-source-id: 91e5cd7e8eb662b1a4a887c1e4e66a31ec741b46
2020-02-20 17:51:26 -08:00
Joshua Gross bf869d9917 ReactInstanceManager.attachRootViewToInstance should show up in production logs for T62192299 analysis
Summary:
Temporary debug logs.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D20016162

fbshipit-source-id: 27848a5249bd625c74dc9023c89da6ec5edd9bd5
2020-02-20 17:51:26 -08:00
Vojtech Novak 7f2a79f40b allow custom ripple radius on TouchableNativeFeedback (#28009)
Summary:
motivation: there are cases where one'd like to control the radius of the ripple effect that's present on TouchableNativeFeedback  - in my case, I want to make sure that both icons and text have the same ripple appearance, but that's currently not possible as far as I can tell.

Currently (afaik) the only way to set  (upper) ripple limits is by specifying width, height and border radius ( + `overflow: hidden`), and this works well for icons which can usually be bounded by a square, but not for text which can have rectangular shape.

This PR adds `rippleRadius` parameter to `SelectableBackground()`, `SelectableBackgroundBorderless()` and `Ripple()` static functions present on `TouchableNativeFeedback`. It can make the ripple smaller but also larger. The result looks like this:

added to RNTester:

![SVID_20200219_182027_1](https://user-images.githubusercontent.com/1566403/74858131-147ff380-5345-11ea-8a9e-2730b79eec38.gif)

difference from the other ripples:

![SVID_20200209_110918_1](https://user-images.githubusercontent.com/1566403/74109152-4513a080-4b81-11ea-8ec3-bb5862c57244.gif)

I'm ofc open to changing the api if needed, but I'm not sure there's much space for manoeuvring. While I was at it, I did a slight refactor of the class into several smaller, more focused methods.

It's possible that in some cases, this might help to work around this issue https://github.com/facebook/react-native/issues/6480.

## Changelog

[Android] [Added] - allow setting custom ripple radius on TouchableNativeFeedback
Pull Request resolved: https://github.com/facebook/react-native/pull/28009

Test Plan: I tested this locally using RNTester

Reviewed By: TheSavior

Differential Revision: D20004509

Pulled By: mdvacca

fbshipit-source-id: 10de1754d54c17878f36a3859705c1188f15c2a2
2020-02-20 15:29:07 -08:00
Marc Horowitz 65d3167a80 If JSC fails to load when starting RN, expose that error to the caller
Summary:
See the comments for more info.

Changelog: [Android] [Changed] - Improve exception message when JSC loading fails

Reviewed By: tmikov

Differential Revision: D19917034

fbshipit-source-id: d846f542c31e9c94edcee240c2935d77d48d1f2a
2020-02-18 12:27:51 -08:00
Marc Horowitz ef021eac9c Add es6Proxy to RuntimeConfig
Summary:
Also clean up some unused items

Changelog: [Internal]

Reviewed By: willholen

Differential Revision: D19917035

fbshipit-source-id: dd5a0af135bdbdb7fb1a98475d99db1ec281eeba
2020-02-18 12:27:50 -08:00
Emily Janzer d4a498aba2 Allow focusing TextInput when already focused
Summary:
Right now, `requestFocus()` is a no-op if the EditText view thinks it's already focused. In certain cases, though, we still want to focus the view even if it's already focused - for example, if TalkBack is enabled and you dismiss the keyboard, you want to be able to tap on the TextInput again to bring back the keyboard, even though the View never thinks it lost focus.

What I'm doing instead is basically disregarding the View's current focus state if we *would* focus the TextInput, which is in 3 circumstances:

- When the view is attached to a window, if autofocus is true
- When the focus is being requested by JS
- When the focus is being requested by an accessibility action from the OS

Changelog: [Android][Fixed] Change how TextInput responds to requestFocus to fix a11y focus issue

Reviewed By: mdvacca

Differential Revision: D19750312

fbshipit-source-id: 30b9fab40af4a083fa98f57aba7e586540238bea
2020-02-18 12:14:17 -08:00
Joshua Gross 5aae380f2d Differentiate between Fabric and non-Fabric UIManager logs
Summary:
Both the UIManagers use ReactConstants.TAG currently, so certain logs are ambiguous. Use FabricUIManager's tag instead for all logs to disambiguate.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D19945587

fbshipit-source-id: 0a9d62b5c0276688b2ad3acf8d893b523c26560a
2020-02-18 00:29:02 -08:00
David Vacca 2b5283e39f Replace android.util.log for FLog
Summary:
We must use FLog instead of android.util.log, this diff moves the current callsites of android.util.log to FLog

changeLog:[internal]

Reviewed By: JoshuaGross

Differential Revision: D19884741

fbshipit-source-id: 300f7d691961aa51f0b525c37da7ae3d64fe5131
2020-02-13 14:43:54 -08:00
Samuel Susla b07a65b9d9 Fix ScrollView state not being set if scrollTo command was called
Summary:
# Problem
`UIManager::getRelativeLayoutMetrics`  returns incorrect `frame.origin.y` value.

Just quick reiteration how calculation of `frame.origin` works. We take frame of the target shadow node, travers hierarchy to the root and keep adding `frame.origin` of each ancestor to target shadow node's origin.

One more important piece of information, to calculate scroll view's `frame.origin`, we need to have its contentOffset which gets passed to Fabric core through state.

# So where does it go wrong?
Problem is that on Android, calling view command `scrollTo` doesn't set its internal state correctly. So when we calculate the layoutmetrics, scroll view's `frame.origin` is off by whatever value was used in `scrollTo`.

# The fix
In `ReactScrollView`, correctly set state after `scrollTo` is called on it.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D19835549

fbshipit-source-id: d56e7b0b05023c0497e52c8b46fdcf58ca78b4a5
2020-02-13 13:01:07 -08:00
Joshua Gross 6dfcc09986 Add debug logging for T62192299
Summary:
Add debug logs for T62192299, which will hopefully tell us why RN is being destroyed in otherwise useless logs.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D19866793

fbshipit-source-id: 6656c305c8ef567335ea7fe82e4e1c68092a49d2
2020-02-13 11:29:28 -08:00
Andres Suarez ff22722e47 Daily arc lint --take GOOGLEJAVAFORMAT
Summary:
Changelog:
[Internal]

Differential Revision: D19875191

fbshipit-source-id: 3a1e22a4342d523f556c847a9fa780a898a96771
2020-02-13 05:50:42 -08:00
Janic Duplessis 2c1913f0b3 Implement adjustsFontSizeToFit on Android (#26389)
Summary:
This adds support for `adjustsFontSizeToFit` and `minimumFontScale` on Android. The implementation tries to match closely the behaviour on iOS (hardcoded 4px min size for example). It uses a simpler linear algorithm for now, opened to improving it now if it is a deal breaker or in a follow up.

See https://twitter.com/janicduplessis/status/1171147709979516929 for a more detailed thread about the implementation

## Changelog

[Android] [Added] - Implement `adjustsFontSizeToFit` on Android
Pull Request resolved: https://github.com/facebook/react-native/pull/26389

Test Plan: Tested by adding the existing `adjustsFontSizeToFit` example from the iOS text page to android. Also added a case for limiting size by using `maxHeight` instead of `numberOfLines`.

Reviewed By: mdvacca

Differential Revision: D17285473

Pulled By: JoshuaGross

fbshipit-source-id: 43dbdb05e2d6418e9a390d11f921518bfa58e697
2020-02-10 15:00:41 -08:00
Emily Janzer c32ec1f2ab Add @DoNotStrip annotation to JavaTimerManager.deleteTimer()
Summary:
This method is being stripped in release builds because it's used directly from C++ and not referenced in Java. Adding `DoNotStrip` to prevent this.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D19708826

fbshipit-source-id: a572f0295ab3b49e5884d0a6c723d65e4bbc9226
2020-02-05 15:26:11 -08:00
Emily Janzer 73427561f7 Use JavaScriptModuleRegistry.getJSModuleName()
Summary:
It turns out that in release builds, proguard is doing something weird with inner classes, so that getSimpleName() is actually returning "OuterClass$InnerClass" in some cases. We have logic to handle this case already in JavaScriptModuleRegistry, so I'm moving that out to a static method that I can access in bridgeless mode.

Also adding tests for it.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D19701703

fbshipit-source-id: 625737bfb50ca8ba2bd26034e2a74c682783ba8a
2020-02-05 15:26:11 -08:00
David Vacca 8dcab66e4b Add android log when trying to add a view into a non viewGroup
Summary:
Easy diff to add extra logging when Fabric tries to add a view inside a view that is not a ViewGroup

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D19737506

fbshipit-source-id: ecb858820de7befc385e725c45b537359e39c0e7
2020-02-04 18:54:22 -08:00
Emily Janzer bf32023e50 The life-changing magic of clang-tidying up
Summary:
Adding a `.clang-tidy` to a bunch of dirs under `react-native-github/ReactAndroid` and `react-native-github/ReactCommon`.

I don't want to add a single `.clang-tidy` at the root because we'll need more fine-grained control over what checks are enabled in different parts of the codebase; for example, fabric will and TM will probably have more checks enabled than older parts of the codebase that we're not actively modernizing, and the Hermes team probably wants its own config to be consistent with the rest of their codebase.

Starting off each `.clang-tidy` by only enabling clang-diagnostic; this is just to test that it's working. In the future, we'll work with the community to gradually enable more checks.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D19705749

fbshipit-source-id: 979cea053b645ac4a9790340033bfcfb49ca0f97
2020-02-04 11:09:30 -08:00
David Vacca 9312313c3c Add Support for Emojis in Fabric for Text and TextInput components
Summary:
This diff refactors Text and Text input components in Fabric to support customizable emojis

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D19679391

fbshipit-source-id: 358aa97064209d28d317ba4ca5fff84245c9b1bb
2020-02-03 21:09:17 -08:00
David Vacca d1e2c9435e Extend RN Android text input to support customizable emojis
Summary:
This diff refactors RN Android text input to support customizable emojis.

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D19679392

fbshipit-source-id: b673e3a59f876ff9a822c2f32c9db4ff4efe007b
2020-02-03 21:09:16 -08:00
David Vacca 86d1153586 Refactor ReactShadowNode to add emoji support for TextInput and Fabric
Summary:
This diff refactors support of emojis in RN classic in order to make it easy to extend support for text input and fabric (as part of this stack)

changelog:[internal]

Reviewed By: JoshuaGross

Differential Revision: D19679394

fbshipit-source-id: 45eff49800b3db281721088f107494005d390fff
2020-02-03 21:09:16 -08:00
David Vacca acaef83a27 Delete commented code in ReactTextInputManager
Summary:
This diff deletes commented code in ReactTextInputManager.java

changeLog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D19679393

fbshipit-source-id: 23b1ac9b6f427827b8faebd59f5d2446acede8f5
2020-02-03 21:09:15 -08:00
Janic Duplessis 055a41b081 Implement native TextInput autoFocus on Android (#27924)
Summary:
Follow up to https://github.com/facebook/react-native/issues/27803. To keep consistency between the implementations this also implements autoFocus natively on Android. This will allow removing the JS auto focus logic completely.

## Changelog

[Android] [Fixed] - Implement native TextInput autoFocus on Android
Pull Request resolved: https://github.com/facebook/react-native/pull/27924

Test Plan: Test using the TextInput example in RN tester.

Differential Revision: D19674506

Pulled By: TheSavior

fbshipit-source-id: 9cbb517fc69bccd11f5292a1ccb4acea2e3713e9
2020-01-31 18:18:41 -08:00
David Vacca e4194a20a7 Return null when requesting constants for nonexistent View Managers in RN Android
Summary:
This diff changes the behavior of UIImplementation.resolveViewManager() to return null instead of throwing an exception when trying to find an unexistent viewManager during the computation of constants for view Managers.

The C++/JS code manages exceptions and null results when a view manager doesn't exists, this diff simplifies the way this method operates.

changeLog: [internal]

Reviewed By: rickhanlonii

Differential Revision: D19624423

fbshipit-source-id: df31dcfae9a588bf325b61d529cec6ead59fb19d
2020-01-31 17:06:02 -08:00
Emily Janzer d3b2ac3a84 Add @DoNotStrip to method called from cpp in bridgeless mode
Summary:
I hit a crash when testing bridgeless mode in a release build:

Error: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/facebook/react/modules/core/JavaTimerManager;.createTimer(IJZ)V"

It turns out that `JavaTimerManager.createTimer()` is getting stripped from release builds because it's not referenced in Java at all. Adding `DoNotStrip` annotation to keep it around. The other methods in JavaTimerManager don't need this because they're referenced by TimingModule - this is the only method that's only used directly from C++ by bridgeless mode.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D19655519

fbshipit-source-id: 8b9862475986bb84b12d81f73f677cc2e4860c67
2020-01-31 14:04:31 -08:00
Ramanpreet Nara 69bb46b55e Install TM bindings on JS thread
Summary:
Previously, users of the TurboModuleManager system would have to `TurboModuleManager.installBindings()` themselves, which synchronously attached the `__turboModuleProxy` function on the JS `global` object.

After these changes, the TurboModuleManager, when created will schedule work on the JS thread to install the global `__turboModuleProxy` function. As long as you create the TurboModuleManager before you run the bundle, we'll install the bindings before any TurboModules are accessed.

Changelog:
[Android][Fixed] - Install TM Bindings on JS thread

Reviewed By: ejanzer

Differential Revision: D19335956

fbshipit-source-id: 967ac2d3a0510392f6f0e42efe79b1a0ff6768c4
2020-01-31 10:04:41 -08:00
Emily Janzer b592c863ef Migrate ReactTextInputManager to be bridgeless
Summary: Migrate ReactTextinputManager to support bridgeless mode by accessing the EventDispatcher through the UIManagerHelper instead of from ReactContext.

Reviewed By: mdvacca

Differential Revision: D19614184

fbshipit-source-id: 5dd4945223d10785f8fe171e06d6f7ef42f9d834
2020-01-30 18:34:32 -08:00
Ramanpreet Nara 9ae95582e7 Clear all held jsi::Functions when jsi::Runtime is deleted
Summary:
## Description
You're not supposed to hold on to JSI objects (ex: `jsi::Function`) past the point where their `jsi::Runtime` is deleted. Otherwise, we get a dangling pointer crash, like this: T60262810! Historically, this cleanup problem has always been really tricky to get right. With this diff, I hope to fix that problem once and for all by deleting all `jsi::Function`s when we delete the global `__turboModuleProxy` function.

## Current Setup
- The TurboModules infra uses weak references to `CallbackWrapper`s to hold on to the `jsi::Function`s passed from JS to ObjC.
- The LongLivedObjectCollection holds on to strong references to `CallbackWrapper`s. This ensures that the `jsi::Function`s aren't deleted prematurely. This also means that we can use `LongLivedObjectCollection` to delete all `CallbackWrappers`.
- `TurboModuleBinding` is the abstraction we use to install the global `__turboModuleProxy` function. It is owned by `TurboModuleManager`, and `TurboModuleManager` uses it to clear all references to `jsi::Function`s, when we delete all NativeModules.

## Solution
1. Transfer ownership of `TurboModuleBinding` from `TurboModuleManager` to the `__turboModuleProxy` function.
2. Clear the `LongLivedObjectCollection` when `TurboModuleBinding` is deleted.

Changelog:
[iOS][Fixed] - Clear all held jsi::Functions when jsi::Runtime is deleted

Reviewed By: JoshuaGross

Differential Revision: D19565499

fbshipit-source-id: e3510ea04e72f6bda363a8fc3ee2be60303b70a6
2020-01-30 15:15:09 -08:00
Pasquale Anatriello c3bde6ef0c Swap child Yoga
Summary:
Changelog: [Internal]

Expose the replaceChild Yoga call to Java

Reviewed By: SidharthGuglani

Differential Revision: D19497193

fbshipit-source-id: 153243cc1d8c23dcaf2c772ca794bd59a230f652
2020-01-30 03:43:47 -08:00
David Vacca de95457b8f Annotate with @Nullable parameters of the UIManagerModule class
Summary:
This diff annotates with Nullable parameters of the UIManagerModule class.

changeLog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D19624422

fbshipit-source-id: 0d6a095d0613c71087de004464974a7f5e755c34
2020-01-29 21:06:55 -08:00
Emily Janzer 8f5779cd70 Add in the optimization to check the first/least timer in the queue before iterating (#27841)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/27841

Follow up from https://github.com/facebook/react-native/pull/27539 - adding back in the optimization that Detox has in TimersIdlingResource to avoid iterating over the entire timers queue if the next timer is already within the specified range.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D19522346

fbshipit-source-id: 32609f434d1ca575a5a49ad630e288c43fa90864
2020-01-29 11:45:26 -08:00
Emily Janzer 3b55e1e877 Back out "Add @UiThread annotation to methods that update DisplayMetrics"
Summary:
Original commit changeset: f1d464f22877

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D19608308

fbshipit-source-id: 506f25654f9879d9000aa188bc3cf59582d855df
2020-01-28 16:52:59 -08:00
Rick Ratmansky f8a75d5c8f Revert D19456326: Migrate ReactTextInputManager to be bridgeless
Differential Revision:
D19456326

Original commit changeset: 5e9643793cd7

fbshipit-source-id: 07d23cc25c4ba242a8b8c04ac5e76d9c9656186d
2020-01-28 12:23:05 -08:00
Emily Janzer 88aa2b9316 Migrate ReactTextInputManager to be bridgeless
Summary:
Migrate ReactTextinputManager to support bridgeless mode by accessing the EventDispatcher through the UIManagerHelper instead of from ReactContext.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D19456326

fbshipit-source-id: 5e9643793cd764e29964f565db24cdea683ac032
2020-01-28 11:04:08 -08:00
Emily Janzer 32d095906e Migrate ReactImageView to be bridgeless
Summary:
Migrating ReactImageView to use the new API for accessing the EventDispatcher (UIManagerHelper.getEventDispatcherForReactTag) that supports bridgeless mode.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D19190765

fbshipit-source-id: a958dfc9c48845270e99f8d378ce034cddc8036f
2020-01-28 11:04:08 -08:00
Valentin Shergin eadc2ac493 Fabric: Improving precision and type-safety of Telemetry
Summary:
Collecting Telemetry is a crucial part of building a performant UI framework; we do that but we need to improve it to make the data more reliable, actionable and trustful.

Now we collect time points as the number of milliseconds from the start of the CLOCK_MONOTONIC epoch. That's fine but it also has problems:
Sometimes a millisecond is an eternity. We have only 16 (or fewer) of them on each frame. What if some operation takes 1ms (according to telemetry) but we have to run it a dozen times? Does it mean that it's 12 ms in total? So, we lack precision.
This is not type-safe. Do you know how many milliseconds in a microsecond? I don't. We multiply that on magical constants hoping that we copied that from some other place right.
The current implementation is not cross-platform. We have ifdefs for iOS and Android and Unix and Windows (which is now implemented).

So, this diff replaces that with using `std::chrono` which is part of the standard library that designed to fix all those concerns. We also define our type-aliases on top of that to express our concrete constrains:
We use `std::chrono::steady_clock` as the base clock which is according to the standard using `clock_gettime(CLOCK_MONOTONIC, ... )` if available. So, it's fast and compatible (the same under the hood) with Android infra.
We use nanoseconds when we store time durations (TelemetryDuration type).
 Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D19184569

fbshipit-source-id: 7a44688f4bb3bfc6e3009874f0075c531c8569a1
2020-01-27 13:26:49 -08:00