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

5775 Коммитов

Автор SHA1 Сообщение Дата
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
Isabel B d3980dceab moved normalizeColor and changed dependencies (#27372)
Summary:
Originally, normalizeColor.js was in Library/Color/ however, I noticed that its tests were in a completely different directly (Library/StyleSheet/__tests__) which was confusing. The other files such as processColor.js, setNormalizedAlphaColor.js had their tests in Library/StyleSheet/__tests__ as well.

## Changelog

[Internal] [Changed] - Moved normalizeColor.js to a more appropriate directory where its tests live.
Pull Request resolved: https://github.com/facebook/react-native/pull/27372

Test Plan: I simply moved a file and changed dependencies. The code should still function as is.

Reviewed By: rickhanlonii, mdvacca

Differential Revision: D18760210

Pulled By: yungsters

fbshipit-source-id: 4c2400acabab35ccbb2533faa5c1d6487c9bf48e
2019-12-03 16:05:22 -08:00
Ramanpreet Nara a6a34ba1d1 Add codegen specs as dependencies of NativeModules
Summary:
## Step 1
I'm going to make every Java NativeModule type-safe and TurboModule-compatible. The first step is to make sure that every type-unsafe NativeModule has a dependency on its spec's codegen target.

## Input
Module -> owner(Module): P123320255
Module -> name(Module): P123320256
Module -> owner(spec(name(Module))): P123320257

### Excluded NativeModules
NativeModules without Specs: P123320644
Java only NativeModules: P123320645

Changelog:
[Internal] - Add buck dependencies for NativeModule specs

Reviewed By: mdvacca

Differential Revision: D18781629

fbshipit-source-id: 89f39017b8224355d9d7b43bf6c162b0957760ee
2019-12-03 15:37:30 -08:00
Kacie Bawiec bde1d63c85 Add getNativeScrollRef to FlatList
Summary:
Add a method to get the underlying host component of `FlatList`. Fix flow types in `FlatList` and `VirtualizedList`. Add test cases to test the behavior of the new function in all cases.

Changelog: [General] [Added] - Add getNativeScrollRef method to FlatList component

Reviewed By: TheSavior

Differential Revision: D18302202

fbshipit-source-id: 7005a2bc1dab207434be3f1f4d8fde0b11b3bb4d
2019-12-03 10:17:15 -08:00
Andy Huang fa9ff07017 Pass disabled prop down to native implementation
Summary:
Changelog:
[iOS] [Fixed] - Slider is now disabled properly on iOS if the disabled prop is set.

Reviewed By: yungsters

Differential Revision: D18758835

fbshipit-source-id: 4850ebf05380f241d49d40107de61fd840049779
2019-12-02 14:21:16 -08:00
Moti Zilberman 60b4ba16c0 Always return 0-based columns from parseErrorStack
Summary:
Fixes a bug where we were skewing some stack traces by sending 1-based column numbers to the Metro symbolication endpoint, which expects them to be 0-based. This is achieved by subtracting 1 from the column numbers we find in textual stack traces, which are almost universally 1-based in current JS engines.

The bug is only noticeable in *some* cases, namely where the column immediately following the correct one is in a different function.

NOTE: The behaviour under Hermes was fixed separately, in a previous commit. This fix applies to other engines (e.g. JSC).

Changelog: [General] [Fixed] - Fix stack traces showing the wrong function name in some cases

Reviewed By: cpojer

Differential Revision: D18628230

fbshipit-source-id: 5677803500e45a41c1005496d19c150526af2d07
2019-12-02 06:02:25 -08:00
Moti Zilberman 75d03b56fa Implement a dedicated Hermes stack trace parser
Summary:
Makes stack trace parsing return a consistent representation of column numbers when using Hermes, whether we're executing bytecode (in prod) or source code (in dev). This is achieved by creating a new full-fidelity stack trace parser for Hermes.

NOTE:  We still use the `stacktrace-parser` package for other engines, so this fix applies only to Hermes and not to JSC - that will be fixed separately in an upcoming diff.

This fixes a bug where we were skewing some stack traces by sending 1-based column numbers to the Metro symbolication endpoint, which expects them to be 0-based. The bug is only noticeable in *some* cases, namely where the column immediately following the correct one is in a different function.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18627930

fbshipit-source-id: abd80846f00f24428670b2c92153564fb4bb2aff
2019-12-02 06:02:25 -08:00
Valentin Shergin 58f69ca504 New delegate method in RCTBackedTextInputDelegate and its implementation
Summary:
This is a more feature-full replacement for `textInputShouldChangeTextInRange:replacementText:` that allows implementing things like limiting text input content length without hacks and compromising the order of events. The new version of the TextInput will rely on that. The existing TextInput will use that as exacly like the previous version (because the new API is a superset of the the old one).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18670792

fbshipit-source-id: 0c434b351dfc8ab42404eb9aea0ede70bedaa9dc
2019-12-01 19:09:49 -08:00
Joshua Gross 7ab5eb4caf AndroidTextInput: support using commands instead of setNativeProps (native change)
Summary:
In AndroidTextInput, support codegen'd ViewCommands in native and add three commands that will eventually replace usage of setNativeProps on Android.

TextInput will use these commands in a future diff.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D18612150

fbshipit-source-id: 5d427040686e8c5ab504dd845bc8ef863f558c35
2019-11-27 12:55:48 -08:00
Rick Hanlon 178f126d83 Parse any babel codeframe error as syntax error
Summary:
## Overview

This diff adds handling for syntax errors created using `buildCodeFrameError` which have a slightly different format than syntax errors thrown during transforms.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D18658502

fbshipit-source-id: 0836f2c16cdd57c10ed1e03dc7345d8e1ccf53f3
2019-11-27 09:25:04 -08:00
Rick Hanlon a64e5bc251 LogBox - Use Modal for full screen inspector
Summary:
This diff switches LogBox over to use a Modal component so that the log inspector is always full screen.

In order to do that, it needed to add an `internal_excludeLogBox` flag to AppContainer so that it's not recursively rendered  as: AppContainer -> LogBox -> Modal -> AppContainer. Not thrilled about the prop but it's necessary for now until this is rendered as it's own root (which we're working on next).

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D18461394

fbshipit-source-id: e1a80dfffbbe6c5467ac6f8d3c445a3280829020
2019-11-27 08:27:31 -08:00
Tim Yung 7bcae81299 RN: Stop Exporting TouchableWithoutFeedback Props
Summary:
Changes `TouchableWithoutFeedback` so that `Props` is no longer exported as a Flow type.

Instead, other modules should use `React.ElementConfig<typeof TouchableWithoutFeedback>`.

Changelog:
[General] [Removed] - TouchableWithoutFeedback no longer exports Props. Use React.ElementConfig, instead.

Reviewed By: zackargyle, TheSavior

Differential Revision: D18718131

fbshipit-source-id: 0bd63123c49564fdab160d5fc8e7f1bf86da1fbe
2019-11-27 07:48:40 -08:00
Tim Yung a516167526 RN: Delete Touchable Injection
Summary:
The experimentation code for `Touchable` is no longer necessary. Clean up all the injection points.

Changelog:
[Internal]

Reviewed By: TheSavior

Differential Revision: D18715851

fbshipit-source-id: 15fe59e218d89f222ae2183a1452718e460048cb
2019-11-27 07:48:40 -08:00
Tim Yung 18d0cba3a9 RN: New `TouchableBounce`
Summary:
Launches a new implementation of `TouchableBounce`.

It is implemented using `Pressability` and extends `React.Component`. Notably, `propTypes` no longer exist.

Changelog:
[Internal]

Reviewed By: TheSavior

Differential Revision: D18715856

fbshipit-source-id: df2300600a8f0f07fc669c1e28183a0ef3a6f695
2019-11-27 07:48:39 -08:00
Tim Yung 7c01172bef RN: New `TouchableHighlight`
Summary:
Launches a new implementation of `TouchableHighlight`.

It is implemented using `Pressability` and extends `React.Component`. Notably, `propTypes` no longer exist.

Changelog:
[General] [Changed] - TouchableHighlight overhauled as a class without propTypes.

Reviewed By: TheSavior

Differential Revision: D18715854

fbshipit-source-id: d4ea6ebd2ca9aef2af93ffad2fe75a96424514e5
2019-11-27 07:48:39 -08:00
Tim Yung 2185dd298a RN: New `TouchableNativeFeedback`
Summary:
Launches a new implementation of `TouchableNativeFeedback`.

It is implemented using `Pressability` and extends `React.Component`. Notably, `propTypes` no longer exist.

Furthermore, `TouchableNativeFeedback` now behaves similar to `TouchableWithoutFeedback` on iOS (instead of rendering an error message).

Changelog:
[General] [Changed] - TouchableNativeFeedback overhauled as a class without propTypes. Also, replaced iOS error renderer.

Reviewed By: TheSavior

Differential Revision: D18715857

fbshipit-source-id: aa42c7547ac94340fde0ef30641cab7eb48ea81b
2019-11-27 07:48:39 -08:00
Tim Yung 88ae24f719 RN: New `TouchableOpacity`
Summary:
Launches a new implementation of `TouchableOpacity`.

It is implemented using `Pressability` and extends `React.Component`. Notably, `propTypes` no longer exist.

Changelog:
[General] [Changed] - TouchableOpacity overhauled as a class without propTypes.

Reviewed By: TheSavior

Differential Revision: D18715858

fbshipit-source-id: 06ba5fc7eaacdbb7dc12d1564cc5d04e1a991229
2019-11-27 07:48:38 -08:00
Tim Yung ebf7d75816 RN: New `TouchableWithoutFeedback`
Summary:
Launches a new implementation of `TouchableWithoutFeedback`.

It is implemented using `Pressability` and extends `React.Component`. Notably, `propTypes` no longer exist.

Changelog:
[General] [Changed] - TouchableWithoutFeedback overhauled as a class without propTypes.

Reviewed By: TheSavior

Differential Revision: D18715852

fbshipit-source-id: f2eb28e3b8500bfcd8db44fc6bdbc0476193723a
2019-11-27 07:48:38 -08:00
Tim Yung c5cc181c7e RN: Open Source `Pressability`
Summary:
Makes `Pressability` available the open source `react-native` repository.

This abstraction is intended to replace `Touchable.Mixin` and enable us to finally stop depending on `createReactClass` (et al).

Changelog:
[Internal]

Reviewed By: TheSavior

Differential Revision: D18715853

fbshipit-source-id: 21af8652cfb4557c60babd31b2776bcaeaed8447
2019-11-27 07:48:38 -08:00
Sharon Gong 8c0c860e38 Add missing accessibility props to Touchables (#27293)
Summary:
The following accessibility properties was added for view but not for Touchables - importantForAccessibility, accessibilityLiveRegion, accessibilityViewIsModal and accessibilityElementsHidden. This PR is to extend the support for all touchables.

## Changelog

[General] [Added] - Add missing accessibility props on Touchables
Pull Request resolved: https://github.com/facebook/react-native/pull/27293

Test Plan: Tested in RNTester app.

Differential Revision: D18650884

Pulled By: yungsters

fbshipit-source-id: 2172ac55a8c8803d7d923511f43b2598593ea1d2
2019-11-23 10:28:07 -08:00
Tim Yung b7ab922bb3 RN: Console Stub Parity
Summary:
Brings parity to the non-`__DEV__` stub polyfill for `console`.

Changelog:
[General][Added] - Added missing `console` polyfills in release builds.

Reviewed By: ejanzer, RSNara

Differential Revision: D18667335

fbshipit-source-id: 0307d04a136e5f7bb914f18b80441b7a7fae5e5b
2019-11-23 07:22:44 -08:00
Valentin Shergin ac3c167ead Moving some workarounds and fixes from RCTMultilineTextInputView to RCTUITextView
Summary:
The class `RCTUITextView` is designed to be a home for workarounds. In Fabric we will use it as well, so we need to have all workarounds there.
That's just a move of some code between clases, it does not really affect how the workarounds work.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18607833

fbshipit-source-id: 1ba0e8c5cd928f3bf6fe1d2727325ecfc1dbf684
2019-11-22 22:25:07 -08:00
Janic Duplessis 5798cf2aa9 Remove requestAnimationFrame when focusing input on mount (#27217)
Summary:
When using `react-native-screen` which uses native view controller animations for navigation `TextInput` with `autoFocus` causes a weird animation glitch.

Removing the requestAnimationFrame will cause the focus command to be sent in the same batch as starting screen transitions which fixes the issue.

It is unclear why the rAF was added in the first place as it was part of the initial RN open source commit. If someone at facebook has more context that would be great to make sure it doesn't cause unintended side effects.

Credits to kmagiera for figuring out this

## Changelog

[General] [Fixed] - Remove requestAnimationFrame when focusing input on mount
Pull Request resolved: https://github.com/facebook/react-native/pull/27217

Test Plan:
- Tested in an app using react-native-screen to make sure the animation glitch is fixed
- Tested in RNTester to make sure it doesn't cause other issues when not using react-native-screens

Before:

![1](https://user-images.githubusercontent.com/2677334/68799447-2ce5c100-0626-11ea-8310-a9ac9e9419b6.gif)

After:

![2](https://user-images.githubusercontent.com/2677334/68799450-2fe0b180-0626-11ea-865f-ef88f7307831.gif)

Differential Revision: D18666991

Pulled By: TheSavior

fbshipit-source-id: 66664c89e06c9ae65074ddcc4688dc5109fc9c72
2019-11-22 16:13:57 -08:00
Christoph Nakazawa 03766d6a08 Remove unnecessary whitespace from code frames
Summary:
This removes common whitespace from a code frame to show more code. This is especially useful for heavily intended code that may not even be visible in the small window.

I am not 100% confident I wrote the right code because I'm under time pressure but it seems to work. I'm an intern and it's my last day.

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: rickhanlonii

Differential Revision: D18657572

fbshipit-source-id: 6b93999c4482891f2123d67005843ce5db0d2976
2019-11-22 09:09:10 -08:00
Christoph Nakazawa 89be2d00ea Remove the vertical bar next to the code frame
Summary:
This vertical bar doesn't really add any value. This diff removes it. At first I tried to use regex but ansi codes make that hard. We can just use the structured data and rely on the fact that the second item is always the one with the vertical bar.

(Note: this ignores all push blocking failures!)

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D18656911

fbshipit-source-id: b72d4c93d0008c7da54647d072a4c4eb7646b694
2019-11-22 09:09:09 -08:00
Christoph Nakazawa 16e72ad370 Syntax highlighting for LogBox Code Frames
Summary:
This diff adds syntax highlighting to LogBox CodeFrames. It works by turning Ansi codes into "JSON" (it's actually just a JS object but the third-party API uses JSON as terminology) and then turning that into `<Text>` elements.

The syntax theme is called Afterglow and I took it from https://iterm2colorschemes.com/. Happy for anyone who wants to further tweak it! I installed this into iTerm and extracted the colors from there as it has a color picker and the labels directly map to the color classes exposed by the `anser` package.

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: rickhanlonii

Differential Revision: D18618897

fbshipit-source-id: 64815619fc482e08b5671f492dabda8c8c0ceca5
2019-11-22 09:09:09 -08:00
Rick Hanlon 4ad5d1c473 LogBox - Clear selectedIndex when logs are cleared
Summary:
This diff fixes an exception thrown when using fast refresh when a log is opened.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D18656859

fbshipit-source-id: 707f71f627daa172a4f9e02e3ff5d05b6174eb63
2019-11-22 05:49:54 -08:00
Rick Hanlon 0d994df04d LogBox - Add ReferenceError to transform error regex
Summary:
Adds handling for reference errors so when we throw them in the next diff they're handled as syntax errors.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18644642

fbshipit-source-id: 2b751578c616c27d5b1ec6255aca56063bfd9d16
2019-11-22 04:24:17 -08:00
Eli White 390d0895ba Back out "Revert D18626496: Partial React Sync from 6cff70a74...bb1853f73"
Summary:
Original commit changeset: d982163fe3f5

Landing the original but with the feature flag disabled. *doh*

Changelog:
[General][Changed] Partial React Sync from 6cff70a74...bb1853f73

Reviewed By: mdvacca

Differential Revision: D18649739

fbshipit-source-id: c9a15f511595fe0ae76dd49db7a7097d1bfa3853
2019-11-21 18:11:30 -08:00
Eli White 821166c111 Revert D18626496: Partial React Sync from 6cff70a74...bb1853f73
Differential Revision:
D18626496

Original commit changeset: c8fc6551bf2b

fbshipit-source-id: d982163fe3f5bed6d26cdbf1dc080c1ac7b6889d
2019-11-21 16:05:15 -08:00
Eli White dff490d140 Convert TextInput to Hooks
Summary:
Modernizing this code a bit more, converting it to hooks.

Changelog:
[General][Changed] Converted TextInput to use React hooks
[General][Fixed] TextInput now properly sends native the end selection location on change

(Note: this ignores all push blocking failures!)

Reviewed By: JoshuaGross

Differential Revision: D18581712

fbshipit-source-id: 62d6ea8489fa019ddf941c520930365f2c4887d8
2019-11-21 12:41:52 -08:00
George Zahariev 8553e1acc4 Exact-by-default codemod for react-native-github
Summary:
We are rolling out exact-by-default syntax to xplat/js.

I had to manually move around some comments to preserve proper placement.

Changelog: [Internal]

Reviewed By: jbrown215

Differential Revision: D18633611

fbshipit-source-id: 48f7468dcc55b1d00985419d035a61c6820b3abe
2019-11-21 09:42:57 -08:00
Ramanpreet Nara 1ad0862363 Revert D16969764: Make RCTDevLoadingView TurboModule-compatible
Differential Revision:
D16969764

Original commit changeset: 47e6682eea3f

fbshipit-source-id: d95b76eb8e57bbaff840b3d85f3745b13d622ce0
2019-11-21 08:43:12 -08:00
Rick Hanlon 93b892cac6 Don't allow pressing on un-symbolicated stackframes (reland)
Summary:
Re-land [RN DevX] Don't allow pressing on un-symbolicated stackframes

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D18628349

fbshipit-source-id: 22d6b931b0ad09976b80aa6b90f10bffa6a4a46c
2019-11-21 06:16:42 -08:00
Lucy Beatriz Gomez a7233e45a4 Fixing RN Picker
Summary:
Changelog: [Internal]

Fixing a red screen on the RN picker.
Looks like the picker gets confused when  for unknown reasons a native value is undefined. In that case we stick to the JS value as it is specified in the comment.
https://fb.workplace.com/groups/rn.support/permalink/2997783536936908/

NOTE : Native fix was landed, this add an extra layer on the JS side

Reviewed By: mmmulani

Differential Revision: D18443005

fbshipit-source-id: 9511ac90f2d9e6186c6c0de3b673cc535cdb9fa6
2019-11-20 20:16:13 -08:00
Eli White 222a0895d9 Partial React Sync from 6cff70a74...bb1853f73
Summary:
This sync includes these changes:

- **[bb1853f73](https://github.com/facebook/react/commit/bb1853f73 )**: [Native] If statement cleanup for null targets (#17346) //<Eli White>//
- **[a9d9fc7bb](https://github.com/facebook/react/commit/a9d9fc7bb )**: [Native] Add FeatureFlag to dispatch events with instance currentTarget (#17345) //<Eli White>//
- **[731456a12](https://github.com/facebook/react/commit/731456a12 )**: [Native] Add FeatureFlag to dispatch events with instance targets (#17323) //<Eli White>//
- **[9d5363820](https://github.com/facebook/react/commit/9d5363820 )**: Change legacy-events plugin nativeEventTarget to allow null (#17344) //<Eli White>//

Changelog:
[General][Changed] Partial React Sync from 6cff70a74...bb1853f73

Reviewed By: mdvacca

Differential Revision: D18626496

fbshipit-source-id: c8fc6551bf2b37ce27d4e9dbc7fe3455dfa08af9
2019-11-20 18:13:18 -08:00
Eli White 7813e24cdb Remove unused _focusSubscription
Summary:
This variable is never set and only ever removed

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D18537317

fbshipit-source-id: bbb084e2ea5408fc59ef3853b2ec74bf22afbe21
2019-11-20 18:09:30 -08:00
Eli White e483bd4d49 Add Jest snapshot tests to TextInput
Summary:
$title

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D18536359

fbshipit-source-id: 382c81c094c0ae28ec3e203cb0726bdbccf755dc
2019-11-20 18:09:30 -08:00
Eli White 20a3bb52ce Convert component snapshot tests to a reusable helper
Summary:
These tests need to be consistent with every test so a helper makes more sense.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18500439

fbshipit-source-id: de535156d370102bad88e556ad3d2a0d5443e4e2
2019-11-20 18:09:30 -08:00
Eli White 9b53f52236 Revert D18577288: Don't allow pressing on un-symbolicated stackframes
Differential Revision:
D18577288

Original commit changeset: 6de322b47558

fbshipit-source-id: 095766e07a43008abf5fc6adb0f46bb08fc420a0
2019-11-20 15:51:06 -08:00
Christoph Nakazawa 1e0e9582ab Improve rendering perf of LogBoxInspectorStackFrame
Summary:
LogBox tends to take a bit of time to open after tapping a log banner. This is very noticeable on Android where it takes multiple seconds.

When looking at React DevTools, the Stack Frame code can be responsible for two thirds of total LogBox rendering time. With this diff, the time is reduced from about 46ms to 25ms, and the total time spent rendering LogBox is reduced by one third.

This diff makes a few micro-optimizations but primarily it gets rid of an unnecessary View and collapses multiple text components into a single one as they are all rendered the same. Note that this also fixes an issue in the case where a line number may be missing but a column was provided. While I can't think of a case where that would actually happen, previously it would print the column (which could be mistaken for the lineNumber in that case) but now it prints the column only if the line Number is also present.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18613899

fbshipit-source-id: 5c6a3b65b749d5f95058b34ded6cc12531d91c38
2019-11-20 11:24:15 -08:00
Ramanpreet Nara 294e31b7c2 Make RCTDevLoadingView TurboModule-compatible
Summary:
RCTDevLoadingView wasn't hooked up to the codegen. This diff makes RCTDevLoadingView type-safe and also makes it TurboModule-compatible.

Changelog:
[iOS][Added] - Make RCTDevLoadingView TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D16969764

fbshipit-source-id: 47e6682eea3fc49d3f0448c636b5f616d5bce220
2019-11-20 11:20:12 -08:00
Rick Hanlon 55cb6ab07c Don't allow pressing on un-symbolicated stackframes
Summary:
This diff makes a few improvements to the call stack / symbolication process:

- Removes button from unsymbolicated stack frames
- Adds a warning message for missing features without symbolication
- Reduces symbolication requests (we were re-requesting stacks when they were pending)
- Speeds up opening unsymbolicated logs (because we were re-requesting them, the components were updating a lot)

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D18577288

fbshipit-source-id: 6de322b4755895e2d1599b06100a61e64f7ec023
2019-11-20 11:05:20 -08:00
Rick Hanlon bdd1a675ba Dismiss all logs on fast refresh
Summary:
Based on feedback we're going to clear all logs on fast refresh 👍

Changelog: [Internal]

Reviewed By: gaearon

Differential Revision: D18614230

fbshipit-source-id: 119a09e8ffea9d86137583d8da435338833f910c
2019-11-20 08:50:49 -08:00
Stepan Furdei 25a21b8e49 Don't crash when pretty-format is not available
Summary:
pretty-format library is not available on some JSC which causes the app to crash while trying to log a warning. This change defaults to just stringify the error if formatter is not available. The behavior on platforms where it already works fine isn't changed.

Changelog: Don't crash the app while formatting a warning for console if pretty-format is not available.

Reviewed By: PeteTheHeat

Differential Revision: D18403456

fbshipit-source-id: 73226f1a4e3f38c8d7c4e5ace909dd494e1da298
2019-11-19 16:22:29 -08:00
Jordan Brown 48cb80892d Manually fix places the codemod doesnt hit
Summary:
Generating this diff was difficult. We _will_ fix the issues with jscodeshift, but i don't want to block the syntax change on that.

To get this diff, I first codemodded all of xplat to use exact-by-default. Then i turned on implicit-inexact-object:error enforcement to get a list of errors showing places that violated the lint. With that, I used this to generate a list of `sed` commands to add `...`:

```
flow --json | jq '.errors | .[] | .message | .[] | .loc | {source, "line": .end."line", "column": .end."column"} | "\(.column),\(.line),\(.source)"' | sort -n -r | sed 's/"//g' | while read -r line; do echo $line; awk -F',' "{ print \"sed -i '\"\$2\"s/./...&/\"\$1\"' \" \$3 }"; done
```

Then I ran prettier, reverted generated files, and manually fixed up suppressions that got messed up.

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D18516431

fbshipit-source-id: 6cf940dce411fb179e7ebaff764bd5113a07989f
2019-11-19 13:38:18 -08:00
Samuel Susla 2d80a248cd Migrate RefreshControl to Native Commands
Summary:
Changelog: [Internal]

Introduce native command `setNativeRefreshing`, it has the word Native in order to avoid name conflict with setRefreshing in Android implementation. Even this component is iOS only, it would make it easier to merge them in the future.

Introduce `RCTRefreshableProtocol` and make `RCTRefreshControl` and `RCTPullToRefreshViewComponentView` to conform to the protocol so view manager can forward command to both, Paper and Fabric component.

Reviewed By: mmmulani

Differential Revision: D18475804

fbshipit-source-id: 4c19225784efc931b7b8f2d2671cc839bce429bf
2019-11-19 10:06:56 -08:00
Rick Hanlon 6db52c5fe0 LogBox - Add app version and move meta info
Summary:
This diff adds a new API `setAppInfo` to add app version and engine to LogBox and changes the way they're displayed so that they're more subtle and visible for screenshots.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18592992

fbshipit-source-id: 1c57b21fa9dca93029ffc92acf1287f3ee247f4d
2019-11-19 09:36:28 -08:00
Dan Abramov 1edce56a9d React Native sync for revisions 4eeee35...6cff70a
Summary:
Changelog: [General][Changed] - React sync for revisions 0b61e2698...6cff70a74 (Includes React 16.11.0)

This sync includes the following changes:
- **[6cff70a74](https://github.com/facebook/react/commit/6cff70a74 )**: [react-interactions]
Expost host instance to Scope Query function (#17341) //<Dominic Gannaway>//
- **[b8f825877](https://github.com/facebook/react/commit/b8f825877 )**: Split ReactDOM entry
point (#17331) //<Dan Abramov>//
- **[a7b4d51a2](https://github.com/facebook/react/commit/a7b4d51a2 )**: Warn when doing creat
eRoot twice on the same node (another approach) (#17329) //<Dan Abramov>//
- **[be3bfa6fa](https://github.com/facebook/react/commit/be3bfa6fa )**: [Flight] Basic Integr
ation Test (#17307) //<Dan Abramov>//
- **[6cb6b1d66](https://github.com/facebook/react/commit/6cb6b1d66 )**: Add yarn build --unsa
fe-partial (#17316) //<Dan Abramov>//
- **[38dd17ab9](https://github.com/facebook/react/commit/38dd17ab9 )**: [RN] Hoist static dee
pDiffer options object (#17303) //<Moti Zilberman>//
- **[61d3dd0e0](https://github.com/facebook/react/commit/61d3dd0e0 )**: Update deepDiffer usa
ge in React Native renderer (#17282) //<Moti Zilberman>//
- **[e701632ad](https://github.com/facebook/react/commit/e701632ad )**: [react-interactions] Change unmount blur logic to a dedicated event (#17291) //<Dominic Gannaway>//
- **[ce4b3e998](https://github.com/facebook/react/commit/ce4b3e998 )**: [react-interactions] Add optional searchNodes to Scope.queryAllNodes (#17293) //<Dominic Gannaway>//
- **[dee03049f](https://github.com/facebook/react/commit/dee03049f )**: [Flight] Basic Streaming Suspense Support (#17285) //<Sebastian Markbåge>//
- **[f50f39b55](https://github.com/facebook/react/commit/f50f39b55 )**: [Flight] Better compat with http.createServer (#17289) //<Dan Abramov>//
- **[345270630](https://github.com/facebook/react/commit/345270630 )**: DevTools cleanup (#17283) //<Brian Vaughn>//
- **[cd1bdcd06](https://github.com/facebook/react/commit/cd1bdcd06 )**: [react-interactions] Prevent duplicate onPress firing for keyboard Enter (#17266) //<Dominic Gannaway>//
- **[4f02c93c7](https://github.com/facebook/react/commit/4f02c93c7 )**: Fix devtools displaying Anonymous for memo of ref-forwarding components (#17274) //<Waseem Dahman>//
- **[053cf0fed](https://github.com/facebook/react/commit/053cf0fed )**: Fix react-is memo and lazy type checks (#17278) //<Brian Vaughn>//
- **[0f3838a01](https://github.com/facebook/react/commit/0f3838a01 )**: Remove `debugRenderPhaseSideEffects` flag (#17270) //<Andrew Clark>//
- **[cb09dbe0a](https://github.com/facebook/react/commit/cb09dbe0a )**: [react-interactions] Add handleSimulateChildBlur upon DOM node removal (#17225) //<Dominic Gannaway>//
- **[6095993d4](https://github.com/facebook/react/commit/6095993d4 )**: Types: findHostInstance_DEPRECATED returns React.ElementRef<HostComponent<mixed>> (#17265) //<Eli White>//
- **[62ef25077](https://github.com/facebook/react/commit/62ef25077 )**: Avoid bundling in ponyfill for Object.assign in use-subscription package (#17259) //<Mateusz Burzyński>//
- **[f4148b256](https://github.com/facebook/react/commit/f4148b256 )**: [Flight] Move around the Server side a bit (#17251) //<Sebastian Markbåge>//
- **[fadc97167](https://github.com/facebook/react/commit/fadc97167 )**: [Flight] Add Client Infrastructure (#17234) //<Sebastian Markbåge>//
- **[36fd29f09](https://github.com/facebook/react/commit/36fd29f09 )**: Don't show empty (no work) commits in Profiler (#17253) //<Brian Vaughn>//
- **[a2e05b6c1](https://github.com/facebook/react/commit/a2e05b6c1 )**: [Scheduler] Delete old rAF implementation (#17252) //<Andrew Clark>//
- **[6dc2734b4](https://github.com/facebook/react/commit/6dc2734b4 )**: Codemod tests to `it.experimental` (#17243) //<Andrew Clark>//
- **[273679a78](https://github.com/facebook/react/commit/273679a78 )**: DevTools standalone shell changes: (#17213) //<Brian Vaughn>//
- **[d0fc0ba0a](https://github.com/facebook/react/commit/d0fc0ba0a )**: Revert "Dispatch commands to both UIManagers from both renderers (#17211)" (#17232) //<Eli White>//
- **[bdcdb69a2](https://github.com/facebook/react/commit/bdcdb69a2 )**: Rename findHostInstance_deprecated to findHostInstance_DEPRECATED (#17228) //<Eli White>//
- **[515746c21](https://github.com/facebook/react/commit/515746c21 )**: Add findHostInstance_deprecated to the React Native Renderer (#17224) //<Eli White>//
- **[9a35adc96](https://github.com/facebook/react/commit/9a35adc96 )**: Only call Profiler onRender when a descendant had work (#17223) //<Brian Vaughn>//
- **[8eee0eb01](https://github.com/facebook/react/commit/8eee0eb01 )**: Dispatch commands to both UIManagers from both renderers (#17211) //<Eli White>//
- **[f4e974d26](https://github.com/facebook/react/commit/f4e974d26 )**: Add Experimental Flight Infrastructure (#16398) //<Sebastian Markbåge>//
- **[6cd365cac](https://github.com/facebook/react/commit/6cd365cac )**: Don't treat the last row in hidden as deleted if already mounted (#17206) //<Sebastian Markbåge>//
- **[048879eda](https://github.com/facebook/react/commit/048879eda )**: [react-interactions] Ensure props on scope query function is always object (#17212) //<Dominic Gannaway>//
- **[3497ccc14](https://github.com/facebook/react/commit/3497ccc14 )**: Add guard to handle modified React elements with non-string keys (#17164) //<Brian Vaughn>//
- **[3f9c03675](https://github.com/facebook/react/commit/3f9c03675 )**: Typo fix in comment (#17111) //<Deniz Susman>//
- **[f6b8d31a7](https://github.com/facebook/react/commit/f6b8d31a7 )**: Rename createSyncRoot to createBlockingRoot (#17165) //<Dan Abramov>//
- **[9c02d2654](https://github.com/facebook/react/commit/9c02d2654 )**: docs: Fixed a typo in readme.md (#17119) //<Wilco Fiers>//
- **[8075c8505](https://github.com/facebook/react/commit/8075c8505 )**: Update local package versions for 16.10 release //<Andrew Clark>//
- **[5faf377df](https://github.com/facebook/react/commit/5faf377df )**: Fixed a style bug in props editor (#17162) //<Brian Vaughn>//
- **[f7ec65eeb](https://github.com/facebook/react/commit/f7ec65eeb )**: [react-interactions] Make events non-passive to allow preventDefault (#17136) //<Dominic Gannaway>//
- **[1022ee0ec](https://github.com/facebook/react/commit/1022ee0ec )**: Read current time without marking event start time (#17160) //<Andrew Clark>//
- **[349cf5acc](https://github.com/facebook/react/commit/349cf5acc )**: Experimental test helper: `it.experimental` (#17149) //<Andrew Clark>//
- **[edc234c73](https://github.com/facebook/react/commit/edc234c73 )**: Build script should default to experimental (#17144) //<Andrew Clark>//
- **[3cc564547](https://github.com/facebook/react/commit/3cc564547 )**: SuspenseList support in DevTools (#17145) //<Sebastian Markbåge>//
- **[68fb58029](https://github.com/facebook/react/commit/68fb58029 )**: Remove unstable_ prefix in various internal uses (#17146) //<Sebastian Markbåge>//
- **[7082d5a2d](https://github.com/facebook/react/commit/7082d5a2d )**: Don't build non-experimental www bundles (#17139) //<Andrew Clark>//
- **[c47f59331](https://github.com/facebook/react/commit/c47f59331 )**: Move SuspenseList to experimental package (#17130) //<Andrew Clark>//
- **[685ed561f](https://github.com/facebook/react/commit/685ed561f )**: Migrate useDeferredValue and useTransition (#17058) //<Luna Ruan>//
- **[0b61e2698](https://github.com/facebook/react/commit/0b61e2698 )**: Update RN typings for a shim (#17138) //<Dan Abramov>//

Reviewed By: threepointone

Differential Revision: D18428149

fbshipit-source-id: 28273be4d7a4c7ec0fe0451cea134ee09a3b4d86
2019-11-19 08:52:37 -08:00
Valentin Shergin 3f7e0a2c96 Removing <TextInput>'s `onTextInput` event
Summary:
This is the first diff in the series. It removes Flow types for this feature to verify that we actually do not have any usages. After it lands, we will remove actual support on the native side.

There are several reasons why removing it is a good idea:
* There is no any evidence that this feature is actually useful. That was discussed several times (e.g. see T7936714) during RN lifetime and the overall consensus is: We need something else, something like sync `onChange` event instead of it.
* Supporting the previous point, it's not used (at least inside Facebook). I searched hard and I could find only one place where it's used: in the TextInput Example.
* To deliver more functionality we should lean towards W3C specs, this one is not W3C compliant.
* Supporting this Feature in Fabric is quite challenging, so I want to do it sooner than later.
* This feature was never documented.

Changelog: [Breaking] `<TextInput>::onTextInput` event was removed

Reviewed By: TheSavior

Differential Revision: D18456175

fbshipit-source-id: c7a8ed7a86b33ecc01d45497645fe249556fdf96
2019-11-18 20:53:35 -08:00
Emily Janzer e22a27fb9b Use JS view configs for Image
Summary:
There was already a ImageViewNativeComponent used on Android, so I changed `Image.ios.js` to use it as well, and then switched that component to use `codegenNativeComponent` instead of `requireNativeComponent` so that it gets the view config from JS instead of the UIManager.

I'm gating this change behind `RN$Bridgeless` so this only affects bridgeless mode.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18575533

fbshipit-source-id: aa71beb6be65dbb48ad2e1ca748f2cccd72a0e73
2019-11-18 18:37:37 -08:00
Emily Janzer 719d52fb6b Remove unused import from ScrollViewViewConfig
Summary:
As titled

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18575837

fbshipit-source-id: 02e0b126bb783119f78e1eca82ee9fe9980529bc
2019-11-18 18:08:11 -08:00
Rick Hanlon b346970016 LogBox - Minor error message formatting fixes
Summary:
Adds better handling of component stacks for warnings and clarifies why we ignore `(ADVICE)` warnings.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18575693

fbshipit-source-id: f4eacbf74c62cd079f2c441951849fb03e0941dd
2019-11-18 13:47:42 -08:00
Moti Zilberman ca3c8b7a7d Treat NSNull like nil in RCTBridgingToOptional{Bool,Double}
Summary:
Currently `RCTBridgingToOptionalBool` and `RCTBridgingToOptionalDouble` will crash if passed an `NSNull` value. This diff changes these functions to instead treat it as equivalent to a missing value.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D18532044

fbshipit-source-id: fa822dcacb49697dd8a4f7b579bcfc029e0cdf41
2019-11-18 07:04:46 -08:00
Moti Zilberman 75a154b449 Use timer type as Systrace identifier
Summary:
Removes the use of `parseErrorStack` in `_allocateCallback`, which was used to determine which timer API was allocating the callback (for Systrace purposes). Instead, we now use the already-existing `type` argument, which achieves the exact same thing but is much faster than parsing the stack trace.

Changelog: [General] [Fixed] - Reduce overhead of setting up timers in DEV

Reviewed By: yinghuitan

Differential Revision: D18233182

fbshipit-source-id: 190c0ffad8734cd889b790248e5a77cfb147454b
2019-11-18 05:16:49 -08:00
Kevin Gozali bae5aea074 iOS: Pass image react tag to the image loader for attribution purpose
Summary:
Changelog: [Internal]

For image loading, the loader may need to inspect the imageView itself, so let's pass its reactTag. This only works pre-Fabric.

Reviewed By: sammy-SC

Differential Revision: D18522073

fbshipit-source-id: 400fc7e04b8d7852f6ecef941dd446fbff423c88
2019-11-16 00:13:48 -08:00
Kevin Gozali 446705df33 iOS: attach rootTag to the native component instance for easy access
Summary:
Changelog: [Internal]

The main use-case here is to get the rootTag off RCTImageView, for image loading instrumentation. The fact is, each RCTView subclass already has `reactTag` attached today. We already have the `rootTag` when the view is created by the UIManager, so why not just attach it like reactTag? If we don't, looking up the rootTag from the native component is non-trivial and extremely inefficient (have to jump to shadow queue, back to main queue, etc).

Reviewed By: sammy-SC

Differential Revision: D18497002

fbshipit-source-id: 8409e3a1c95e09accedd959592cbf178fab0b2c3
2019-11-16 00:13:48 -08:00
Kevin Gozali fdcdca4cfa iOS: Introduced RCTImageURLLoaderWithAttribution
Summary:
Changelog: [iOS] [Changed] - New internal image attribution support, but files importing RCTImageLoader.h must be converted to ObjC++

This new interface is the same as RCTImageURLLoader, but with additional support to pass in optional attribution information. The attribution info is not strictly defined (we may do so in the future though), and it's up to the hosting application and RCTImageURLLoader classes to handle it.

Reviewed By: sammy-SC

Differential Revision: D18492882

fbshipit-source-id: c3870c60e6c2e7c65758fc3235ebf5db369e07dc
2019-11-16 00:13:47 -08:00
Eli White bbc5c35a61 Convert to using forwardRef
Summary:
TextInput now acts as a host component and can be passed directly to our new APIs that require a host component. Callsites no longer need to call

```
inputRef.getNativeRef()
```

We mutate the ref to the host component adding the imperative methods of the TextInput so you can still call `inputRef.clear` and `inputRef.isFocused`.

Changelog:
[General][Changed] TextInput now uses `forwardRef` allowing it to be used directly by new APIs requiring a host component.

Reviewed By: yungsters

Differential Revision: D18458408

fbshipit-source-id: 1f149fd575210d702fa0fdf3d05bb2162436a773
2019-11-15 14:02:42 -08:00
Eli White 99dc4e204e Become compatible with Flow's TypesFirst
Summary:
When the TextInput class is exported directly Flow complains about some definitions because they don't properly define the export type. This change adds those types but still doesn't export the TextInput directly as there are more things that still need to get fixed.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D18444096

fbshipit-source-id: 18c88bbf1de5504f350681a71ea21d7e41876e49
2019-11-15 14:02:42 -08:00
Eli White 8f601418ab Convert TextInput from NativeMethodsMixin to ES6 Class
Summary:
In order to make this more flow typed and modern we need to get it off of createReactClass. This change converts the class as is with no intended behavior changes to an ES6 class.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D18443018

fbshipit-source-id: 831921976e9de8e965180cdefd1c4a154f04bfea
2019-11-15 14:02:41 -08:00
Eli White ce314ba097 Inline NativeMethodsMixin
Summary:
We need to get rid of NativeMethodsMixin. Normally we'd use forwardRef to the HostComponent, however we can't do this here because TextInput has its own imperative methods. I want to refactor this into a class and after that will revisit how to get rid of these methods.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D18436162

fbshipit-source-id: 0c81fa8b31b3248cbab8680ff680dd09c61c76e2
2019-11-15 14:02:41 -08:00
Eli White ca78497f73 Reorder methods
Summary:
Reordering the methds in TextInput to be a bit more consistent.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D18435732

fbshipit-source-id: 05a1d9d2c70a4b5fa00a3dc6be0520a216a24106
2019-11-15 14:02:41 -08:00
Eli White c70a093dd2 Refactor props, sort
Summary:
Sorting these props to be consistent

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D18435730

fbshipit-source-id: 259c6902bdaa3a7d4c7bdf8768d7f42191d5398b
2019-11-15 14:02:40 -08:00
Eli White b7bd85a2bf Refactor to not copy props
Summary:
We don't need a local mutable copy of props.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D18435731

fbshipit-source-id: 13ec1a78ca26b1372a4aed484a821204a93b6437
2019-11-15 14:02:40 -08:00
Eli White 854fa96cae Factor out TouchableWithoutFeedback
Summary:
The TouchableWithoutFeedback is almost exactly the same between both branches.

The responderReject prop was added in https://github.com/facebook/react-native/pull/16755.
The PR seems to say that it is the default behavior on Android. I don't want to make risky changes in this refactor so I'm not doing anything special about that prop for now.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D18435733

fbshipit-source-id: 372d17d8e67884930409a6a863757944cec4737e
2019-11-15 14:02:40 -08:00
Eli White eef7de6c6d TextInput merge _renderIOS and _renderAndroid methods
Summary:
These functions are quite similar and I'm going to refactor out the shared pieces. To make it easy to review this change just inlines those two functions with no other changes.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D18435734

fbshipit-source-id: 826f510359358427856993b536d41054ddf8c792
2019-11-15 14:02:39 -08:00
Rick Hanlon e9fd102c33 Remove "reload to reconnect" from the metro disconnected message
Summary:
Changes the Fast Refresh message for when metro disconnects to remove "Reload to reconnect.". The most common use case for this happening is when Metro is stopped, and reloading will not reconnect to a stopped metro server.

Long term we should reconnect to Metro automatically and then this message would be followed up with a "Reconnected to Metro" message, never needing a reload.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18527705

fbshipit-source-id: 40768ce1089348b612e9d86638f07169d2a34b67
2019-11-15 06:18:30 -08:00
Rick Hanlon 9c4afce70f LogBox - Move and improve 'see more' button
Summary:
Feedback from multiple people has been that the "see more" is hard to discover and that it should be at the bottom left, so this diff moves it there.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18487041

fbshipit-source-id: 1543c54e1de5fa16fa5b2e427812b6e72977bfb2
2019-11-15 06:11:08 -08:00
Rick Hanlon c54f5cf72a LogBox - Only dismiss syntax errors when the issue is fixed
Summary:
This change is not only more correct, it's also fixes the modal in the the next diff.

It's more accurate because in the previous location, the redbox dismissal was done as a hack in order to hide non-syntax errors so that the syntax error would be visible when it fired. This is unnecessary for LogBox because it always puts syntax errors on top of any other error.

The main motivation for changing this, however, is that this strategy is broken when switching to the Modal component because the Modal component does not work well with quickly unmounting and remounting. With the old strategy, the inspector would flicker and then collapse even though there was a syntax error.

Changelog: [Internal]

Reviewed By: cpojer, gaearon

Differential Revision: D18461431

fbshipit-source-id: e8ed83e3d2b002e5d45cc13dc9533ed841ed5cae
2019-11-14 12:06:35 -08:00
Rick Hanlon 32eb05ebea LogBox - Add temporary default error boundary for logbox
Summary:
Fixes an issue where unhandled exceptions would unmount the app and LogBox, hiding the exception and leaving the user stuck. This is a temporary solution until we either decide to provide an error boundary by default or move this to a separate root.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18504346

fbshipit-source-id: 4bca8693e63c367bf3070f12606a50824aa4cc23
2019-11-14 11:14:12 -08:00
Rick Hanlon 63b534a745 LogBox - Improve stack frame pressables and counts
Summary:
This diff makes number of improvements to stack frames:

- Adds padding around stack frame pressables
- Fixed wrapping for the closing bracket on component stacks
- Adds passing around "see more" buttons
- Fixed the count for "Show x more frames" when it's 0 and otherwise
- Add more cases for the count text
- Switches button back to minimize (snuck this in here)

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18495331

fbshipit-source-id: 8b9efa88c4205b23e734893d8db6deccce88344c
2019-11-14 04:48:55 -08:00
Rick Hanlon a0d2cd3d13 LogBox - Fix message content rendering in notifications
Summary:
Strips "Error: " and "Warning: " from the log notification.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18491963

fbshipit-source-id: 7c9d18638eee442d521a9aa2135ce6891c673cbe
2019-11-14 04:43:27 -08:00
Rick Hanlon ab751f5c45 LogBox - Add ReactNativeWarningFilter
Summary: Changelog: [Internal]

Differential Revision: D18492212

fbshipit-source-id: 81234c532cdcc8935a0c532950398bc84aa6d4d1
2019-11-13 18:29:47 -08:00
Valentin Shergin d5ec68f841 A workaround for RCTUITextField::secureTextEntry was moved to RCTUITextField
Summary:
The moved code fragment is a workaround for a bug in UITextField in iOS 8. There is no need to have this code in a general base class that serves both UITextField- and UITextView-based components. Especially for such workarounds like that, we have a dedicated class RCTUITextField. This diff moves that there.

Read more about the bug:
https://stackoverflow.com/questions/14220187/uitextfield-has-trailing-whitespace-after-securetextentry-toggle/22537788#22537788

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D18444734

fbshipit-source-id: a3764c19f562231ba3fa3d4c0ad7de069ea04d98
2019-11-13 14:22:17 -08:00
Rick Hanlon 80b4919d77 LogBox - Title render errors "Render Error"
Summary:
This diff changes LogBox to say "Render Error" instead of "Fatal Error" for errors thrown in render.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18466237

fbshipit-source-id: 737759f3febb937f70698dae5f1b1617e233fc98
2019-11-13 11:33:38 -08:00
Rick Hanlon 8335ebaeab Add support for isRenderError
Summary:
This diff adds `isRenderError` to the Log data, and refactors the LogBoxLog object to accept an object in the constructor instead of adding the 7th argument. No visual updates as those are in the next diff.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18466192

fbshipit-source-id: e38ef9032b8074abbc7b40cbe7a84d45285944c4
2019-11-13 11:33:38 -08:00
Rick Hanlon 75deeb32fe LogBox - Errors thrown in render are fatals
Summary:
The React team wants exceptions thrown during render to pop over the screen as fatals.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D18439258

fbshipit-source-id: dded7b9d93271c1a4eff682be521c7567dfe7d7e
2019-11-13 11:33:37 -08:00
Daniel Sainati 0f8ad31745 @allow-large-files deploy Flow v0.112 to xplat
Summary: Changelog: [Internal]

Reviewed By: samwgoldman

Differential Revision: D18466454

fbshipit-source-id: 83c76ba06822a378cb0a8ea72cd0fb9d19f81a4b
2019-11-13 11:18:41 -08:00
Oleksandr Melnykov c5c3264a94 Add setNativeRefreshing command to SwipeRefreshLayoutManager
Summary:
As a part of the migration from `setNativeProps` in Fabric and Paper, we are replacing it by view commands in the RefreshControl component on Android.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18475428

fbshipit-source-id: f2e978d88e34c74771f8582247ecc82b2b942557
2019-11-13 10:21:04 -08:00
Oleksandr Melnykov cd1e34d4a2 Add setNativeValue command to ReactCheckBoxManager
Summary:
As a part of the migration from `setNativeProps` in Fabric and Paper, we are replacing it by view commands in the Checkbox component on Android.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18451524

fbshipit-source-id: 566f3574b85a1ae97f78b2fb95548b8529c0c92f
2019-11-13 10:15:50 -08:00
Rick Hanlon 687d3f438f LogBox - Fix animation for source map failure
Summary:
Fixes an issue where the icon for failed source maps would spin like the pending icon.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18479027

fbshipit-source-id: 07c428239122f3f4a8a58dcd8faf09e54170d45b
2019-11-13 10:04:44 -08:00
Rick Hanlon 80ba7f78fb LogBox - Exclude from inspector
Summary:
LogBox should be on top of the inspector so that you can dismiss and view errors without the inspector getting in the way.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D18462490

fbshipit-source-id: 0da2819158c3bc2602a63695222c1601dcf79183
2019-11-13 09:52:44 -08:00
Rick Hanlon 5427211a00 LogBox - Dismiss keyboard when the inspector opens
Summary:
If the keyboard is open when the inspector pops open, dismiss it.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18468221

fbshipit-source-id: 0d51fa90824ed8bef6a3b6e813013fa3c2a4bbda
2019-11-13 09:39:50 -08:00
Ramanpreet Nara a95184cbad Make RCTNativeAnimatedModule a regular NativeModule
Summary: We suspect that RCTNativeAnimatedModule's conversion to TurboModule could be the cause. There could be a memory leak in the TurboModule system that RCTNativeAnimatedModule exposes, or RCTNativeAnimatedModule itself could have a memory leak. Therefore, I'm making RCTNativeAnimatedModule a regular NativeModule for now.

Reviewed By: fkgozali

Differential Revision: D18410852

fbshipit-source-id: dd714fe0fb0267fe5e1a94a26d47a82199b6f2c7
2019-11-12 13:56:09 -08:00
Emily Janzer d37baa78f1 Split JS spec for image loader module
Summary:
It turns out the ImageLoader native module has different method signatures on iOS than on Android, so the JS spec we currently have won't work for ANdroid. In this diff I'm splitting up the spec for NativeImageLoader into an Android & iOS versions (similar to PlatformConstants), and updating the Android spec to match the native implementation. I'm also changing `RCTImageLoader` to use the new generated spec, and updating the JS callers (`Image.android.js` and `Image.ios.js`) to use the right one for the platform (instead of importing the untyped `ImageLoader` native module from `react-native`, like we were on Android :-/).

This will be a breaking change for anyone who's directly using `NativeImageLoader.js`, but I think most callsites should be using the `Image` component instead.

Changelog: [General] [Changed] Split NativeImageLoader into NativeImageLoaderAndroid and NativeImageLoaderIOS

Reviewed By: RSNara

Differential Revision: D18439538

fbshipit-source-id: 94c796d3fd27800ea17053e963bee51aca921718
2019-11-11 17:24:25 -08:00
Rick Hanlon 390546f6ed Increase hitslop for notification dismiss button
Summary:
This diff increases the hit slop for the close button to dismiss the notifications.

Changelog: [Internal]

Differential Revision: D18438192

fbshipit-source-id: e671ec06c69f52f83c7dda87118ca1d2426e993b
2019-11-11 16:16:03 -08:00
Rick Hanlon a9ffad446a LogBox - Better design for stacks
Summary:
This diff makes minor style improvements and refactors to stack frame displays, primarily:
- Adding brackets around react components
- Uses a monospace font for the code
- Changing section titles to "Components" and "Call stack"
- Refactors the section headers to a single component and reduces the text size of headings
- Removes the query string from unsymbolicated stacks

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18433487

fbshipit-source-id: 7914b5810a4303e9a0d52def92e524b9e72f79ed
2019-11-11 16:12:44 -08:00
Rick Hanlon c1d9a1f099 LogBox - Add support for filtering warnings
Summary:
This diff adds the ability to set a custom warning filter function.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18422114

fbshipit-source-id: a2949a013f478093a2fabc003c496353b8fdbc3a
2019-11-11 16:12:43 -08:00
Rick Hanlon 619a17e34b LogBox - Speed up popping fatal errors
Summary:
This diff add proper optimistic symbolication loading to fatal errors that are popped open, improving both raw performance and perceived performance of fatal logboxes.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18421259

fbshipit-source-id: 2c96a96522d6d199fecd828144799c96437c3d28
2019-11-11 16:12:43 -08:00
Rick Hanlon fe82f402a9 LogBox - Rework how fatals and syntax errors are handled
Summary:
This diff makes a few changes to how errors and warnings are handled in LogBox:

- Soft errors continue to notify the user collapsed.
- Fatal errors pop up full screen over the content, but are dismissible.
- Syntax errors pop up full screen, and are **not** dismissible.
- Removed the "Reload" button on fatals, and added back the dismiss/close.
- Removed all buttons from syntax errors so users are encouraged to fix it and safe without reloading.

To do this we needed to:
- Move the selectedLogIndex state out of the component and up to the rest of the log state.
- Change the way popping a log works, it's now done by setting selectedLogIndex at log time instead of deriving it at render time, that means `selectedLogIndex` is now the sole state value for deciding if the log inspector is open or not
- Whenever the state is updated, find a syntax error if it's there, instead of doing this at render time

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18421089

fbshipit-source-id: d2c4937f666f1302ed1a7b1b9c6679b0509136c5
2019-11-11 16:12:43 -08:00
Oleksandr Melnykov a62a685b14 Add setNativeSelectedPosition command to ReactPickerManager
Summary:
Fabric doesn't support setNativeProps, so we have to use commands instead to set the value of the native component.

Changelog: [Android] [Added] - Add setNativeSelectedPosition command to ReactPickerManager

Reviewed By: mdvacca

Differential Revision: D18007791

fbshipit-source-id: dfa26792205189a336ab43b1c51f43f8f57c8e72
2019-11-11 12:32:51 -08:00
Eli White 60e91fa9ff Add ascii-capable-number-pad to DeprecatedTextInputPropTypes
Summary:
This was added to the flow type and example in D18275225 but not added to the prop-type

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D18431253

fbshipit-source-id: ffe4eaa8bd9dd22bf7c1487873c9fbdb7b226e3d
2019-11-11 12:20:18 -08:00
Rick Hanlon 28a3b25c31 LogBox - Display code frame column number correctly
Summary:
Code frame columns are returned 0 based but displayed in editors 1 based, this diff bumps the column we display by one to match.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18426163

fbshipit-source-id: 2c6aefb6fe7ce161cd768b6748b7739d486ed438
2019-11-11 07:40:09 -08:00
Samuel Susla 8f607a7967 Fabric: add native commands support to ScrollView
Summary:
ScrollView isn't using codegen, therefore we need to manually write commands interface. I also typed commands so it uses `Double` instead of `number`.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D18371887

fbshipit-source-id: 3bd11b9969b80ce6d2302e2f0da28884e9221b7e
2019-11-10 17:19:00 -08:00
Eli White 960a4767be Prepare event.target to be a HostComponent
Summary:
We are going to be switching event target and current target from being a reactTag to being a host instance.

This doesn't actually change what the actual type of this key is, but is split out like this to make diffs smaller and easier to review. Actual behavior changes will be coming and tested in a future diff.

These are the only callsites I found that use target outside of the React renderers.

The other approach this change could take would be to make all the downstream callsites take both a tag or a HostComponent. That felt too difficult to do at the same time so I'm instead introducing these `findNodeHandle` calls temporarily.

The main thing we need to do is be able to change the callsites in the renderer to start sending the instance. Once everything is passing the instance instead of the tag then we can clean all these up cleanly.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D18384435

fbshipit-source-id: b3a7e6a2778cb7dd9cdfe451cf869cd99641b167
2019-11-08 17:33:35 -08:00
Eli White 74f567ba3c Prepare `currentTarget` to accept number or host component
Summary:
We are going to be switching event target and current target from being a reactTag to being a host instance.

This doesn't actually change what the actual type of this key is, but is split out like this to make diffs smaller and easier to review. Actual behavior changes will be coming and tested in a future diff.

These are the only callsites I found that use `currentTarget` outside of the React renderers.

Changelog:
[Internal]

Reviewed By: zackargyle, yungsters

Differential Revision: D18382470

fbshipit-source-id: 23add5498b38dc109b154479826f701c8a1920b9
2019-11-08 17:33:35 -08:00
Ramanpreet Nara 8ec7e0966c Delete Sample and CrashyCrash
Summary:
These NativeModules aren't necessary. So, instead of making them TurboModule-compatible, I'm deleting them.

Changelog:

[General][Removed] - Remove Sample and CrashyCrash

Reviewed By: fkgozali

Differential Revision: D18361526

fbshipit-source-id: 3217130a5fb32bec9db78d53c5429bae7ed7b66c
2019-11-08 14:14:47 -08:00
Ramanpreet Nara 861c860462 Make PushNotificationManager TurboModule-compatible
Summary:
Changelog:
[iOS][Added] - Make PushNotificationManager TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18375067

fbshipit-source-id: 256e6a42bf0055253f04df45e67f538f7564a966
2019-11-08 14:14:46 -08:00
Ramanpreet Nara d73ae1baa3 Make RCTWebSocketModule TurboModule-compatible
Summary:
Changelog:
[iOS][Added] - Make RCTWebSocketModule TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18353766

fbshipit-source-id: fde0f6593dd203ab3dcb8f9cf40012ba4761d6ba
2019-11-08 14:14:46 -08:00
Ramanpreet Nara 1b2992e8b3 Make RCTLinkingManager TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RCTLinkingManager TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18331085

fbshipit-source-id: 5b4482affbf647bd96043ef9a27e715856bc25f1
2019-11-08 14:14:45 -08:00
Kevin Gozali fb627dac6a TM JS: Revert to import from TurboModuleRegistry.js
Summary:
Changelog: [Internal]

Reverting the import to the previous local module style since importing from react-native seems to introduce some perf regression. We'll revisit this later in the future.

Reviewed By: yungsters

Differential Revision: D18383893

fbshipit-source-id: f11d46a4545768f39199fd6fd22fcf14905d0a74
2019-11-08 11:44:16 -08:00
Christoph Nakazawa fa4f23e4e8 Add codeFrame to each warning and error in LogBox
Summary:
This diff changes the LogBox to show the code frame for the first non-collapsed stack frame. Let me know what you think about this change!

Changelog: [Internal] LogBox changes

Reviewed By: rickhanlonii

Differential Revision: D18372456

fbshipit-source-id: ddf6d6c53ab28d11d8355f4cb1cb071a00a7366e
2019-11-08 08:31:01 -08:00
Rick Hanlon 5eddf1d79a LogBox - Show native redbox when failing to handle logs in LogBox
Summary:
This diff adds error handling to logbox so that if there is an error either when parsing logs or when rendering LogBox, we show a native redbox with the error that was thrown and a message explaining that it's an internal React Native error.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18394788

fbshipit-source-id: 5d74d58e4b28ef6d863079e83677fb23ef4ccb34
2019-11-08 07:41:09 -08:00
Rick Hanlon 7ad862eaba LogBox - Press to open code frame file
Summary:
This diff adds the ability to press the file name of a code frame to open the file in your editor.

Note: I re-worked the frame location to extract the frame row and column at parse time so that we don't need to do any clowny regexes down stream.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18358283

fbshipit-source-id: 705e07d229c66ecfd225a8fb65ef2f78b5034c9c
2019-11-07 09:11:59 -08:00
Rick Hanlon 83401adeae LogBox - Add platform and dim text in meta
Summary:
This diff adds more information to the meta area so it doesn't look so empty and dims the text so it doesn't jump out so much.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18360434

fbshipit-source-id: d460ffd59ef032d89879f88e309ac81e6d862c30
2019-11-07 08:48:05 -08:00
Rick Hanlon f1a11b6ce4 LogBox - Rename and re-order dismiss/minimize buttons
Summary:
Based on feedback "minimize" wasn't clear and "close" is more common so it should be on the right

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18353907

fbshipit-source-id: bccfc9be6c225a9adb31ef11d6a91330a7d4e008
2019-11-07 06:32:01 -08:00
Rick Hanlon 8901a0b863 LogBox - Better shadow for fatal button
Summary:
This diff lowers the intensity of the shadow on the fatal button based on user feedback that it's weird.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18353498

fbshipit-source-id: 9133aae02e5609e181a55289f349ea6a9e9fdaf6
2019-11-07 06:32:01 -08:00
Rick Hanlon 118e4d2c04 LogBox - Dim collapsed frames
Summary:
It's nice to be able to still see which stack frames are collapsed even when they're expanded.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18352700

fbshipit-source-id: f76086574677ea58c6b19b3300597681a17a96ae
2019-11-07 06:32:01 -08:00
Rick Hanlon 1c9a792ca4 LogBox - Re-apply badge color fix
Summary:
The previous diff mistakenly landed an old version

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18358917

fbshipit-source-id: 284dd6754c4aea3814e5f45dae6f68ed2c261b6a
2019-11-07 06:17:35 -08:00
Rick Hanlon e223454fbf LogBox - Remove extra padding to bottom of scroll container
Summary:
Fixes the comical level of padding at the end of the scroll container.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18351352

fbshipit-source-id: 5482fb81d0e385f0ce36530491b407c03ad87f3e
2019-11-06 13:56:10 -08:00
Rick Hanlon 38b3cbcca9 LogBox - Update press backfround for inspector footers
Summary:
Previously the background for the LogBox inspector footer buttons bleed into the background behind them. This change gives them more distinct on press backgrounds.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18337437

fbshipit-source-id: c0cefd4464d94dc23316208135a9bf922fb510cb
2019-11-06 10:17:47 -08:00
Rick Hanlon 40ee0adbc1 LogBox - Center number and darken warning count color
Summary:
Some feedback for logbox is that the count wasn't centered on certain devices (e.g. Nexus 6 but not Pixel 3), and that the white badge count color for warnings was hard to read. This diff fixes both issues.

Changelog: [Internal]

Differential Revision: D18336681

fbshipit-source-id: 8200bcf04dcea9a6bbcaa1555fbab000c78c0a4f
2019-11-06 10:17:47 -08:00
Rick Hanlon 001e8d5a2b LogBox - Don't show substitutions for log notification
Summary:
When messages are collapsed, showing a different style for the string substitutions for interpolated strings is jarring, so let's  show the plaintext instead.

Changelog: [Internal]

Differential Revision: D18335295

fbshipit-source-id: f718469ac3206fd7a934a26495ebf8b1850fb674
2019-11-06 10:17:47 -08:00
Rick Hanlon 059e54a6e3 LogBox - hide only non-fatal errors for disableLogBox
Summary:
This diff updates the handling for `console.disableLogBox` so that:

- It does not disable fatals and syntax errors
- When there is a fatal or syntax error, the hidden logs are still shown and browsable

Changelog: [Internal]

Differential Revision: D18339684

fbshipit-source-id: 906122cc19ce50b3a21a42ae455206796953bcf3
2019-11-06 10:12:01 -08:00
Jordan Brown 9d0707c409 deploy v0.111 to xplat
Summary: Changelog: [Internal]

Reviewed By: dsainati1

Differential Revision: D18342672

fbshipit-source-id: ae6933344e4545ae8f650a4d14cfe55c34f43ad9
2019-11-06 10:02:29 -08:00
Ramanpreet Nara 97a4b9b691 Fix RCTNetwork podspec
Summary:
RCTNetwork files require the `MobileCoreServices` framework. This diff adds the spec to the Podfile

Changelog:
[iOS][Fixed] - Fix RCTNetwork podspec

Reviewed By: PeteTheHeat

Differential Revision: D18331084

fbshipit-source-id: 0de9e6d5e2ad2a24ba0cfdecd4a8a18419acf042
2019-11-05 19:14:39 -08:00
Emily Janzer f3b3d777ab Add view config for AndroidHorizontalScrollContentView
Summary:
Add handwritten view config for AndroidHorizontalScrollContentView. Same as RCTScrollContentView, this native component has no props of its own other than what View accepts. It's simply used as a container for the horizontal ScrollView on Android.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18284673

fbshipit-source-id: 8cd6282a3b2e5c9876da5cc0e068b12dd56acfd8
2019-11-05 19:09:03 -08:00
Emily Janzer b7fac14b64 Add view config for AndroidHorizontalScrollView
Summary:
Adding a handwritten view config for AndroidHorizontalScrollView, the native component that's used with `<ScrollView horizontal={true} />` on Android. Native props are the same as `RCTScrollView`, so I'm reusing the type for that.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18284517

fbshipit-source-id: 7c81f72440b93d611f9574ad2c01a96530d07bf7
2019-11-05 19:09:03 -08:00
Emily Janzer 1f2dc8997f Add (empty?) view config for RCTScrollContentView
Summary:
Adding a handwritten view config for RCTScrollContentView. This host component doesn't actually have any props of its own separate from View; it's just a container for a ScrollView.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18283792

fbshipit-source-id: db95e981f54bef7c068b907c5d1fa52774dad147
2019-11-05 19:09:02 -08:00
Emily Janzer da39b07298 Add handwritten view config for RCTScrollView
Summary:
Adding a handwritten view config for RCTScrollView, to be used in DEV only (for now).

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18263203

fbshipit-source-id: 975499f030c7caed9851bcde0be42c5058911ad5
2019-11-05 19:09:02 -08:00
Jordan Brown 93e58b2c96 Suppressions for 0.111
Summary:
still some generated files in www that need to land before we can release 0.111 here.

drop-conflicts

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: dsainati1

Differential Revision: D18278838

fbshipit-source-id: b20c3fefb3aab7c5fb614b33d846c7548184f49a
2019-11-05 17:36:23 -08:00
Samuel Susla 6fb5f81193 Use commands instead of setNativeProps in DatePicker
Summary:
Changelog: DatePicker now uses commands instead of `setNativeProps`

We are moving away from `setNativeProps` in favour of commands API.

Reviewed By: shergin

Differential Revision: D17787870

fbshipit-source-id: aa532cbb7bfb3031c085e5122ab808522c437901
2019-11-05 10:41:41 -08:00
Rick Hanlon 1fb815ed43 LogBox - hotfix for opening logs
Summary:
`fatalIndex` is never null, we switched it to go to -1 when it's not set

Changelog: [Internal}

Reviewed By: cpojer

Differential Revision: D18324666

fbshipit-source-id: 04d4cca9923af2a91ceec03f8314dead4681e526
2019-11-05 07:14:27 -08:00
Jorge Bernal a6fc0898de Add support for native pseudo-OS to Platform.select (#26966)
Summary:
When you write platform-specific code using [file extensions](https://facebook.github.io/react-native/docs/platform-specific-code#platform-specific-extensions), you can specify `.ios.js`, `.android.js`, or the catch-all `.native.js` when you are sharing code with a web project.

This `native` shortcut is missing for the `Platform.select` method, and this PR is adding support for that.

## Changelog

[General] [Added] - Platform.select now supports native as an option.
Pull Request resolved: https://github.com/facebook/react-native/pull/26966

Test Plan: Added relevant passing unit tests for Platform module.

Differential Revision: D18323670

Pulled By: cpojer

fbshipit-source-id: 7524c1914beab4f86041dcf8e60875380ebf7e02
2019-11-05 05:39:20 -08:00
Kevin Gozali dd06f85bd0 TM JS: cleaned up TurboModuleRegistry types [2]
Summary:
Changelog: [Internal]

Moved the imports for `TurboModuleRegistry` and `TurboModule` from `react-native`. This was a jscodeshift with the script: P120688078

Reviewed By: yungsters

Differential Revision: D18262538

fbshipit-source-id: 48fac15229c897408928511c5ecbb42f17ec7b42
2019-11-04 18:51:05 -08:00
Kevin Gozali e40aa7922e TM JS: cleaned up TurboModuleRegistry types [1]
Summary:
Changelog: [Internal]

* The original intention was to export both `get()` and `getEnforcing()` from TurboModuleRegistry.js, so define export default there
* Exposes `TurboModule` type on the top-level `'react-native'` import
* Tried this out on `NativeSegmentFetcher`

Reviewed By: yungsters

Differential Revision: D18262535

fbshipit-source-id: a46f2b8b6147531998efac8aa3b8259885224902
2019-11-04 18:51:05 -08:00
Ramanpreet Nara 6f54f00e0d Make RCTDataRequestHandler, RCTFileRequestHandler, and RCTHTTPRequestHandler TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RCTDataRequestHandler, RCTFileRequestHandler, and RCTHTTPRequestHandler TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18093611

fbshipit-source-id: dad4e04104a9a5fc8e70a17ef0bdf7b29bff9171
2019-11-04 16:07:25 -08:00
Ramanpreet Nara ffb8191a51 Make RCTNetworking TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RCTNetworking TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18087243

fbshipit-source-id: 81bbf77d603e96fa94ad219e5ed68f42bb7e7dc5
2019-11-04 16:07:25 -08:00
Ramanpreet Nara 1d315608ef Make RCTCameraRollManager TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RCTCameraRollManager TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18148892

fbshipit-source-id: de49e368615032b2c4de129dc55191c562cbdfbe
2019-11-04 16:07:24 -08:00
Ramanpreet Nara c29ec64d94 Implement RCTConvertOptionalVecToArray(const folly::Optional<ContainerT> &vec)
Summary:
There are two implementations of `RCTConvertVecToArray`. The first implementation:

```
template<typename ContainerT>
NSArray *RCTConvertVecToArray(const ContainerT &vec, id (^convertor)(typename ContainerT::value_type element))
{
  NSMutableArray *array = [NSMutableArray new];
  for (size_t i = 0, size = vec.size(); i < size; ++i) {
    id object = convertor(vec[i]);
    array[i] = object ?: (id)kCFNull;
  }
  return array;
}
```
The purpose of the second implementation is to default the convertor function to the identify function:
```
template<typename ContainerT>
NSArray *RCTConvertVecToArray(const ContainerT &vec)
{
  return RCTConvertVecToArray(vec, ^id(typename ContainerT::value_type element) { return element; });
}
```

Meanwhile, there's only one implementation of `RCTConvertOptionalVecToArray`:

```
template<typename ContainerT>
NSArray *RCTConvertOptionalVecToArray(const folly::Optional<ContainerT> &vec, id (^convertor)(typename ContainerT::value_type element))
{
  return vec.hasValue() ? RCTConvertVecToArray(vec.value(), convertor) : nil;
}
```

In this diff, I overload `RCTConvertOptionalVecToArray` to default the convertor to the identify function.

Changelog:

[iOS][Added] - Added RCTConvertOptionalVecToArray with default converter

Reviewed By: PeteTheHeat

Differential Revision: D18148891

fbshipit-source-id: d7d5f05cda06c9fa5374334ec4e9dbbd8b6d2eba
2019-11-04 16:07:24 -08:00
Ramanpreet Nara 7e5de4e241 Make RedBox TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RedBox TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18142255

fbshipit-source-id: 2d130aca93a88ac7c983ce0e4848955ffb0be518
2019-11-04 16:07:23 -08:00
Ramanpreet Nara fe3ae9dce8 Make RCTDevMenu and RCTDevSettings TurboModule-compatible
Summary:
Changelog:
[iOS][Added] - Make RCTDevMenu and RCTDevSettings TurboModule-compatible

Reviewed By: shergin

Differential Revision: D18148890

fbshipit-source-id: bd4f0b2797e299cd963e34fa47044a9e1232efe0
2019-11-04 16:07:23 -08:00
Janic Duplessis 686ab49107 Don't restore default values when components unmount (#26978)
Summary:
There are some cases where restoring default values on component unmount is not desirable. For example in react-native-screens we want to keep the native view displayed after react has unmounted them. Restoring default values causes an issue there because it will change props controlled my native animated back to their default value instead of keeping whatever value they had been animated to.

Restoring default values is only needed for updates anyway, where removing a prop controlled by native animated need to be reset to its default value since react no longer tracks its value.

This splits restoring default values and disconnecting from views in 2 separate native methods, this way we can restore default values only on component update and not on unmount. This takes care of being backwards compatible for JS running with the older native code.

## Changelog

[General] [Fixed] - NativeAnimated - Don't restore default values when components unmount
Pull Request resolved: https://github.com/facebook/react-native/pull/26978

Test Plan:
- Tested in an app using react-native-screens to make sure native views that are kept after their underlying component has been unmount don't change. Also tested in RNTester animated example.

- Tested that new JS works with old native code

Reviewed By: mmmulani

Differential Revision: D18197735

Pulled By: JoshuaGross

fbshipit-source-id: 20fa0f31a3edf1bc57ccb03df9d1486aba83edc4
2019-11-04 15:40:09 -08:00
Eli White e9b4928311 TextInput: Don't do an extra round trip to native on focus/blur
Summary:
I wrote up a bunch of context for this in response to #27038 by fat. That comment is reproduced here in this commit message. You can see it in it's original contxt here: https://github.com/facebook/react-native/pull/27038

Okay, here is what I think is happening. For context, here is a diagram I have of how focus and blur propagates through the system. This might be interesting to refer back to as you go through the rest of my explanation.

![graphviz (12)](https://user-images.githubusercontent.com/249164/67992345-982c9d80-fbf9-11e9-96ea-b091210dddbe.png)

ScrollView's scrollResponder is responsible for blurring text inputs when a touch occurs in the ScrollView but outside of the currently focused TextInput. The code for that is here:
6ba2769f0f/Libraries/Components/ScrollResponder.js (L301-L314)

This happens on `scrollResponderHandleResponderRelease` aka, touch up.

It checks for what the currently focused textinput is by calling `TextInputState.currentlyFocusedField()`.

That function is a JS variable that is being updated by calls to `TextInputState.focusTextInput` and `TextInputState.blurTextInput`:

6ba2769f0f/Libraries/Components/TextInput/TextInputState.js (L36-L71)

I added some console logs to those methods to see which ones are being called when running your repro (thanks for the repro!). **This is without your fix**

Click on and off:
```
// Click on input 1
focusTextInput input1
TextInput's _onFocus called

// Click on blank space
scrollResponderHandleResponderRelease blur input1
blurTextInput input1
TextInput's _onBlur called
```

Click on input1, then input 2, then off
```
// Click on input 1
focusTextInput input1
TextInput's _onFocus called for input1

// Click on input 2
focusTextInput input2
TextInput's _onBlur called for input1
TextInput's _onFocus called for input2

// Click on blank space
scrollResponderHandleResponderRelease blur input2
blurTextInput input2
TextInput's _onBlur called for input2
```

And now for the bug. Click on input 1, tab to 2, then off
```
// Click on input 1
focusTextInput input1
TextInput's _onFocus called for input1

// Tab to input 2
TextInput's _onBlur called for input1
TextInput's _onFocus called for input2

// Click on blank space
scrollResponderHandleResponderRelease blur input1
blurTextInput input1
```

Notice how `focusTextInput` was never called with input2 in the last example. Since this is the function that sets the `currentlyFocusedField` when we click on the blank space RN is trying to blur the first input instead of the second.

# The root cause
We are tracking the state of which field is focused in JS which has to stay in sync with what native knows is focused. We [listen to _onPress](6ba2769f0f/Libraries/Components/TextInput/TextInput.js (L1103-L1107)) and call `TextInputState.focusTextInput` in that handler. However, we don't currently have anything listening to other ways for an input to become focused (like tabbing) so it doesn't end up updating the `currentlyFocusedField`.

We have the same problem with blur that we actually fixed the same way you did here in this PR:
6ba2769f0f/Libraries/Components/TextInput/TextInput.js (L1182-L1189)

If you look back at my diagram at the beginning of this post, you'll notice the missing edge from `TextInput._onFocus` to `TextInputState.focusTextInput`. That's the problem. :)

The reason this solution works is because this function **is** the notification from native that an input was focused or blurred. This solution is *fine* because this updates the `currentlyFocusedID` but isn't great because it both sets that value and **calls the native code to focus or blur again**. Luckily the native code doesn't send an event back to JS if you try to blur an already blurred TextInput otherwise we'd have an infinite loop.

# The correct solution
The correct thing would probably be to have all of this tracking in native code and not in JavaScript code. That's a pretty big change though and very out of scope. Something for our team to keep in mind for the future.

A short term term solution would be to refactor `focusTextInput` and `blurTextInput` to pull out the part that sets the `currentlyFocusedID` that we could call from `TextInput` directly from `_onFocus` and `_onBlur`.

# ^This short term term solution is what this commit is doing.

Changelog:
[General][Changed] TextInput no longer does an extra round trip to native on focus/blur

Reviewed By: RSNara

Differential Revision: D18278359

fbshipit-source-id: 417566f25075a847b0f4bac2888f92fbac934096
2019-11-04 14:42:44 -08:00
Peter Argany dfba3129f4 CoreFoundation memory management in RCTImageStoreManager
Summary:
I recently learned that CoreFoundation object lifecycle is not managed automatically by ARC.

RN appears to be leaking a few refs, this small stack of diffs cleans them up.

Changelog: [Internal][Fixed] Fixed memory management of CF objects in RCTImageStoreManager

Reviewed By: fkgozali

Differential Revision: D18308313

fbshipit-source-id: 35c1152753578825871c28e1070599cd409b3a34
2019-11-04 14:42:43 -08:00
Luna Wei 8e55e9ab1b TouchableNativeFeedback.android use codegenNativeCommands
Summary: Changelog: [Internal] Use `findHostInstance_DEPRECATED` for TouchableNativeFeedback

Reviewed By: TheSavior

Differential Revision: D18285029

fbshipit-source-id: 1c19c35e660519bee450e4fd37f18c03ec1883e0
2019-11-04 12:31:20 -08:00
Eli White 0799910705 React partial sync for 15ed22757...2cfa5ea92
Summary:
This sync includes these changes:

- **[2cfa5ea92](https://github.com/facebook/react/commit/2cfa5ea92 )**: Types: findHostInstance_DEPRECATED returns React.ElementRef<HostComponent<mixed>> (#17265) //<Eli White>//

Changelog:
[General][Changed] React partial sync for 15ed22757...2cfa5ea92

Reviewed By: lunaleaps

Differential Revision: D18302477

fbshipit-source-id: a8198ec7f39ab86aed2a1d3077187fc50d0f38e9
2019-11-04 12:22:53 -08:00
Eli White 88f64a5782 Slider: Inline default props
Summary:
Instead of defining the default props as a property on the forwardRef, we can just inline it into the destructure.

Changelog:
[Internal]

Reviewed By: yungsters

Differential Revision: D18296180

fbshipit-source-id: c9e85a9869648983a01d84c36a5c581b357b427f
2019-11-04 12:16:38 -08:00
Eli White f19112f46f Tighten Slider Flow type
Summary:
Changelog:
[Internal]

Reviewed By: yungsters

Differential Revision: D18295806

fbshipit-source-id: b2cb4d84bbcddbac83baaab9ea2af3e1c87150a9
2019-11-04 12:16:37 -08:00
Samuel Susla 1cfa1e6fa2 Remove -Wno-unguarded-availability from ReactInternal
Summary:
This will allow us to catch cases where we use iOS 10-only APIs on iOS 9

Changelog: [Internal]

Reviewed By: TheSavior, mmmulani

Differential Revision: D18275225

fbshipit-source-id: dc9c515415208db40750be997173ce5bd6eb494f
2019-11-04 12:03:10 -08:00
Eli White 8f6fa42503 TextInput: Remove legacy iOS implementation
Summary:
This implementation was replaced in January of 2018 by shergin. I believe everyone should have `RCTVirtualText` at this point, which should make this safe to remove.

Changelog:
[Internal][TextInput] Remove deprecated and unused legacyIOS implementation

Reviewed By: shergin

Differential Revision: D18296981

fbshipit-source-id: b5d5756e7bbc8141f1b826ab07c76a781ab03edc
2019-11-04 11:51:12 -08:00
Eli White 1804e7cbea Remove TextInput's `inputView` prop
Summary:
This if statement is older than June 2015. This prop is undocumented, not part of the flow type, not on our public docs, not in the flow type, not in typescript types, and I can't find any blog posts about it.

Changelog:
[Breaking][TextInput] Removing undocumented `inputView` prop. Use children instead.

Reviewed By: yungsters

Differential Revision: D18296894

fbshipit-source-id: 95373d24659e6f06e212095b57e8f6d713323c11
2019-11-04 11:51:12 -08:00
Peter Argany dc3b5ad275 Remove unneeded NSNotification center removeObserver
Summary:
A very common pattern I've seen in RN codebase:

     - (instancetype) init {
        [[NSNotificationCenter defaultCenter] addObserver:self ...]
      }

    - (void) dealloc {
       [[NSNotificationCenter defaultCenter] removeObserver:self ...]
     }

From Apple:

https://developer.apple.com/documentation/foundation/nsnotificationcenter/1413994-removeobserver?language=objc

> If your app targets iOS 9.0 and later or macOS 10.11 and later, you don't need to unregister an observer in its dealloc method.

RN targets iOS9+

Changelog: [Internal][Cleanup] Remove unneeded NSNotification center removeObserver

Reviewed By: shergin

Differential Revision: D18264235

fbshipit-source-id: 684e5f5555cec96b055b13cd83daaeb393f4fac9
2019-11-04 10:19:30 -08:00
Samuel Susla 56c7ae729a Migrate Picker from setNativeProps to Commands API
Summary:
We are moving away from `setNativeProps` in favour of commands API.

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D17765031

fbshipit-source-id: fcfe3fe68abb3e49e2dd7a102db598ade749acde
2019-11-04 08:29:52 -08:00
Samuel Susla 4eb8a951ff Use Switch command from JavaScript
Summary: Changelog: Switch on iOS now uses command instead of `setNativeProps`.

Reviewed By: lunaleaps

Differential Revision: D17714895

fbshipit-source-id: 0e8784fc1d0a57c563b0a4c038febdc0320af11e
2019-11-04 07:44:10 -08:00
Samuel Susla b6a23d8793 Add excludedPlatform option to CodeSchema
Summary:
Currently we generate Java ViewManager interfaces and C++ classes for iOS regardless whether the component is supported on platform or it isn't. This adds an option to exclude either iOS to Android in order to avoid this.

Changelog: In codegen it is now possible to exclude one or the other platform

Reviewed By: rickhanlonii

Differential Revision: D18217185

fbshipit-source-id: 1c569b92c92a5b991c96b0abdff6b8ed395e449f
2019-11-04 04:36:55 -08:00
Tim Yung e22946c25a Animated: Update Abstract Component Flow Type
Summary:
Updates the return type of `createAnimatedComponent` to reflect the new behavior (where we forward the ref to the internal component).

I also improved the type annotation for `Props` so that we can still enforce that only valid prop names are supplied. (We still do not check the prop values because we do not currently have a good strategy for typing the "animated versions" of those.)

Changelog:
[General] [Changed] - Flow types for Animated components now validates prop names and yields the new component instance.

Reviewed By: TheSavior

Differential Revision: D18290473

fbshipit-source-id: 8c629ab6aff009ebe6dabca1683c99a357869977
2019-11-03 18:02:00 -08:00
Tim Yung 66e72bb4e0 Animated: Forward Ref to Component
Summary:
Changes `createAnimatedComponent` so that a `ref` assigned to an Animated component will now be forwarded to the internal component. Previously, a ref to the internal component was accessed using the `getNode` method. The `getNode` method is now deprecated and will return the same `ref` but show a deprecation error.

Changelog:
[General] [Changed] - Refs on an Animated component are now the internal component. The `getNode` call has been deprecated.

Reviewed By: TheSavior

Differential Revision: D18290474

fbshipit-source-id: 5849809583a17624a89071db8be1282a12caedf3
2019-11-03 18:02:00 -08:00
Tim Yung 86d90c03eb Animated: Minor `createAnimatedComponent` Cleanup
Summary:
Some minor cleanup to `createAnimatedComponent`:

- Remove deprecated `propTypes`.
- Reorder lifecycle methods in rough order of execution.

Changelog:
[General] [Removed] - Removed `propTypes` from Animated components.

Reviewed By: TheSavior

Differential Revision: D18289773

fbshipit-source-id: f97d9ee4a2a42d210726267506de3b6b78860e8c
2019-11-03 11:59:53 -08:00