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

18927 Коммитов

Автор SHA1 Сообщение Дата
Valentin Shergin 0cdc3b7016 Fabric: Making DebugStringConvertibleOptions a required parameter for all methods of static debug-printing infra
Summary:
Having those arguments optional does not really make anything easier to use; on another side that makes it hard finding problems caused by missing that parameter.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18797337

fbshipit-source-id: c119b8f6a03994072edb45e39337e33b0f8b602f
2019-12-09 15:37:59 -08:00
Joshua Gross 254ebab1d2 AndroidTextInput: don't set TextInput value to placeholder; use eventCounter prop to send tree updates via state
Summary:
Fix (1) placeholder (2) modifying TextInput in Fabric on Android.

Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D18894538

fbshipit-source-id: 21103f56e6f6e108fcf6359a23c9dd9a0323250e
2019-12-09 14:44:36 -08:00
Eli White 5215703543 Migrate ActivityIndicator to HostComponent
Summary:
NativeComponent as a type isn't needed now that we have HostComponent

Changelog:
[Internal]

Reviewed By: zackargyle, rickhanlonii

Differential Revision: D18873494

fbshipit-source-id: 5ba3fa25537f8249c80c2303dcdb380e3b6b0ac5
2019-12-09 11:55:40 -08:00
Jordan Brown 688900342b exact-by-default in xplat/js
Summary:
Turns on the exact-by-default flag in xplat/js and gets rid of the implicit inexact object lint, which has no effect when exact-by-default is on.

Will land this on Monday along with an announcement post.

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D18863276

fbshipit-source-id: 07a31e957bea1d1e053e8fa5975fdb1b6da1bdc4
2019-12-09 11:03:21 -08:00
Kevin Gozali 65a7ec4473 iOS: added helper functions to gate image instrumentations
Summary:
Introduced 2 helper functions to toggle image instrumentation/logging (not in this diff) so that gating check is more efficient and easy to access across RN iOS core.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D18597208

fbshipit-source-id: 0b22031802ab020b16d6fb63e52461cf80a37ab5
2019-12-09 10:59:18 -08:00
Samuel Susla 5ee8202b26 Add missing accessibilityTraits in Fabric
Summary:
`accessibilityTraits` was missing, this diff adds it.

Also there is a name mis match, in javascript it is called `accessibilityRole`.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D18857668

fbshipit-source-id: 10656e8fb4e8c1d771a72c7f354b845e41cfc313
2019-12-09 06:41:27 -08:00
Joshua Gross 9bb042fe58 TextInput: ViewManager shouldn't reset EditText padding when none is set
Summary:
UpdateLocalData and UpdateState return an `extra data` object, which in the case of TextInput contains padding. In Paper, the padding was always set on this object; in Fabric, it generally is not. However, the ViewManager was unconditionally setting the padding on the view, regardless of whether or not padding was set. We just check the padding values before setting now. This fixes an issue where the padding would be reset when the user started typing in Fabric.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18875261

fbshipit-source-id: d7cb87c07f47ab522e32cd34a4ca6ed5fea2e832
2019-12-08 18:24:18 -08:00
Valentin Shergin b1f2c1e2c5 Fabric: Disabling an assert in ComponentDescriptorProviderRegistry
Summary:
This temporarily disables an `assert` in `ComponentDescriptorProviderRegistry`. The `assert` only suggests that the call to the class is redundant, so it's safe to just remove it for now.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross, sammy-SC

Differential Revision: D18878273

fbshipit-source-id: 007a2c6f62f858126912b7e54a1098e6f4c25a16
2019-12-08 09:54:37 -08:00
Valentin Shergin 36d895ce21 Fabric: Enabling new TextMeasureCache thing for Android
Summary:
Read more about this in D18848583 (where it's implemented for iOS). This diff enables that for Android.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18869823

fbshipit-source-id: ebdc863ec07268119d1cbbb911760532bb28ee04
2019-12-07 22:47:49 -08:00
Eli White 0ef0d3167e Remove IncrementalPresenter
Summary:
This component no longer has any internal callsites and was never exposed in the public API!

Changelog:
[General][Removed] Removing experimental IncrementalPresenter component

Reviewed By: rickhanlonii

Differential Revision: D18828704

fbshipit-source-id: 931254c4328b93b946a7995e7d9d44cb5aeb6a7b
2019-12-07 10:41:54 -08:00
Joshua Gross 2ee11711e0 TextInput: don't call Paper UIManager `setViewLocalData` in Fabric
Summary:
In Paper this call causes Yoga to remeasure the tree. We don't need to do this in Fabric, and all the data contained in `ReactTextInputLocalData` is already set on the underlying EditText View.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18870491

fbshipit-source-id: a982a708b810d45f70ad4981a963bb4ae798c83c
2019-12-07 00:12:59 -08:00
Anandraj Govindan 7cfabf42b8 Avoid throwing exceptions when the host activity is not FragmentActivity (#27425)
Summary:
There are some code in native modules which currently throws exception when the host activity is not a FragmentActivity, even if the native module is not used. This change avoids the throw and fail the promise instead.

## Changelog

There are some code in native modules which currently throws exception when the host activity is not a FragmentActivity, even if the native module is not used. This change avoids the throw and fail the promise instead.

[CATEGORY] [TYPE] - Message
Pull Request resolved: https://github.com/facebook/react-native/pull/27425

Test Plan: We've tested the change on MS Office applications, which currently don't use FragmentActivity.

Differential Revision: D18873012

Pulled By: mdvacca

fbshipit-source-id: 1b7c9efba5a59b2051487510da9ef7e1232877a5
2019-12-06 20:39:34 -08:00
Valentin Shergin 3aba90b58a Fabric: Workaround for mysterious crash in `synchronouslyUpdateViewOnUIThread:props:`.
Summary:
We are seeing some non-trivial amount of crashes happened because `[RCTSurfacePresenter synchronouslyUpdateViewOnUIThread:props:]` requests a Component Descriptor which does not register in the registry.
And the problem here is that ComponentDescriptors are not being designed to be used outside of C++ UIManager, and we only use that in RCTSurfacePresenter only because it's an old workaround that makes Native Animation Driver works with Fabric.

Messing with ComponentDescriptors are in general dangerous. Accessing them outside of UIManager means that they might be deallocated at any time, extending their lifetime will cause other crashes on the other side. So, that's why this is "BROKEN".

This diff does not make the code worse, it just designates the problem that was there for a long time, so it kinda makes it better.

We don't know for sure why some ComponentDescriptors are not registered but this diff at least makes it not crash in such case.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D18869651

fbshipit-source-id: 9d945ac7a2bd24a69a9bbb83b4fdd3cd19808f87
2019-12-06 17:58:35 -08:00
Joshua Gross 57e4b440fe Copy duplicated iOS/Android TextInput examples to Shared file
Summary:
Continuing Eli's work in D18435734, I'm moving identical duplicated TextInput examples out of `TextInputExample.{ios,android}.js` to `TextInputSharedExamples.js`

Changelog: [Internal]

Reviewed By: TheSavior, mdvacca

Differential Revision: D18855028

fbshipit-source-id: d2880adc972637f6be4c6569a09a69bd8aecddf0
2019-12-06 17:15:19 -08:00
Ramanpreet Nara f57b0caaa4 Support nullable returns NativeModule methods returning Boxed Primitives
Summary:
Returning null from a NativeModule method that has a return type of `java.lang.Double` causes the program to crash. This diff instead makes that method call return `null` to JS. TurboModules already has this behaviour.

Changelog:
[Android][Fixed] - Support nullable returns NativeModule methods returning Boxed Primitives

Reviewed By: PeteTheHeat

Differential Revision: D18866872

fbshipit-source-id: 6049c4df6908f1d276c5674b7e06eb5e002a7976
2019-12-06 16:05:05 -08:00
Riley Dulin 16e8a35d42 Remove groupCollapsed from list of unsupported polyfills
Summary:
Changelog: [Internal] Remove groupCollapsed from list of unsupported polyfills

`console.groupCollapsed` was always replaced with `originalConsole`'s implementation, but
the right behavior is to have it be a proxy (call both `console` and `originalConsole`).
So remove this key from a list of unsupported functions.

Reviewed By: yungsters

Differential Revision: D18820158

fbshipit-source-id: d83cffbc7e7939c2654fad2e0d681da7c3b5196a
2019-12-06 13:35:47 -08:00
Binh Nguyen e341489521 Fix spinner is not shown on beginRefreshingProgrammatically on IOS (#27397)
Summary:
It closes https://github.com/facebook/react-native/issues/24855
In the endRefreshProgrammatically of RCTRefreshControl.m there is calculation for content offset when spinner is shown CGPoint offset = {scrollView.contentOffset.x, scrollView.contentOffset.y - self.frame.size.height};
However self.frame.size.height is always 0 and therefore spinner is not visible
This change should fix that

Since the owner of the following PR is quite busy and won't be able to resolve the merge conflict anytime soon, I created this PR here to get the fix merged soon.
Ref: https://github.com/facebook/react-native/pull/27236
Thanks to [IgnorancePulls](https://github.com/IgnorancePulls)

## Changelog

[iOS] [Fixed] - Fix spinner visibility on beginRefreshingProgrammatically
Pull Request resolved: https://github.com/facebook/react-native/pull/27397

Test Plan:
IOS tests passed
Check whether this issue is reproduced or not for the repro which is described inside the issue.
https://github.com/facebook/react-native/issues/24855

Reviewed By: sammy-SC

Differential Revision: D18801307

Pulled By: hramos

fbshipit-source-id: d12af236778441a136dbe6b03dfd3495a465ae0f
2019-12-06 12:06:44 -08:00
Nicolas Charpentier 898b1db6d0 Fix Flipper integration on iOS and update it (#27426)
Summary:
The integration of Flipper on iOS was crashing the template, and `test_ios_e2e` were failing because of it.

Flipper integration must be wrapped inside `FB_SONARKIT_ENABLED`.

Flipper's issues with Yoga and YogaKit were solved in Flipper 0.28.0, so let's update our integration to it, and we'll need to use Swift.

We will be able to ship this in 0.62 (cc grabbou, axe-fb, priteshrnandgaonkar), and it should fix `test_ios_e2e` (cc hramos) � .
## Changelog

[iOS] [Fixed] - Fix Flipper integration on and update Flipper to 0.30.0
Pull Request resolved: https://github.com/facebook/react-native/pull/27426

Test Plan:
- Initialized an app with my branch as source.
- Added `[AppDelegate initializeFlipper:application];` to `didFinishLaunchingWithOptions`.
- Launched Flipper.
- Ran the app (debug).

![image](https://user-images.githubusercontent.com/7189823/70277734-ef85d680-1780-11ea-876c-1c08e6ed5804.png)

- Ran the app (release).
- Everything succeeds, no Flipper connection available in release.

Reviewed By: hramos

Differential Revision: D18841468

Pulled By: axe-fb

fbshipit-source-id: 73bb4810d1fbb6a96102848f8700ebb7c23a615b
2019-12-06 11:10:24 -08:00
Valentin Shergin e08412d9a1 Fabric: Text Measuring: TextMeasureCache the new, improved text measure cache
Summary:
Special thanks for Joshua Gross for flagging this problem!

This diff implements a custom evicting hash map designed specially to hold text measurement information. The key feature of this is custom equality checks and hashing functions.

They are designed around the following principals:
* Decorative text attributes (such as color, shadows, etc) has no effect on layout, therefore they should not be taking into account;
* `minimum height`, `minimum width`, and `maximum height` don't affect the measurement;
* the value of `layout metrics` are important only for `attachment` fragments.

After I redo all tests, I will enable this for Android-specific TextLayoutManager in separate diff.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18848583

fbshipit-source-id: 46c2fc445fbd1823afc5e7498e37de75381258b1
2019-12-06 10:54:13 -08:00
Valentin Shergin 1a12919dea Fabric: Text Measuring: Using unlimited height during text measuring
Summary:
In the previous diff, we noted that the maximum height is not really important for text measurement. That diff make is in code.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18848585

fbshipit-source-id: 5fe0ea8f76487a50baa8a2e024663a85afcd9861
2019-12-06 10:54:13 -08:00
Valentin Shergin c9b9c93c90 Fabric: Text Measuring: Doing clamping outside of caching
Summary:
Here the deal with the clamp thing:
A layout engine asks nodes to measure their content providing layout constraints (min and max size) and that would be kind from nodes to return a result that in space of those constraints. Sometimes, satisfying that is an additional separate step of that operation, e.g. if we know that the intrinsic size of some node is `{100, 100}`, we need to clamp that to satisfy constraint `[min: {200, 200}, max: {inf, inf}]`.

In case when we need to cache measure information, it becomes tricky enough when we need to make the cache work most efficiently. For the case of measuring Text, we have an insight: the available maximum width is important, the rest three metrics (maximum height and minimum size) are not.

That means that any changes in those three metrics don't affect the actual measurement result but will affect the final value because the actual value will be clamped by constraints that didn't influence measuring in the first place.
That's why moving clamping outside of a cache is the first step into making it more efficient.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18848584

fbshipit-source-id: 8feeb3f1a9d0e9691abac8be43639487a626fec3
2019-12-06 10:54:12 -08:00
Samuel Susla 0bbe3205ca Use plugins for RCTScrollViewComponentView
Summary:
Use plugin architecture for `RCTScrollViewComponentView`

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D18743825

fbshipit-source-id: d25162252d2dc4ac6ee67d48394b4dfa9ad134cb
2019-12-06 10:51:17 -08:00
Ramanpreet Nara 5c6451247d Make DeviceInfo extend ReactContextBaseJavaModule
Summary:
Changelog:
[Android][Changed] - Make DeviceInfo extend ReactContextBaseJavaModule

Reviewed By: PeteTheHeat

Differential Revision: D18784629

fbshipit-source-id: 782b922aa14232738dc7969594b0e0f07d9241f9
2019-12-06 10:05:10 -08:00
Rick Hanlon 13992f90e4 Reconnect to debugger after reload
Summary:
This diff allows re-connecting to the debugger websocket after reloading so that if, for example, metro has restarted, we'll reconnect to allow for debugging. Previously you would need to kill the app and re-open it to re-register the debugger websocket.

Changelog: [iOS] [Fixed] Reconnect to debugger websocket after metro is restarted.

Reviewed By: motiz88

Differential Revision: D18820399

fbshipit-source-id: ddbfa4476e70a6313c877a050ef2d77c04d1657e
2019-12-06 04:59:22 -08:00
Ramanpreet Nara d9deee20e7 Refactor TurboModule filtering in NativeModuleRegistryBuilder
Summary:
## Context
`NativeModuleRegistryBuilder` calls `TurboReactPackage.getNativeModuleIterator()` to access ModuleHolders for all the NativeModules in the `TurboReactPackage`. We then filter out the ModuleHolders that contain `TurboModules`, before using that list to make create the `NativeModuleRegistry`.

## Problem
Creating `ModuleHolders` has the side-effect of actually creating the NativeModule if it requires eager initialization. See [ModuleHolder.java](https://fburl.com/diffusion/4avdtio0):

```
class ModuleHolder {
  // ...
  public ModuleHolder(ReactModuleInfo moduleInfo, Provider<? extends NativeModule> provider) {
    mName = moduleInfo.name();
    mProvider = provider;
    mReactModuleInfo = moduleInfo;
    if (moduleInfo.needsEagerInit()) {
      mModule = create(); // HERE!
    }
  }

```

So, we need to filter out TurboModules before we even create ModuleHolders.

Changelog:
[Android][Fixed] - Refactor TurboModule filtering in NativeModuleRegistryBuilder

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D18814010

fbshipit-source-id: a120d2b619b9280ba70e21d131dccc5a9fc6346d
2019-12-05 19:00:13 -08:00
Eli White e362470305 Convert easy files to flow strict-local
Summary:
This diff was generated by this script used by WWW
https://our.intern.facebook.com/intern/diffusion/WWW/browse/master/scripts/flow/upgrade_to_flow_strict_local.sh?lines=0

Changelog:
[Internal] Upgrade flow to flow strict-local

Reviewed By: zackargyle, rickhanlonii

Differential Revision: D18833630

fbshipit-source-id: e64d4e9a49a0db5e6bf70a0c489567862b578d7f
2019-12-05 16:06:46 -08:00
Eli White 57efe44759 Move flow definitions to react-native
Summary:
These definitions make these libraries act as flow strict. We have them internally but need them in react native to be able to make files in react native flow strict.

Internally our flowconfig includes all the configs in react-native-github.

Changelog:
[Internal]: Add flow strict type definitions for modules

Reviewed By: zackargyle

Differential Revision: D18839594

fbshipit-source-id: d523e15f00a9cfa66d3789bb249655bcbe6d04eb
2019-12-05 16:06:45 -08:00
Eli White c24c8a039c Core files should depend on internals directly
Summary:
By depending on react-native, these files can't be flow strict until index.js is flow strict. By depending on the internals directly they can be flow strict as soon as their dependents are flow strict.

Changelog:
[Internal] Refactoring some core file imports to depend on internals directly

Reviewed By: zackargyle

Differential Revision: D18828324

fbshipit-source-id: 2a347c4e234a64edbb3e6f0ef6387ef1ce78badc
2019-12-05 13:33:58 -08:00
Ramanpreet Nara b7f49a84d5 Implement TurboModule eager initialization
Summary:
The TurboModuleManagerDelegate now supports a `getEagerInitModuleNames()` method, which is supposed to return a `java.util.List` containing the names of all NativeModules that require eager initialization. The NativeModuels are created when the `TurboModuleManager` is created. This happens inside `ReactInstanceManager.createReactContext` slightly after the NativeModuleRegistry is created, which is when our legacy NativeModules are eagerly initialized.

All NativeModules declared in `TurboReactPackages` that are wired into the `TurboModules` infra via `ReactPackageTurboModuleManagerDelegate` can use the `ReactModule(needsEagerInit = true)` annotation. Our build pipeline should correctly process the annotation into a `ModuleInfo`, and `ReactPackageTurboModuleManagerDelegate` should correctly forward the eagerly initialized module names to TurboModuleManager.

Changelog:
[Android][Added] - Implement TurboModule eager initialization support

Reviewed By: mdvacca

Differential Revision: D18819552

fbshipit-source-id: b2009a3b8f4e064362d2abeb5281637962531678
2019-12-05 13:24:43 -08:00
Joshua Gross b9491b7c51 TextInput: support editing completely empty TextInputs
Summary:
Before this change, C++ couldn't propagate changes that updated TextInputs that were completely empty. In C++ the AttributedString cannot contain Fragments with empty text, so a completely empty TextInput would have no Fragments; this breaks the C++ state value updating infra since it relies on copying over existing fragments.

Instead, now we propagate default TextAttributes and ShadowView through State, so that State updates can use them to construct new Fragments.

Changelog: [Internal]

Reviewed By: shergin, mdvacca

Differential Revision: D18835048

fbshipit-source-id: 58ac94c5454c8610c6287b096b62199045e5879b
2019-12-05 13:20:30 -08:00
Joshua Gross 0556e86d09 TextInput: support modifying TextInputs with multiple Fragments (Cxx side)
Summary:
Support for modifying AndroidTextInputs with multiple Fragments was added on the Java side in a previous diff.

This diff adds support on the C++ side for the following scenario:

A <TextInput> is initially given contents via children <Text> notes, which represents multiple Fragments (that could have different TextAttributes like color, font size, backgroundcolor, etc). The Android EditText view must get this initial data, and then all updates after that on the Android side must flow to C++ so that the C++ ShadowNode can perform layout and measurement with up-to-date data.

At the same time, the <TextInput> node could be updated from the JS side. All else equal, this would cause the native Android EditText to be replaced with the old, original contents of the <TextInput> that may not have been updated at all from the JS side.

To mitigate this, we keep track of two AttributedStrings with Fragments on the C++ side: the AttributedString representing the values coming from <TextInput> children, from JS (`treeAttributedString`); and the AttributedString representing the current value the user is interacting with (`attributedString`). If the children from JS don't change, we don't update Android/Java with that AttributedString. If the children from JS do change, we overwrite any user input with the tree from JS.

Changelog: [Internal]

Reviewed By: shergin, mdvacca

Differential Revision: D18785976

fbshipit-source-id: a1f3a935e02379cabca8ab62a39cb3c0cf3fbca5
2019-12-05 13:20:30 -08:00
Joshua Gross 0bae47434e TextInput: keep C++ state in-sync with updated AttributedStrings in Java
Summary:
When the TextInput is updated on the Java side, make sure C++ State gets updated. We do this by making sure that the AttributedString data-structured in mirrored in Java and in C++.

In practice, the AttributedString is copied into Java a few times during initialization, and then after then, 99% of the time Java is writing without receiving updates from C++. This means that we should optimize the Java-to-C++ update path most aggressively in the future.

However, it turns out that for now, at least, we can't reuse NativeWritableMaps/NativeWritableArrays because they're consumed on the C++ side and can't be modified after that. This is a perf improvement for the future.

This allows us the user to edit any fragments, and the changes will flow through C++ State. This also allows us to edit across multiple Fragments.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18785960

fbshipit-source-id: 97b283ec411081eca4d2d7a4cce2b31b5e237c42
2019-12-05 13:20:30 -08:00
Joshua Gross 2a46980535 AttributedString equality: only check tags of parentShadowView; ShadowViews are never equal otherwise
Summary:
For future diffs, we need to check AttributedStrings for equality.
It turns out that any time props or state change, two `parentShadowView`s will never be equal to each other, even if we'd consider them equal for our use-cases here for AttributedStrings. Just compare the tags instead of the whole object.

NOTE: I don't have any strong opinions about how we should be comparing them. It just isn't working currently for AndroidTextInput. Comparing tags seems convenient and reasonably correct for now.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D18786004

fbshipit-source-id: 13c0e881cd8d2c2a207e8891309b3c9b880b827f
2019-12-05 13:20:29 -08:00
Joshua Gross 25ce622683 Fix TextInput example with `text` attribute and child Text node: `text` background shouldn't be same as TextInput background
Summary:
Currently the TextInput background is same as the background of the `text` value's attributes, because of the way we're parsing props and using the TextInput's props both for the background of the TextInput, and for the AttributedString/background color of the `text` prop node's attributes. If the background color has opacity, the `text` prop node will not have the correct background because it will be applied twice. Fix it.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18760384

fbshipit-source-id: 0cdcc8dd8839dd47e8fe0f593b4696bc16a62333
2019-12-05 13:20:29 -08:00
Joshua Gross a09346f129 TextInput: support text value+child Text nodes
Summary:
Fix and simplify `AndroidTextInputShadowNode::getAttributedString` so that it (1) works, and (2) is aligned with the equivalents in the old Java code.

The issue is that we weren't picking up `text` attributes since we're only traversing children and not the TextInput node itself. If a `text` attribute is present it needs to be treated as its own Text node.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18739830

fbshipit-source-id: 4b3bc81dbe8c241c2e06fe5be1f9b50e49132890
2019-12-05 13:20:29 -08:00
Joshua Gross 7590d9f8f4 Support creating AndroidTextInputState from previous state + folly::dynamic
Summary:
This is necessary for allowing TextInput updates from Java.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18739831

fbshipit-source-id: 0ba2d7eac96cac7471c5e46cc1e03a4d065229f5
2019-12-05 13:20:28 -08:00
Joshua Gross 48c69af3e0 Throw non-crashing SoftException when ViewCommand is sent to non-existent tag
Summary:
Motivation: TextInput.js frequently sends commands to views as they're disappearing (`blur`, for instance).

We should fix that in the future, if possible. For now, just log the issue and continue. It shouldn't cause any user-facing issues since 1) it appears that TextInput knows the underlying view is gone; 2) the View has already disappeared so the user can't interact with it, so commands can go safely into the void.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18821448

fbshipit-source-id: 980dbbce8cdb2cc0bb4bf60b3bccc90869208f01
2019-12-05 13:20:28 -08:00
Jordan Brown 5ff82b7094 Error on implicit inexact objects in xplat/js
Summary:
This will ensure we don't get any more implicit inexact objects in xplat/js. Before we turn on exact-by-default we are going to make an announcement post, so this diff will hold the line until that's out.

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D18785892

fbshipit-source-id: caeb662f08b44cebe34b9e1b52bdd5842fe06176
2019-12-05 09:03:03 -08:00
Dulmandakh 2fd50882b5 fix build failure due to duplicate libc++_shared.so (#27417)
Summary:
This PR fixes build failure caused by duplicate libc++_shared.so, because dependencies (like Flipper) might include one in addition to RN.

## Changelog

[Android] [Changed] - fix build failure due to duplicate libc++_shared.so
Pull Request resolved: https://github.com/facebook/react-native/pull/27417

Test Plan: Create a project from master, then build and run. Build will fail without the patch, and succeed with the patch.

Differential Revision: D18827583

Pulled By: mdvacca

fbshipit-source-id: 1272cedd299278403f87215c36aaf58217eae3c5
2019-12-04 23:25:47 -08:00
Jordan Brown 90ab8b89e8 Last pass over non-generated files for explicit inexact object rollout
Summary:
The flow team is rolling out exact-by-default object types to xplat/js. In order to do that, we need to take all inexact objects `{}` and turn them into explicitly inexact objects `{...}`.

This codemod does not change any type checking behavior. Prettier was run on all of the modified files with `format`.

drop-conflicts

Changelog: [Internal]

Reviewed By: zackargyle

Differential Revision: D18785076

fbshipit-source-id: c89c7fcc9eabe69859c8a488e03185fba5d06f80
2019-12-04 21:41:16 -08:00
Valentin Shergin 42f2ded900 Fabric: Returning zero size on attempt to measure an empty string in RCTTextLayoutManager
Summary:
Sometimes, very irregularly, measuring an empty string crashes/freezes iOS internal text infrastructure. This is our last line of defense.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC, mdvacca

Differential Revision: D18802308

fbshipit-source-id: addf523b31b78b0777be7eeaeee140ac8416393b
2019-12-04 18:36:49 -08:00
Valentin Shergin d12385cae6 Fabric: Support for AttributedStringBox::Mode::OpaquePointer in RCTTextLayoutManager
Summary:
Now RCTTextLayoutManager (and TextLayoutManager) not only accept `AttributedStringBox`  but also is capable to measure such kind of string when it contains a pointer to NSAttributedString.
The same can be implemented for Android when/if needed.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18670791

fbshipit-source-id: f19089de64d00e1290767310a500ade4cede4685
2019-12-04 18:36:49 -08:00
Valentin Shergin c4876d0313 Fabric: Introducing `AttributedStringBox`
Summary:
The diff implements a new class called `AttributedStringBox` that represents an object storing a shared `AttributedString` *or* a shared pointer to some opaque platform-specific object that can be used as an attributed string. The class serves two main purposes:
- Represent type-erased attributed string entity (which can be platform-specific or platform-independent);
- Represent a container that can be copied with constant complexity.

Why? Several reasons:
- Sometimes it makes sense to keep an attributed string as a shared resource. This way we don't need to pay for expensive copying and we also implement a copy-on-write semantics on top of that if needed.
- We need to extend a TextLayoutMeasure API to support measuring some platform-specific attributed string implementation to remove the necessity of converting a string back and forth between representations. That's especially important for TextInput because we will need to measure that very efficiently (and the source of measuring, in this case, is a platform attributed string).

In other words, we need something to store inside TextInputState to measure and update very efficiently. The source of this data might be a native TextInput control or a data from React, to represent that kinda object we need this data structure (and interfaces that deal with it).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18670793

fbshipit-source-id: bc0164f801f28642f7c6da340af12acf33b85d24
2019-12-04 18:36:48 -08:00
jeswinsimon 70ec7e2add Share - title is not a valid attribute in iOS (#27351)
Summary:
Code document incorrectly indicates that the `title` property is supported in both iOS and Android.
https://github.com/facebook/react-native/issues/27306

## Changelog

[iOS] [Changed] - Changed doc.
Pull Request resolved: https://github.com/facebook/react-native/pull/27351

Test Plan: NA - Only code comments have been changed.

Differential Revision: D18770026

Pulled By: hramos

fbshipit-source-id: af51c0b08bdf534d5e2c861b10e22d969d6f80f9
2019-12-04 15:49:22 -08:00
talhaazhar 3c4b1d6c4f adding tests for the processColorArray mapping (#27344)
Summary:
The following pull-requests adds test for the `processColorArray` function. This ensures that the mapping is respected even in the `processColor` file changes. It also ensures that the mapping follows the basic expected functionality

## Changelog
[General] [Added] - Add test for the `processColorArray` to make sure it maps correctly
Pull Request resolved: https://github.com/facebook/react-native/pull/27344

Test Plan:
- Run `npm run test Libraries/StyleSheet/__tests__/processColorArray-test.js` to ensure tests pass
- Run `npm run lint` to make sure there are no styling conflicts.

<img width="454" alt="Screen Shot 2019-11-26 at 3 24 44 PM" src="https://user-images.githubusercontent.com/31664059/69680816-e8641780-1060-11ea-89ca-336c5534eb16.png">

Differential Revision: D18770069

Pulled By: hramos

fbshipit-source-id: 1a8647931818360b9912dc6fb50c339a91b9d4ea
2019-12-04 15:27:54 -08:00
Héctor Ramos 97dd8cedc5 Bump RNTester OS target to iOS 12.4 (#27414)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/27414

The version of Xcode used in tests does not have a iOS 12.2 simulator by default. Bumping to 12.4 should fix iOS test failures.

Changelog:

[iOS] [Fixed] - Fix iOS tests by using 12.4 iOS Simulator

Reviewed By: mhorowitz

Differential Revision: D18802712

fbshipit-source-id: 0f0ea9982c8a9cf17e17ca473ed1c480751e3515
2019-12-04 14:56:28 -08:00
Emily Janzer 476a336e36 Convert NetworkingModule to TurboModule
Summary: Making the open source NetworkingModule TM-compatible.

Reviewed By: mdvacca

Differential Revision: D18770987

fbshipit-source-id: 64966f91308e31bdcf9bfa959381d4e40ccb2753
2019-12-04 11:26:39 -08:00
Emily Janzer de6aa10bdd Use registerLazyCallableModule to register HMRClient
Summary:
Right now we use `BatchedBridge.registerLazyCallableModule` for all JS modules except for `HMRClient`, which uses `registerCallableModule` instead (takes the module itself instead of a function that returns it). I'm standardizing on `registerLazyCallableModule` so that it will be easier to swap out the implementation later for bridgeless mode.

The only reason I could think why we wouldn't want to do this is if we're relying on some side effect of `require('HMRClient')` when setting up JS, but there don't seem to be any side effects in that module that I can see.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18798870

fbshipit-source-id: a5c950bdbfd998bb12e4843ee28ece08a26c84bf
2019-12-04 10:52:06 -08:00
Tim Yung 37d8440a8e Touchable: Restore `underlayColor={null}` Behavior
Summary:
The former implementations of `TouchableHighlight` used `defaultProps` for `underlayColor`. However, the newly landed implementations use `??` which falls back to the default behavior if the prop is `null`.

This restores the former behavior so that, for example, supplying `underlayColor={null}` to `TouchableHighlight` will not fallback to black. (It probably should always have, but the intention of my rewrite was not to introduce a breaking change.)

Changelog:
[General] [Fixed] - Restore behavior for `underlayColor={null}` in `TouchableHighlight`.

Reviewed By: zackargyle

Differential Revision: D18806494

fbshipit-source-id: 4d33810e2f754f980385d76d81dc0f34006f4337
2019-12-04 09:35:46 -08:00
George Zahariev 15e2dcfff9 Release 0.113 to xplat
Summary:
Release 0.113 to xplat

Changelog: [Internal]

Reviewed By: dsainati1

Differential Revision: D18790262

fbshipit-source-id: ac3ad40c24010aab1c0d43947843dd581a17d3cf
2019-12-04 09:17:34 -08:00