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

17027 Коммитов

Автор SHA1 Сообщение Дата
David Vacca 12b735a378 Create structure of mapbuffer project
Summary: Create structure of C++ side of mapbuffer project

Reviewed By: shergin

Differential Revision: D15529650

fbshipit-source-id: b563d3fbcfddcf46802ccb202e372233baad123d
2019-05-28 17:29:38 -07:00
Emily Janzer d83ba5ad51 Revert D15488008: Use JS ViewConfig for View
Differential Revision:
D15488008

Original commit changeset: 48e925ec0ca2

fbshipit-source-id: 4ffa223e636116777c178386b6e966a4f253c30a
2019-05-28 16:37:46 -07:00
Emily Janzer 298f59c5d3 Use startSurface on Android
Summary:
We currently have two different codepaths for actually rendering a surface with Fabric on iOS and Android: on iOS we use Fabric's `UIManagerBinding.startSurface` to call `AppRegistry.runApplication`, but on Android we don't; instead we use the same codepath as paper, calling `ReactRootView.runApplication`.

This diff does a few different things:
1. Unify iOS and Android by removing the `#ifndef` for Android so that we call `startSurface` for both
2. Pass through the JS module name on Android so that this actually works (it currently passes in an empty string)
3. Remove the call to `ReactRootView.runApplication` for Fabric so that we don't end up doing this twice
4. Copy over some logic that we need from `ReactRootView.runApplication` (make sure that root layout specs get updated, and that content appeared gets logged)

Reviewed By: mdvacca

Differential Revision: D15501666

fbshipit-source-id: 5c96c8cf036261cb99729b1dbdff0f7c09a32d76
2019-05-28 12:23:00 -07:00
Sam Goldman ab1a42762c Make RelayObservable Source return type disjoint
Summary:
In Flow v0.99 we are changing function type annotations to be strict about their
static properties. This causes a small issue with the union of a Subcription and
`() => mixed` function type, where the latter is now understood to possibly have
an `unsubscribe` property with a mixed type.

This causes the following refinement check, which appears lower in this file, to
cause an error in the next version of Flow:

```
if (cleanup) {
  if (cleanup.unsubscribe) {
    cleanup.unsubscribe(); // <-- error here
  }
  // ...
}
```

In Flow v0.99, because `() => mixed` statics are now checked, Flow sees that
`cleanup.unsubscribe` might be `mixed`, which passes the conditional but could
cause an exception when called.

I also needed to change JestMockFn to have exact statics, because tests
sometimes use a value with that type in place of the cleanup function. That runs
into the `{} <: {+p?: void}` rule, which is an error. `{||} <: {+p?:void}` is
not an error.

Reviewed By: josephsavona

Differential Revision: D15522655

fbshipit-source-id: 2ae3c9016e2b07abaac79827082d2f8743623eb5
2019-05-28 12:13:49 -07:00
Emily Janzer 77a6617a39 Use JS ViewConfig for View
Summary: Rick manually created view config in JS for View; adding some missing attributes/events and using this instead of `requireNativeComponent`

Reviewed By: rickhanlonii

Differential Revision: D15488008

fbshipit-source-id: 48e925ec0ca2aeba9e6cc66edef0b70ee1c94d27
2019-05-28 10:22:43 -07:00
Luna Wei bd3023abea Layout Animation fix for normalized indices
Summary:
[Android][Fix] - Fix how we normalize indices

Before, we were incorrectly normalizing indices given pending view deletion in the view hierarchy (namely, using LayoutAnimations)

What we had before (that was wrong):
* Maintained a pendingIndices sparse array for each tag
* For each pendingIndices sparse array we'd keep track of how many views we deleted at each abstract index
* Given an abstract index to delete a view at, we'd consult `pendingIndices` array to sum how many pending deletes we had for indices equal or smaller than and add to abstract index

^ Above algorithm is wrong and you can follow along with the following example to see how.

## The correct approach
Given these operations in this order:
1. {tagsToDelete: [123], indicesToDelete [2]}
2. {tagsToDelete: [124], indicesToDelete [1]}
3. {tagsToDelete: [125], indicesToDelete [2]}
4. {tagsToDelete: [126], indicesToDelete [1]}

The approach we want to be using to calculate normalized indices:
### Step 1: Delete tag 124 at index 2

|Views:|122|123|124|125|126|127|
|Actual Indices:|0|1|2|3|4|5|
|Abstract Indices:|0|1|2|3|4|5|
=> simple, we just mark the view at 2

### Step 2: Delete tag 123 at index 1
View tags and indices:
|Views|122|123|~~124~~|125|126|127|
|Actual indices|0|1|~~2~~|3|4|5|
|Abstract Indices|0|1||2|3|4|
=> again, simple, we can just use the normalized index 1 because no pending deletes affect this operation

### Step 3: Delete tag 126 at index 2
View tags and indices:
|Views|122|~~123~~|~~124~~|125|126|127|
|Actual Indices|0|~~1~~|~~2~~|3|4|5|
|Abstract Indices|0|||1|2|3|
=> Here we want to normalize this index to 4 because we need to account the 2 views that should be skipped

### Step 4: Delete tag 125 at index 1
View tags and indices:
|Views|122|~~123~~|~~124~~|125|~~126~~|127|
|Actual Indices|0|~~1~~|~~2~~|3|~~4~~|5|
|Abstract Indices|0|||1||2|
=> The normalized index should be 3.

This diff updates the function `normalizeIndex` to do the above algorithm by repurposing `pendingIndicesToDelete` to instead be a sparse int array that holds [normalizedIndex]=[tag] pairs
It's required that `pendingIndicesToDelete` is ordered by the normalizedIndex.

Reviewed By: mdvacca

Differential Revision: D15485132

fbshipit-source-id: 43e57dffa807e8ea50fa1650c5dec13a6fded624
2019-05-28 09:09:08 -07:00
Luna Wei 5979eafb16 Back out "[RN] Fix layout animation crash"
Summary: Original commit changeset: 41200e572ed7

Reviewed By: mdvacca

Differential Revision: D15485156

fbshipit-source-id: d0868a03b7186bb33998afc2c99dd85f31c8fef9
2019-05-28 09:09:07 -07:00
AndreiCalazans 3945f10561 - Update folder structure of RNTester's JS directory. (#25013)
Summary:
Changes RNTester, first attempt in the direction of improving the RNTester overall. Related ticket: #24647

Changed the `js` directory of the RNTester to have the following structure:
```
- js
    - assets
    - components
    - examples
    - types
    - utils
```
* **assets**
_Any images, gifs, and media content_

* **components**
_All shared components_

* **examples**
_Example View/Components to be rendered by the App_

 * **types**
_Shared flow types_

 * **utils**
_Shared utilities_

## Changelog

[General] [Changed] - Update folder structure of RNTester's JS directory.
Pull Request resolved: https://github.com/facebook/react-native/pull/25013

Differential Revision: D15515773

Pulled By: cpojer

fbshipit-source-id: 0e4b6386127f338dca0ffe8c237073be53a9e221
2019-05-28 08:39:18 -07:00
Andrea Cimitan 54abe1f599 Linking.getInitialURL() to work with NFC tags on Android (#25055)
Summary:
This PR solves bug https://github.com/facebook/react-native/issues/24393 for Android. Allows an app to be opened with an NFC tag and getting the url trough Linking.getInitialURL()

## Changelog
[Android] [Fixed] - This branch checks also for `ACTION_NDEF_DISCOVERED` intent matches to set the initialURL
Pull Request resolved: https://github.com/facebook/react-native/pull/25055

Differential Revision: D15516873

Pulled By: cpojer

fbshipit-source-id: e8803738d857a69e1063e926fc3858a416a0b25e
2019-05-28 07:33:20 -07:00
Héctor Ramos 0b14b6007d (CONTRIBUTING.md) Link to Issues wiki (#25035)
Summary:
Link to https://github.com/facebook/react-native/wiki/Issues

## Changelog

[Internal] [Changed] - Link to Issues wiki
Pull Request resolved: https://github.com/facebook/react-native/pull/25035

Differential Revision: D15516862

Pulled By: cpojer

fbshipit-source-id: 2f70a28685852293f946c0b1128184226d56aaa7
2019-05-28 07:04:12 -07:00
Christoph Nakazawa 31ab947703 Remove ToolbarAndroid, move to FB Internal
Summary: This removes the JS for ToolbarAndroid from RN and moves it to Ads manager, which has two remaining uses of it. In a follow-up, I will also move the native code.

Reviewed By: rickhanlonii

Differential Revision: D15469117

fbshipit-source-id: 68c3f89b85cc589a48f2dced183267daa791b53b
2019-05-28 04:22:08 -07:00
Youssouf El Azizi d2ef114538 Add Spec for ImageEditor (#24921)
Summary:
This PR solves part of this issue: #24875
## Changelog

[General] [Added] - TM Spec for ImageEditor
Pull Request resolved: https://github.com/facebook/react-native/pull/24921

Reviewed By: rickhanlonii

Differential Revision: D15471058

Pulled By: fkgozali

fbshipit-source-id: f01539fc8acea95fca27ce7bb4b4169ffe138d93
2019-05-27 22:14:29 -07:00
Daiki Ihara 122cc8ba8a Add spec for AlertManager (#24906)
Summary:
Part of #24875

## Changelog

[General] [Added] - Add TurboModule spec for AlertManager
Pull Request resolved: https://github.com/facebook/react-native/pull/24906

Reviewed By: lunaleaps

Differential Revision: D15471065

Pulled By: fkgozali

fbshipit-source-id: bb22e6454b1f748987f3a8cd957bfd4e027493a5
2019-05-27 22:14:29 -07:00
Rick Hanlon 956077675e Fix for ActivityIndicator on Android
Summary: Fixes an issue that was including the view config native component verification function even when the native component wasn't included (e.g. on android)

Reviewed By: mdvacca

Differential Revision: D15513535

fbshipit-source-id: 9b615689c0d64757eeb3d66862e5b1902ea79b20
2019-05-27 11:50:07 -07:00
Michal Sienkiewicz a0f2bfa120 Sync worker requirement mismatches
Summary:
Syncing worker requirement mismatches to improve remote build time.

Created actions:
MEDIUM: 5

Differential Revision: D15510246

fbshipit-source-id: b8454b4acf2810251d2a4a4515fc0ce2c1a2b327
2019-05-26 01:39:01 -07:00
Valentin Shergin ba627f4970 Fabric: Implementaion of RCTScrollableProtocol for RCTScrollViewComponentView
Summary: We need this only until Fabric has own command-execution pipeline.

Reviewed By: mdvacca

Differential Revision: D15501202

fbshipit-source-id: aad77660ada43e429722b13d1da2f998a1726c73
2019-05-24 19:16:32 -07:00
Valentin Shergin 94dfc153a4 Fabric: Temporary workaround to enable commands in Fabric
Summary: This is a temporary workaround that we need only temporary and will get rid of soon.

Reviewed By: mdvacca

Differential Revision: D15501203

fbshipit-source-id: cec4891b6a185ea9e39f50bfedf9e1dae8993b66
2019-05-24 19:16:31 -07:00
valerio.ponte d88e4701fc Add showSoftInputOnFocus to TextInput (#25028)
Summary:
Add prop showSoftInputOnFocus to TextInput. This fixes #14045. This prop can be used to prevent the system keyboard from displaying at all when focusing an input text, for example if a custom keyboard component needs to be displayed instead.

On Android, currently TextInput always open the soft keyboard when focused. This is because `requestFocus` calls `showSoftKeyboard`, which in turn instructs `InputMethodManager` to show the soft keyboard.

Unfortunately even if we were to define a new input type that extends ReactEditText, there is no way to overcome this issue.
This is because `showSoftKeyboard` is a private method so it can't be overriden. And at the same time `requestFocus` needs to invoke `super.requestFocus` to properly instruct Android that the field has gained focused, so overriding `requestFocus` in a subclass of ReactEditText is also not an option, as when invoking `super.requestFocus` we would end up calling again the one defined in ReactEditText.

So currently the only way of doing this is to basically add a listener on the focus event that will close the soft keyboard immediately after. But for a split second it will still be displayed.

The code in the PR changes `requestFocus` to honor showSoftInputOnFocus as defined in Android TextView, displaying the soft keyboard unless instructed otherwise.

## Changelog

[Android] [Added] - Add showSoftInputOnFocus to TextInput
Pull Request resolved: https://github.com/facebook/react-native/pull/25028

Differential Revision: D15503070

Pulled By: mdvacca

fbshipit-source-id: db4616fa165643d6ef2b3185008c4d279ae08092
2019-05-24 15:40:22 -07:00
rkang 206bb6d3b9 Update the "nativeStackAndroid" (#25014)
Summary:
Update the "nativeStackAndroid" frame limit to 50 and include the class name on the "nativeStackAndroid".

nativeStackAndroid only contains up to 10 lines of stack traces. This is due to the "ERROR_STACK_FRAME_LIMIT" set to 10 on https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/bridge/PromiseImpl.java.

![2019-05-22_10-33-23](https://user-images.githubusercontent.com/14658357/58291337-eba8de80-7d71-11e9-9524-5bd6814c9f4a.png)

nativeStackAndroid should contain a more reasonable number of the native stack traces. (nativeStackIOS includes all of them). another improvement could be adding the "declaringClass" on top of the "methodName", "LineNumber", and "file" on the stack trace frameMap.

![2019-05-22_13-38-43](https://user-images.githubusercontent.com/14658357/58290869-1b56e700-7d70-11e9-9e63-2149fd1486c7.png)

## Changelog

[Android] [Added] - Update the "nativeStackAndroid" frame limit to 50 and include class name
Pull Request resolved: https://github.com/facebook/react-native/pull/25014

Differential Revision: D15503022

Pulled By: cpojer

fbshipit-source-id: 6f1bc25ea739715d0e7589d430bf9cf72da305b2
2019-05-24 15:33:43 -07:00
Sharon Gong 651cc2613f Move accessibilityActions property to UIView+React (#25015)
Summary:
As PR [#24743](https://github.com/facebook/react-native/pull/24743) suggested, accessibility properties are better to set on UIView+React instead of RCTView so they can be used safely on any UIView.

## Changelog

[General] [Fixed] - Move accessibilityActions props to UIView+React
Pull Request resolved: https://github.com/facebook/react-native/pull/25015

Differential Revision: D15503131

Pulled By: cpojer

fbshipit-source-id: dedf9afbd0a1d35a5abbd13ace95ee620f718f39
2019-05-24 15:33:43 -07:00
Hermanyo b9b9137604 if-else refactoring (#25025)
Summary:
## Summary
## Changelog
[Internal] [Changed] - Code review

## Test Plan
N/A
Pull Request resolved: https://github.com/facebook/react-native/pull/25025

Differential Revision: D15502838

Pulled By: cpojer

fbshipit-source-id: 9b8d2525411dea35e746638146b9af90832733f6
2019-05-24 15:13:55 -07:00
Malcolm Scruggs fa97b2383c Use default OK on buttonPositive to prevent showing an alert without any buttons (#25033)
Summary:
Solve #25016

Use `OK` as default text for the affirmative button if no text is specified. When setting an alert on android with button configuration, and no `text` field specified no button is shown on the alert. This makes it impossible to dismiss. An example of how this can happen is creating a simple button where a `onPress` callback is used but no text is specified:

```
Alert.alert(
   'title',
   'message',
   [ { onPress: () => console.log('onPress') } ],
)
```

Does not change the current behavior of no text button configurations on iOS. On iOS at least one button is always shown, and buttons with no text can be displayed.

Behavior on setting multiple buttons is a little wonky, but this PR does not aim to solve it. I did test these cases and included some examples below.

## Changelog

[Android] [Fixed] - Use OK as default text on Android Alert if button configuration specified without text
Pull Request resolved: https://github.com/facebook/react-native/pull/25033

Differential Revision: D15502780

Pulled By: cpojer

fbshipit-source-id: 505a9940f4588f4c10e25b67bfed8b8a1e610c69
2019-05-24 14:58:36 -07:00
Shen Jin 7d1c827cb2 Fix spinner mode
Summary:
Okay, I think this is the best I can do David, I don't think there's an obvious/easy way for me to try to get `getIdentifier()` to return a non zero value. Setting it to what Spencer suggested works for my use case.

## Changelog

[Android] [Changed] - Update spinner mode to render spinner instead of calendar

Reviewed By: sahrens

Differential Revision: D15427793

fbshipit-source-id: b04f024a9a1f052f69f3bda47d77821782dc2c0e
2019-05-24 14:42:28 -07:00
zhongwuzw 141a3041e0 Fixes wrong headers import (#25002)
Summary:
Issue imported from e1102b43ff for Android TM support.
Fixes wrong headers import in iOS.

## Changelog

[iOS] [Fixed] - [TM] Fixes wrong headers import
Pull Request resolved: https://github.com/facebook/react-native/pull/25002

Differential Revision: D15501594

Pulled By: cpojer

fbshipit-source-id: 45ea2986963ff4937c473464f0befc1f5bcfe115
2019-05-24 14:06:52 -07:00
Valentin Shergin 9990010b2c Fabric: Disabling sync and unbatched event queues
Summary:
We are not sure yet how exactly this should work semantically (e.g. should unbatched events flash previously dispatched batched or not).
So, let's disable that until we have all answers.

Reviewed By: mdvacca

Differential Revision: D15498191

fbshipit-source-id: 77f07c5e86bfbfd212505df8cc6530e39531b5ef
2019-05-24 12:25:52 -07:00
Valentin Shergin 83f23982ca Fabric: Touch and TouchEvent got own files and support for debug printing
Summary: That's essential for debugging touch events.

Reviewed By: mdvacca

Differential Revision: D15498192

fbshipit-source-id: 4a8e0a2b84a1935722518fdce03c10ba277f5702
2019-05-24 12:25:52 -07:00
Valentin Shergin 6dbd809df5 Fabric: Support for debug printing `std::unordered_set<>`
Summary: Quite trivial.

Reviewed By: mdvacca

Differential Revision: D15498190

fbshipit-source-id: 512c121c6629e65bef7dd0c86898506e0fe861a9
2019-05-24 12:25:51 -07:00
Valentin Shergin f4a0102642 Fabric: Using `const &` in all other appropriate parts of RCTComponentViewProtocol
Summary:
Same as previous one but for the rest (minority) of methods.
I didn't change `updateLocalData:` because it's going away soon anyway.

Reviewed By: mdvacca

Differential Revision: D15473217

fbshipit-source-id: 6a6bd66c5343211a973fc34ad11e86efe031d07d
2019-05-24 12:25:51 -07:00
Valentin Shergin 0e9c764e28 Fabric: Passing props as `const &` in RCTComponentViewProtocol
Summary:
Passing shared pointers as references can save us a couple of milliseconds at scale.
Originally, I didn't expect that Objective-C supports passing values by references, but apparently it does.

Reviewed By: mdvacca

Differential Revision: D15473218

fbshipit-source-id: 15eb3770cc0889654647a8e91607d8aa78010121
2019-05-24 12:25:51 -07:00
zhongwuzw e4240da560 Break retain cycle between view component and observer (#25019)
Summary:
Fixes potential memory leaks.

## Changelog

[iOS] [Fixed] - [Fabric] Break retain cycle between view component and observer
Pull Request resolved: https://github.com/facebook/react-native/pull/25019

Differential Revision: D15499209

Pulled By: shergin

fbshipit-source-id: de53bea5cd5758b9890f3941c39a27d2747bf35b
2019-05-24 12:15:39 -07:00
Dulmandakh fbc6d8caff bump android gradle plugin to 3.4.1 (#24883)
Summary:
bump android gradle plugin to 3.4.1, includes many fixes and improvements.

## Changelog

[Android] [Changed] - bump android gradle plugin to 3.4.1
Pull Request resolved: https://github.com/facebook/react-native/pull/24883

Differential Revision: D15474556

Pulled By: hramos

fbshipit-source-id: 8d1eb91855b9f416ed3380c61f34672deded26c1
2019-05-24 11:53:17 -07:00
David Vacca 6f63b054b6 Add Nullable annotation into Mounting Manager
Summary: trivial diff to remove warnings because of the lack of Nullable annotations in MountingManager.ViewState

Reviewed By: shergin

Differential Revision: D15476040

fbshipit-source-id: 2b9a4efa1be1d5aa29d4e32cf32c8ff502f7c60c
2019-05-24 11:30:30 -07:00
David Vacca 92f8fd22e2 Optimize the update of state during first render of a View
Summary: This is an optimization to avoid transfering updateState instructions twice during the frist render of a view (same a props)

Reviewed By: shergin

Differential Revision: D15476041

fbshipit-source-id: 8a62035dbbb63c93f86a2f8d217986a325cb1805
2019-05-24 11:30:30 -07:00
David Vacca cd5fe06abe Fix bottom sheet in Fabric Android
Summary: This diff fixes the rendering of Bottom Sheet in Fabric Android. In D15343702 we added state as part of the "preallocateView" method but we forgot to call viewManager.updateState(), this prevents the state to be updated during the first render.

Reviewed By: shergin

Differential Revision: D15476042

fbshipit-source-id: cd6fc9bdd178589d2e04f85723425b5e5c3e5a04
2019-05-24 11:30:30 -07:00
David Vacca c629cdc39a Remove ComponentRegistry class
Summary: This class is not necessary anymore, this diff deletes it from the repo

Reviewed By: JoshuaGross

Differential Revision: D15457346

fbshipit-source-id: c7293d93b50271efe3b3d2121c128ba6e13c7627
2019-05-24 11:30:30 -07:00
David Vacca cb1a28c859 Remove jsi package from fabric android
Summary: Refactor of packages of RN Android

Reviewed By: JoshuaGross

Differential Revision: D15457141

fbshipit-source-id: a291f7e1ca8e0be3e93daf9c34161c8f1fdbafac
2019-05-24 11:30:29 -07:00
David Vacca bbf1a7d085 Back out "[Venice][Fabric] Use startSurface on Android"
Summary: Original commit changeset: 4a506a589108

Reviewed By: ejanzer

Differential Revision: D15497094

fbshipit-source-id: 47e5d0c3c69cc56cc3dd56d28e23e1db5b562fa4
2019-05-24 11:30:29 -07:00
Rick Hanlon 9f8305a837 Add view config for PullToRefresh
Summary:
Adds the generated view config for PullToRefresh

Note: we're not using this view config yet, the component is in the process of being renamed (see TODO)

Reviewed By: rubennorte

Differential Revision: D15485870

fbshipit-source-id: a163ac371181dcc990093e3cd995d7dd9058b26a
2019-05-24 09:21:28 -07:00
Rick Hanlon ac62274e56 Use generated view config for ActivityIndicatorView
Summary: This diff moves ActivityIndicatorView to the generated view config

Reviewed By: shergin

Differential Revision: D15392561

fbshipit-source-id: 67a2fa0dbbb884af9e9c02b9062d3a610a023240
2019-05-24 09:21:27 -07:00
Rick Hanlon e52bc2aa73 Use generated view config for Slider
Summary: This diff uses the generated view config for the slider component �

Reviewed By: JoshuaGross, TheSavior, mdvacca

Differential Revision: D15336089

fbshipit-source-id: 46c458805fd947e202e2084df65c8c83560cf106
2019-05-24 09:21:27 -07:00
Rick Hanlon ca783414d6 Integrate flow parser into view config generation
Summary:
This diff integrates the new flow parser into `js1 build viewconfig` so that we're generating the view config from actual source

Note: see next diff for usage

Reviewed By: mdvacca

Differential Revision: D15452255

fbshipit-source-id: db04cb1c7adffaf3167a49c2260cae8fd365f50b
2019-05-24 09:21:27 -07:00
Rick Hanlon 057ea6a5c7 Add flow parser
Summary:
This diff initializes the codegen flow parser using a proposal for some new syntaxes in flow file to handle missing  information like:

- Float vs Int32
- Bubbling Events vs Direct Events
- Default props
- Codegen options
- Specifying the component name

For a deep dive on the proposal see:  https://fb.quip.com/kPYJAjCHxlgO

Note: there are still some todos to follow up with:
  - Array props
  - Enum props
  - Object event arguments

Note also: the parser code is a little rough, I didn't want spend too much time cleaning it up before we agreed on the format

[General][Added] Add codegen flow parser

Reviewed By: cpojer

Differential Revision: D15417733

fbshipit-source-id: dd80887c0b2ac46fdc3da203214775facd204e28
2019-05-24 09:21:26 -07:00
Oleksandr Melnykov fb6cf2552a Fix backgroundColor top level prop of TextInput
Summary:
Changelog: [Android] [FIXED] - Fix backgroundColor top level prop of TextInput

This diff fixes two issues with the `backgroundColor` top level property of TextInput on Android:
 * Now it is possible to set a **string** value for the top-level `backgroundColor` property of TextInput (crashed the app previously):
```
<TextInput backgroundColor="#ffccbb">Hello, React Native</TextInput>
```
* Now it's possible to set an **integer** value for the top-level `backgroundColor` property of TextInput (had no effect previously):
```
<TextInput backgroundColor={0xffccbbff}>Hello, React Native</TextInput>
```

A `customType = "Color"` annotation parameter must be provided for `ReactBaseTextShadowNode.setBackgroundColor(...)` since the color value must be previously processed in JS before sending it over the bridge to the native code. The JS code will parse the color value and return the proper ARGB color integer to the native platforms (https://fburl.com/uqup52tn).

Without providing the custom type for the background color, if a string value is set for the top-level `backgroundColor` property in the JS code, the Android code will crash since it expects an integer value for the color in `ReactBaseTextShadowNode.setBackgroundColor(...)`, but a string will be passed from JS without any conversion and there will be a `ClassCastException` thrown. If an integer value without the alpha component (like `0xffccbb`) is set, the Android native view would get an integer color value with its alpha component set to `0x00`, which means a transparent color.

On a side note: the alpha component of a color must always be set when using an integer value for `backgroundColor` since the JS code, while processing the color type, shifts the rightmost 8 bytes (alpha component) to the leftmost position. If those 8 bytes are not the alpha component, you will get the wrong color in the end. It doesn't seem to be a problem for string values of `backgroundColor` though.

Reviewed By: mdvacca

Differential Revision: D15453980

fbshipit-source-id: f3f5d9c9877cdbce79a67f2ed93ad4589576d166
2019-05-24 02:53:42 -07:00
David Vacca 01abcf0e83 Fix update of accessibilityStates in Android
Summary:
This diff fixes a bug on the update of accessibiltyState prop in RN Android.
In particular, this bug was reproducible when a view has an accessibiltyState = ['disabled'] and there was a state update to set the {accessibiltyState = {null}}. In this scenario, the BaseViewManager.setViewStates method did not update the view with the default values for accessibilityState

Reviewed By: sahrens

Differential Revision: D15446078

fbshipit-source-id: 75f160916e55f0ee469516db2fe9b0a7d4758cd8
2019-05-23 18:31:39 -07:00
Emily Janzer f23da3aeb0 Use startSurface on Android
Summary:
Right now calling FabricUIManager.addRootView() doesn't actually start running the application on Android. This diff:

1. Removes the #ifndef so that we actually call UIManagerBinding.startSurface() on Android
2. Passes through the JS module name from addRootView so we can render the surface (falls back to an empty string if not provided, which is the current behavior)
3. Adds an option for starting the surface using `RN$SurfaceRegistry` instead of `AppRegistry`, if that global property has been defined in JS. This is used for Venice (bridgeless RN)

Reviewed By: shergin

Differential Revision: D15366200

fbshipit-source-id: 4a506a589108905d4852b9723aac6fb0fad2d86e
2019-05-23 13:47:30 -07:00
Emily Janzer d742c7be36 Auto-formatting for Binding
Summary:
I just learned about Nuclide's auto-formatting (cmd-shift-c) and started using it in another diff, but I didn't want to pollute the diff with a bunch of formatting changes, so here we are.

I don't know if anyone else uses Nuclide's auto-formatting, or something else - happy to ditch this if that's not how we roll.

Reviewed By: shergin

Differential Revision: D15389601

fbshipit-source-id: e3b20acd073adf3cc7bab1f62d86c5b5dab8c4fc
2019-05-23 13:47:29 -07:00
Christoph Nakazawa 3f04cfecda Move CameraRoll JS to FB internal
Summary: Moves relevant JS files to fb internal, removes stuff we don't need in the RN repo any more. Android and iOS will happen in a follow-up.

Reviewed By: rickhanlonii

Differential Revision: D15468419

fbshipit-source-id: 39fffc22f87534e557788e398bbae575043353b6
2019-05-23 07:06:21 -07:00
Marc Mulcahy 099be9b356 New Accessibility states API. (#24608)
Summary:
As currently defined, accessibilityStates is an array of strings, which represents the state of an object. The array of strings notion doesn't well encapsulate how various states are related, nor enforce any level of correctness.

This PR converts accessibilityStates to an object with a specific definition. So, rather than:

<View
...
accessibilityStates={['unchecked']}>

We have:

<View
accessibilityStates={{'checked': false}}>

And specifically define the checked state to either take a boolean or the "mixed" string (to represent mixed checkboxes).

We feel this API is easier to understand an implement, and provides better semantic definition of the states themselves, and how states are related to one another.

## Changelog

[general] [change] - Convert accessibilityStates to an object instead of an array of strings.
Pull Request resolved: https://github.com/facebook/react-native/pull/24608

Differential Revision: D15467980

Pulled By: cpojer

fbshipit-source-id: f0414c0ef6add3f10f7f551d323d82d978754278
2019-05-23 05:37:33 -07:00
Vojtech Novak 04564a0322 allow overriding spannedFromShadowNode in ReactTextInputShadowNode (#24995)
Summary:
Motivation is the same as in https://github.com/facebook/react-native/pull/24927 - when building a custom textinput (eg with rich text editing), one needs custom text processing logic. `ReactTextInputShadowNode` contains 6671165f69/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java (L211)

where an instance of `ReactTextUpdate` is created. For the custom use case, we'd like to just change the usage of [`spannedFromShadowNode()`](6671165f69/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java (L217)) to our own implementation.

from there:
It's easy to subclass `ReactTextInputShadowNode` and override `public void onCollectExtraUpdates()` but the problem is that the method accesses private members. It also means overriding more code than necessary as we only care for `spannedFromShadowNode()`.

Solution might be changing the members to protected, but that seemed weird because there are already setters for them. Creating getters also seemed weird, as we'd end up having unused getters hanging around.

So the second way which I find nicer is changing `protected static Spannable spannedFromShadowNode(ReactBaseTextShadowNode textShadowNode, String text)` to just `protected` since that will allow subclasses to override just this behavior.

## Changelog

[Android] [Added] - allow custom spannedFromShadowNode in ReactTextInputShadowNode subclasses
Pull Request resolved: https://github.com/facebook/react-native/pull/24995

Differential Revision: D15468066

Pulled By: cpojer

fbshipit-source-id: 73d5f0b9e06f3e02a03bf9db5effac62cecc80c4
2019-05-23 05:31:00 -07:00
Eric Lewis 82771f4c62 Remove ToolbarAndroid (#24999)
Summary:
This replaces ToolbarAndroid with a cleaner, but very similar design and paves the path for removing ToolbarAndroid from core.

## Changelog

[Internal] [Removed] - ToolbarAndroid removed from RNTester
Pull Request resolved: https://github.com/facebook/react-native/pull/24999

Differential Revision: D15468053

Pulled By: cpojer

fbshipit-source-id: 21a58558b9ec371689bc994c2d888b81cff01126
2019-05-23 03:39:52 -07:00