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

6179 Коммитов

Автор SHA1 Сообщение Дата
Samuel Susla cc0cca60c1 Animated: queue all NativeAnimated operations until mounting effects are finished on iOS
Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D22843292

fbshipit-source-id: f31a243f4f2b7b87f4bd2a1f0a453c42cc70acee
2020-08-04 01:43:05 -07:00
Samuel Susla 629e10e91b Fix "Cannot read property 'getNativeScrollRef' of undefined" in createAnimatedComponent
Summary: Changelog: Fix "Cannot read property 'getNativeScrollRef' of undefined" error in createAnimatedComponent

Reviewed By: JoshuaGross

Differential Revision: D22897211

fbshipit-source-id: d4f5161ac908fd137b2332a6860e62ad1cfd8856
2020-08-04 01:43:05 -07:00
Joshua Gross 777957c6fb LayoutAnimations: Allow user-configurable failure function
Summary:
There's currently a hidden parameter passed to the LayoutAnimation engine for "failure". It's not been used anywhere, ever, since it's a hidden parameter... and it's probably not called from the native side in non-Fabric. But it's been added to the native side of Fabric for feature-completeness and we might as well expose it, the cost seems minimal.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D22889455

fbshipit-source-id: 73322776ed21e58a370500ccfde89285f07a9d50
2020-08-02 16:37:03 -07:00
Gijs Weterings f8f53e595c Back out "Forward NativeModule schema to __turboModuleProxy"
Summary:
Original commit changeset: aecaf9943f9b

Changelog: [Internal]

Reviewed By: jimmy623

Differential Revision: D22885708

fbshipit-source-id: 6839266653ad33ea8fb53c9f4664ed773c57443d
2020-08-01 06:25:26 -07:00
Ramanpreet Nara 3df6f5fb2c Forward NativeModule schema to __turboModuleProxy
Summary:
`babel-plugin-codegen` will run the NativeModules codegen on each NativeModule spec, and inline the generated schema into the spec's `TurboModuleRegistry.get(Enforcing)?` call. This diff will forward that schema to `__turboModuleProxy` function (i.e: the TurboModule C++ infra).

**Note:** Both this and D2280384 can't be landed until D22743294 (650c0f64f1) hits production (1-2 weeks).

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D22832730

fbshipit-source-id: aecaf9943f9b01be805ff6b90249a6cbc6abdd20
2020-07-31 18:29:53 -07:00
Ramanpreet Nara a30fbc28c9 Give NativeAnimatedTurboModule its own TurboModule interface
Summary:
Unfortunately, the new codegen doesn't allow us to import types from other files. Therefore, I've inlined the interface specification of NativeAnimatedModule into NativeAnimatedTurboModule.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D22858790

fbshipit-source-id: 759bb960240afaba6b70c2730c3359b7e8c46c83
2020-07-31 13:48:41 -07:00
Samuel Susla 799654b105 Make sticky header position type relative
Summary:
Changelog: [Internal]

Since D22098586 (476ab7481e) zIndex is only applied to views with position other than static.
Sticky header however needs to have its zIndex applied otherwise it goes below the content.

Reviewed By: mdvacca

Differential Revision: D22843134

fbshipit-source-id: d2e3a21441795b82c44b6d4245ccf89620fd9a8e
2020-07-31 08:48:09 -07:00
Joshua Gross 9e6ba9ddb8 Animated: queue all NativeAnimated operations until mounting effects are finished
Summary:
In Fabric, there are two subtle differences in Animated:

1) On the native side, queued NativeAnimated operations are executed more frequently
2) On the JS side there seems to be a bigger gap between AnimatedNodes being set up, and the final `componentDidMount`/`componentDidUpdate` that results in `_attachNativeEvents` being called.

This results in some visual glitching for certain features like StickyScrollViewHeader and other animations that are frequently rerendered. Rerendering an animated component relies on sync-like behavior
(new animations must be set up in the same frame that old animations are torn down, and the UI must flush any updates in the same frame). This sync-like behavior is trickier to achieve in Fabric, so
we introduce this mechanism, in Fabric only, to queued operations more aggressively on the JS side and only flush them when `componentDidMount`/`componentDidUpdate` have been called on all relevant nodes.

This seems to resolve longstanding issues with animations in Fabric on Android.

There are unrelated issues on iOS that make this difficult to test currently, so I'll keep the new path Android-only for now.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D22801173

fbshipit-source-id: 3db2235483636c9074df941cfac0a30f3f97545a
2020-07-29 12:39:10 -07:00
Andrey Tserkus db474a47b7 RN: Fixed `performanceNow()` to allow debugging in Chrome
Summary:
Discovered when debugging a React Native app in Chrome. The function `performanceNow` was recently changed, so that in Chrome it now refers to `performance.now()` method. However, `now()` cannot be called standalone without a context.

Reproduced by a synthetic example in Chrome:
```
const performanceNow = window.performance.now;
performanceNow();

Uncaught TypeError: Illegal invocation
    at <anonymous>:1:1
```

Changelog:
[General] [Fixed] - Fix failure when debugging code in a browser; was caused by `performanceNow()` function.

Reviewed By: cpojer

Differential Revision: D22739176

fbshipit-source-id: f89b8a215b7b4c430ffd72a1d23539c4f1b31d24
2020-07-28 17:20:54 -07:00
Paito Anderson 0bcc686c1c Fix iOS Image.getSizeWithHeaders (#29338)
Summary:
Fixes https://github.com/facebook/react-native/issues/28632

Image.getSizeWithHeaders() was not working as intended on iOS.

## Changelog

[iOS] [Fixed] - Fixed headers in `Image.getSizeWithHeaders`.

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

Test Plan:
Used RNTester and an Image URL requiring a Bearer token to test.

Code:
<img width="720" alt="Screen Shot 2020-07-10 at 3 00 58 PM" src="https://user-images.githubusercontent.com/4108718/87189376-850cba00-c2be-11ea-851c-d9fa37d88de4.png">

With Bearer Token:
<img width="456" alt="Screen Shot 2020-07-10 at 3 02 48 PM" src="https://user-images.githubusercontent.com/4108718/87189349-7de5ac00-c2be-11ea-8d82-c74cae6d904b.png">

Without Bearer Token:
<img width="559" alt="Screen Shot 2020-07-10 at 3 04 32 PM" src="https://user-images.githubusercontent.com/4108718/87189458-aff70e00-c2be-11ea-82b7-34a14ec465f1.png">

Reviewed By: cpojer

Differential Revision: D22783037

Pulled By: PeteTheHeat

fbshipit-source-id: 3ad5026e71607c61d42316784844c5295bc1dcae
2020-07-28 13:16:28 -07:00
Rick Hanlon 4b935ae95f Correctly mock all components by setting the displayName
Summary:
In the next react sync we removed the `displayName` from forwardRef and useMemo components ([PR here](https://github.com/facebook/react/pull/18495 )).

This means we need to manually add the displayName in the mock.

Changelog: [General] [Fixed] Fix test renderer mocks to use the displayName more often.

Reviewed By: TheSavior

Differential Revision: D22775470

fbshipit-source-id: 1390dc325e34f7ccea32bbdf1c6a8f6efea3a080
2020-07-28 13:09:06 -07:00
Rick Hanlon 7af3f6e934 Add React integration tests for LogBox
Summary:
This diff adds some integration tests that throw read React errors and asserts on the LogBox data.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D22752147

fbshipit-source-id: eb2e1542524d67558f2450130015164acd4d6093
2020-07-28 13:09:06 -07:00
Rick Hanlon 4720ee9aa7 Support component stack frames formatted as call stack frames in LogBox
Summary:
In the next version of React they've changed the format of component stacks from a custom format to the same format as call stacks. This diff adds handling (and test) for the new format.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D22752034

fbshipit-source-id: 38d74bffd9ed623cbdd71e70103d66d8f0765fd9
2020-07-28 13:09:06 -07:00
Samuel Susla ffc90c7f92 Remove requestToken being nil check from [RCTNetworkTask validateRequestToken]
Summary:
Changelog: Fix [TypeError: Network request failed] on file upload

# Problem
In 3198009410 I made method `loadImageForURL` blocking and nil returning since it was no longer cancellable.

However inside `[RCTNetworkTask validateRequestToken]` was a logic counting on request token being non nil.
This diff removes this check and adds `nullable` to `[RCTImageURLLoader loadImageForURL]` making it explicit.

Reviewed By: PeteTheHeat

Differential Revision: D22767174

fbshipit-source-id: 04d5562e381912233b9c14e8156cbf145288f063
2020-07-28 12:00:57 -07:00
bill2004158 fd85b84a86 Update RCTSRWebSocket.m (#29419)
Summary:
Only add Sec-WebSocket-Protocol header if has _requestedProtocols.

## Changelog

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

[iOS] [Fixed] - when Sec-WebSocket-Protocol header is empty vaulue, IIS server will return error 502.

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

Reviewed By: cpojer

Differential Revision: D22782867

Pulled By: PeteTheHeat

fbshipit-source-id: d588997a345929b0c11c554d4452e612a336901a
2020-07-28 11:10:14 -07:00
Peter Argany d1c3c2d084 Fork RCTAnimatedModule to unblock brideless mode
Summary:
The Animated native module cannot be converted to a TM because it has perf regressions when used in conjunction with Paper renderer. Instead of fixing these complicated perf issues (which will disappear when Fabric ships this half), temporarily fork the native module. The new fork is converted to a TM, and only used to unblock bridgeless mode testing.

Changelog:[Internal]

Reviewed By: RSNara

Differential Revision: D22651010

fbshipit-source-id: 912123ef38ac8c66025b7bba34a65ec6d98f330d
2020-07-27 15:09:33 -07:00
Luna Wei 509e9dbd5f Change signature for addTimestamp for performance logger
Summary:
Changelog:
[Internal][Added] - Change signature of `addTimestamp` for IPerformanceLogger and rename old implementation to addTimeAnnotation

Adding this because there is no current ability to add a timespan to our perf logging with pre-defined start and end timestamps. The naming is a bit confusing because the current implementation of `addTimespan` in FB doesn't add a timespan, it adds an annotation of duration. We rename the old implementation to `addTimeAnnotation/s` and update `addTimespan` to suit our needs.

Reviewed By: rubennorte

Differential Revision: D22633202

fbshipit-source-id: 0e32099241f1f3835257cbb4ad108a4f437869e6
2020-07-27 14:28:56 -07:00
Rick Hanlon 9edfc43aad Only pass Error.stack to parseErrorStack
Summary:
I want to be able parse error stacks in contexts where I have a call stack string but no error object.

This diff changes parseErrorStack to only accept the stack, instead of a whole error object.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D22752048

fbshipit-source-id: b4b1cd58802eefe736130d48a82bc091241a11ee
2020-07-27 13:57:58 -07:00
Samuel Susla b08fff6f86 Fix race condition in KeyboardAvoidingView
Summary:
Changelog: Fix possible race condition inside `KeyboardAvoidingView`

Fabric has different order of events

In Fabric, `keyboardWillChangeFrame` event is fired before `onLayout`, but in Paper it is the other way around.
`KeyboardAvoidingView` depends on the order of events to function properly. Inside `_relativeKeyboardHeight` 0 is returned if `this._frame` is null.

To fix this, `bottom` margin is recalculated whenever `keyboardWillChangeFrame` or `onLayout` is triggered.

Reviewed By: shergin

Differential Revision: D22764192

fbshipit-source-id: 591ac59af4395a4d43c4e78e4fbc0ff118b292f8
2020-07-27 13:16:38 -07:00
Christoph Nakazawa ab56ed7d96 Create `@react-native/normalize-color` package
Summary: Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D22644750

fbshipit-source-id: f1b24c7e72819650517b7b42f93eeeed9c1e627b
2020-07-24 08:36:37 -07:00
Christoph Nakazawa 63377fa66b Add `@react-native/assets` package for Asset Registry related code
Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D22628865

fbshipit-source-id: 66ff311b2dab4e0c42f906d5a2642997b1570ae4
2020-07-23 05:07:40 -07:00
Peter Argany 91d16bbd9f Hardcode @available(iOS 10) to YES
Summary:
RN removed support for iOS 9 last year, therefore iOS10+ is always available.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D22655069

fbshipit-source-id: 77e85e0403ea7ea0febc8766c10bb6f94ea417ad
2020-07-22 11:00:32 -07:00
Rubén Norte 4409642811 Migrate large amount of modules to flow strict and strict-local
Summary:
| Group | Before | After | Change |
| Untyped | 50 | 49 | -1 |
| flow | 197 | 155 | -42 |
| flow strict-local | 226 | 185 | -41 |
| flow strict | 33 | 117 | +84

Changelog: [Changed] Improved Flow typing of multiple modules (with migrations to `flow strict` and `flow strict-local`

Reviewed By: motiz88

Differential Revision: D22549140

fbshipit-source-id: ed29415332cfce15b244ee4dea9e13d035543175
2020-07-22 09:46:16 -07:00
Christoph Nakazawa 09a11202e5 Clean up `assetPathUtils` code
Summary:
Cleaning up a bunch of legacy JS (var) and removing some variable names for stuff that is just used once.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D22627397

fbshipit-source-id: 783af84b17cbf37df3b8e2ae10bb39d50dd8180d
2020-07-22 03:02:45 -07:00
Christoph Nakazawa a77f2c40d1 Create `@react-native/polyfills` package.
Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D22625944

fbshipit-source-id: 1d97550c92115eb637da57e8f38c28e8139f3a8b
2020-07-22 03:02:45 -07:00
Tom Cheung 123423c2a9 Fix image cannot show in iOS 14 (#29420)
Summary:
This PR is to fix https://github.com/facebook/react-native/issues/29279, which image cannot show in iOS 14
As https://github.com/facebook/react-native/issues/29279#issuecomment-658244428 mention, this issue can be fixed by calling ` [super displayLayer:layer];` it it is still image, to let `UIImageView` handle still image rendering

## Changelog

[iOS] [Fixed] - Fix image cannot show in iOS 14

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

Test Plan:
Image can be shown in iOS 14 build with Xcode 12 beta, using
```js
<Image source={require('./images/some_local_image.jpg')}/>
```

It may also need to test gif image is render correctly
```js
<Image source={{uri: 'https://some_remote_gif_image.gif'}}/>
```

Reviewed By: p-sun

Differential Revision: D22619448

Pulled By: shergin

fbshipit-source-id: f4d0ad83af945a6b8099d4eaea5a5f1933c7bfd2
2020-07-19 21:35:22 -07:00
Jayesh Kawli b78d7051e5 Moved ART iOS files to FB internal
Summary:
As a part of the "Lean Core" effort we are moving many React Native open source modules into React Native. Through this task, we reduced the app size of all React Native applications!

For this task, I moved the ART iOS files to Facebook internal.

Changelog:
[iOS][Changed] - Moved ART iOS files from React Native to Facebook internal

Reviewed By: PeteTheHeat

Differential Revision: D22560856

fbshipit-source-id: 4ed982b0361fef3e875374b6c3df0204037c2bfa
2020-07-19 13:59:06 -07:00
Tommy Nguyen 15dda0ab5a Fix multiline TextInput crash when inserting/removing lots of text (#29307)
Summary:
Multiline `TextInput` can crash when really long texts are inserted and removed quickly. This is caused by the fact that [`-[NSAttributedString string]`](https://developer.apple.com/documentation/foundation/nsattributedstring/1412616-string?language=objc) doesn't really return a copy, and may mutate the string while it is being used by `convertIdToFollyDynamic`. See https://github.com/microsoft/react-native-macos/pull/489#discussion_r451789471 for more details on the issue.

This issue was originally reported in https://github.com/microsoft/react-native-macos/issues/486 and was fixed in https://github.com/microsoft/react-native-macos/pull/489.

## Changelog

[iOS] [Fixed] - Fix multiline TextInput crash when inserting/removing lots of text

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

Test Plan:
1. Open RNTester > TextInput
2. Search for a multiline example
3. Copy some large text and paste it into the text input view
4. Remove some (or all) text
5. Repeat steps 3-4

Reviewed By: shergin

Differential Revision: D22488854

Pulled By: JoshuaGross

fbshipit-source-id: 6fab7818d68538450d93460361ff5934caf86c10
2020-07-16 22:29:19 -07:00
Peter Argany 3137c443f4 Use more inclusive language in Animated
Summary:
This appears to be the only usage of whitelist/blacklist in react-native-github, let's use some more inclusive language.

Changelog: [JS][Internal]

Reviewed By: kacieb

Differential Revision: D22539431

fbshipit-source-id: 21d4cd54a5a2a676996ccec7b02ef15c421efee1
2020-07-16 16:01:51 -07:00
Joshua Gross d61a8b7bb8 Pressable Views should not be flattened
Summary:
In Fabric if you use a Pressable or PressableBackground and only provide an `onPress` but don't provide background color or anything else, the View might be flattened away and with it the event handlers.

We assume that if the product engineer is using a Pressable, they want it to do something in the View hierarchy, so force it to never be flattened.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D22557026

fbshipit-source-id: 171c5b51e8d828fbb2816685d188286179a10af9
2020-07-15 18:50:54 -07:00
David Vacca 61cd596137 Remove unused dependency
Summary:
Remove unused dependency

changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D22470766

fbshipit-source-id: e49180d1a9eb01e8380fb2bde16b8d4378018693
2020-07-14 21:27:38 -07:00
simek e5a8f4270e fix StatusBar showHideTransition flow type issue (#29034)
Summary:
This small PR adds third, missing [`StatusBarAnimation`](https://github.com/facebook/react-native/blob/master/Libraries/Components/StatusBar/StatusBar.js#L45) possible value to the `showHideTransition` prop validation - `'none'`.

This fixes the following issue when `<StatusBar showHideTransition="none" />` code  is used:

<img width="970" alt="Screenshot 2020-06-02 at 22 39 37" src="https://user-images.githubusercontent.com/719641/83567510-f6b85200-a521-11ea-9f1c-48825d0285bf.png">

## Changelog

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

[iOS] [Fixed] - fix StatusBar showHideTransition flow type issue

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

Test Plan: I have run the `flow` check in the test project which uses local working copy of `react-native` with this change included.

Reviewed By: GijsWeterings

Differential Revision: D22493825

Pulled By: cpojer

fbshipit-source-id: 463badec67e6725cb8711a79aa43d84f9b09f796
2020-07-14 08:38:39 -07:00
simek 1c634a9218 move Hermes badge from template to NewAppScreen library (#28783)
Summary:
Refs https://github.com/facebook/react-native/issues/28711

This PR moves Hermes badge component from the template to the `NewAppScreen` library. The main motivation behind this change was to simplify a bit template code.

I assumed that it is not important to expose `global.HermesInternal` to the template users:
* If this assumption is true, I think that there are no other reason to leave this component inside `App` in comparison to other `NewAppScreen` components,
* If this assumption is false, I can adjust this PR and move `HermesInternal` check from the badge component to the `App`.

I was trying to avoid calling `useColorScheme` when Hermes is disabled, but placing hook inside the conditional branch causes ESLint warning (react-hooks/rules-of-hooks).

This PR includes also small style tweaks for the badge - since there are no background padding can be omitted and spacing can be added adjusted tweaking `top` and `left` properties and `fontSize` has been adjusted just for the readability.

In the last commit, I have gone a bit further and moved `HermesBadge` to the `Header` component and I have also changed slightly the `Header` title (React -> React Native) and it's styling.
> I'm not sure if after this change `HermesBadge` export in `NewAppScreen` components list is still required, but maybe this badge will be useful for someone. If it's a mistake I can update the PR and remove this export.

## Changelog

[Internal][Changed] move Hermes badge from the template to the NewAppScreen library

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

Test Plan:
Template app do not redbox on Android emulator with and without Hermes enabled.

## Preview
Android with Hermes enabled and adjusted header:

![Screenshot_1588164908](https://user-images.githubusercontent.com/719641/80599357-16dc8900-8a2b-11ea-8b3e-9a2cb26d3470.png)

iOS with adjusted header:

![IMG_6551](https://user-images.githubusercontent.com/719641/80599445-3bd0fc00-8a2b-11ea-8215-318625ddad13.PNG)

Reviewed By: GijsWeterings

Differential Revision: D22493822

Pulled By: cpojer

fbshipit-source-id: 3440e10f2d59f268ca8851a6e002f0ff23fa839c
2020-07-14 06:29:00 -07:00
makitake2013 320398afe5 Test fixes related to changes in Jest's Fake Timer behavior (#29011)
Summary:
Fixed tests related to changing Jest's fake timer behavior.
And some of the test code in LogBoxData-test.js itself was incorrect so I am fixing it.

LogBoxData-test.js fails when I try to build a new local development environment and fork the React Native source to run a JavaScript test.
The error message is:
runAllImmediates is not available when using modern timers

After checking, runAllImmediates could not be used with the following modification.
71631f6bf9

## Changelog

[Internal] [Fixed] - Test fixes related to changes in Jest's Fake Timer behavior

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

Test Plan: Ran JavaScript Tests locally.

Reviewed By: cpojer

Differential Revision: D22494991

Pulled By: rickhanlonii

fbshipit-source-id: 4deeaf82b5092ff8b60c4606eb45549beb452a5f
2020-07-12 00:28:53 -07:00
Rick Hanlon 8e6e83be0c Switch to react-shallow-renderer
Summary:
Replace react-test-renderer/shallow with react-shallow-renderer.

We should follow up with teams to remove these tests because they will no longer be supported. I would have just removed them but test like `BillingReauthorizeCreditCardContainer-test` seem important.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D22225642

fbshipit-source-id: a6bd559311422cb14576a574165ed7dc0279919d
2020-07-10 14:06:38 -07:00
David Vacca d5bc0a7bff Fix inconsistency on AndroidTextInput view configs
Summary:
BubblingEventTypes are inconsistent between AndroidTextInputViewConfig.js and ReactTextInputManager.java, this diff fixes this inconsistency

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D22470096

fbshipit-source-id: 3940dcc0ae67a42ac070c06ec2d54bc365eab6b7
2020-07-09 22:20:53 -07:00
Tim Yung caf010914c RN: Remove `fbjs/performanceNow` Dependency
Summary:
Replaces `fbjs/performanceNow` call sites in React Native with `performance.now`.

We did not originally polyfill this in `InitializeCore`, but now we do (and back it with a proper `nativePerformanceNow` implementation). Also, added the missing polyfill to our Jest setup.

Changelog:
[Internal]

Reviewed By: cpojer

Differential Revision: D22445948

fbshipit-source-id: dcfd9867c050617f6e2a3d0a1eb6f48a44771dda
2020-07-09 11:40:57 -07:00
Tim Yung ae193942fe RN: Remove `fbjs/{keyMirror,keyOf}` Dependencies
Summary:
Removes `fbjs/keyMirror` and `fbjs/keyOf` call sites from React Native.

Changelog:
[Internal]

Reviewed By: cpojer

Differential Revision: D22438238

fbshipit-source-id: 0f84b6e9d81811f95a2a24886f38ad16b8e6e74f
2020-07-09 11:40:57 -07:00
Rick Hanlon f28c7505fa Fix LogBox.ignoreAllLogs used with no argument (#29310)
Summary:
When you call `LogBox.ignoreAllLogs()` it should ignore logs.

This fixes a bug that made this equivalent to `LogBox.ignoreAllLogs(false)`

## Changelog

[General] [Fixed] - LogBox.ignoreAllLogs() should ignore logs

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

Test Plan: Added tests

Reviewed By: TheSavior

Differential Revision: D22448436

Pulled By: rickhanlonii

fbshipit-source-id: 6ba12b9d9c1f29cf3ac503946ac5ca0097425a7a
2020-07-08 18:51:58 -07:00
Hein Rutjes cfa4260598 Add support for shadowColor on Android (API >= 28) (#28650)
Summary:
This PR adds support for the `shadowColor` style on Android.

This is possible as of Android P using the `setOutlineAmbientShadowColor` and `setOutlineSpotShadowColor` View methods. The actual rendered color is a multiplication of the color-alpha, shadow-effect and elevation-value.

## Changelog

`[Android] [Added] - Add support for shadowColor on API level >= 28`
Pull Request resolved: https://github.com/facebook/react-native/pull/28650

Test Plan:
- Only execute code on Android P
- Added Android `BoxShadow` tests to RNTester app

![image](https://user-images.githubusercontent.com/6184593/79457137-fe627c80-7fef-11ea-8e88-3d9423a4f264.png)

Reviewed By: mdvacca

Differential Revision: D21125479

Pulled By: shergin

fbshipit-source-id: 14dcc023977d7a9d304fabcd3c90bcf34482f137
2020-07-07 23:32:38 -07:00
Ramanpreet Nara a27c295f53 Rename RCTTurboModuleLookupDelegate to RCTTurboModuleRegistry
Summary:
## Why?
1. RCTTurboModuleLookupDelegate sounds a bit nebulous.
2. In JS and Java, we use a `TurboModuleRegistry` interface to require TurboModules. So, this diff will make JS, Java, and ObjC consistent.

Changelog:
[Internal]

Reviewed By: PeteTheHeat

Differential Revision: D22405754

fbshipit-source-id: 30c85c246b39d198c5b8c6ca4432a3196ca0ebfd
2020-07-07 16:25:11 -07:00
Sean Wang 824d3a9770 Move iOS CameraRoll files into FB internal
Summary:
This moves ios CameraRoll files from React Native open source into FB internal as part of the Lean Core effort.

Changelog: [Breaking][ios] Remove CameraRoll from React Native

Reviewed By: cpojer

Differential Revision: D22208352

fbshipit-source-id: 894d6aff34ece94648dad68060c13b44974c93bb
2020-07-06 20:22:25 -07:00
Christoph Nakazawa 6d6c68c2c6 "The Metro Server" -> Metro
Summary:
Pet Peeve: Metro is a brand name. You don't say "the Metro server" just like you don't say "the iPhone phone". This is a leftover from when it used to be called "the packager server".

Note: It makes sense to refer to "the Metro server" when talking about it in the context of Metro's features, like if you are discussing "Metro's bundling" and "Metro's server". However, when talking about the tool itself, just Metro is enough.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D22330966

fbshipit-source-id: 667618363c641884df543d88cac65d1e44956ad3
2020-07-02 14:51:18 -07:00
Riley Dulin 3c3f8ca270 Add a special case for assert in installConsoleFunction
Summary:
The Hermes inspector always logged the message for `console.assert`.
It instead should check the first argument, and only if that argument
is false should it log.

Also remove the polyfill code that tried to avoid this situation.

Changelog: [Internal]

Reviewed By: mhorowitz

Differential Revision: D22299186

fbshipit-source-id: cdf4f8957d4db3d171d6673a82c7fc32b7152af3
2020-06-30 21:15:52 -07:00
Lulu Wu 0471f90f16 Change onAssetDidLoad to bubbling event
Summary:
onAssetDidLoad is defined as bubbling event in iOS, change it to bubbling event and adde it to bubblingEventTypes to fix "missing: topAssetDidLoad" error in Viewpoints iOS.

Changelog: [Internal]

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D22209406

fbshipit-source-id: 5da779d9d1d62c70d85d84ad80807ff688e29e2f
2020-06-30 06:40:23 -07:00
Samuel Susla 3d4535a2bb Introduce InputAccessoryView
Summary:
Changelog: [Internal]

Introducing InputAccessoryView.

There is one big difference between Fabric's implementation and Paper's implementation.

Fabric searches for text input from InputAccessoryView, unlike Paper where it is the other way around.

Reviewed By: shergin

Differential Revision: D22160445

fbshipit-source-id: 55313fe50afeced7aead5b57137d711dd1cfd3ae
2020-06-30 01:36:04 -07:00
TMaszko d92284216f Fix: Preserve native animated value after animated component unmount (#28841)
Summary:
After animation has been finished using Native driver there is no final value passed from the native to JS side. This causes a bug from https://github.com/facebook/react-native/issues/28114.

This PR solves this problem in the same way as `react-native-reanimated` library. When detaching it is calling native side to get the last value from Animated node and stores it on the JS side.

Preserving animated value even if animation was using `useNativeDriver: true`
Fixes https://github.com/facebook/react-native/issues/28114

## Changelog

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

[Internal] [Fixed] - Save native Animated node value on JS side in detach phase
Pull Request resolved: https://github.com/facebook/react-native/pull/28841

Test Plan: Unit tests for added getValue method passed. Green CI

Reviewed By: mdvacca

Differential Revision: D22211499

Pulled By: JoshuaGross

fbshipit-source-id: 9a3a98a9f9a8536fe2c8764f667cdabe1f6ba82a
2020-06-29 17:09:37 -07:00
fabriziobertoglio1987 0fda91ffff Adding Hyphenation Frequency prop for Text component (#29157)
Summary:
This issue fixes https://github.com/facebook/react-native/issues/28279
android_hyphenationFrequency prop for Android Text component which sets the frequency of automatic hyphenation to use when determining word breaks.

## Changelog

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

[Android] [Fixed] - Adding Hyphenation Frequency prop for Text component
Pull Request resolved: https://github.com/facebook/react-native/pull/29157

Test Plan:
More info are available in the [android docs](https://developer.android.com/reference/android/widget/TextView#setHyphenationFrequency(int)). I will add the documentation to the docs later once the pull request is taken in consideration for merging.

| **AFTER** |
|:-------------------------:|
|  <img src="https://user-images.githubusercontent.com/24992535/84919245-f8f1e300-b0c1-11ea-8a33-f30d0c9a75b7.png"  width="300" height="" />|

I remain available to do improvements. Thanks a lot. Fabrizio.

Reviewed By: TheSavior

Differential Revision: D22219548

Pulled By: JoshuaGross

fbshipit-source-id: 7e2523c25adfcd75454f60184eb73dc49891bef7
2020-06-29 16:57:12 -07:00
Chris Dadabo 72285d808d Add accessibilityHint to TouchableNativeFeedback (#29154)
Summary:
The docs suggest that TouchableNativeFeedback [inherits `TouchableWithoutFeedback` props](https://reactnative.dev/docs/touchablewithoutfeedback#props) but `accessibilityHint` was missing.

## Changelog

[Android] [Added] - Add accessibilityHint to TouchableNativeFeedback
Pull Request resolved: https://github.com/facebook/react-native/pull/29154

Test Plan: Not sure how this should be tested, but I'm happy to implement what others may suggest

Reviewed By: kacieb

Differential Revision: D22109459

Pulled By: TheSavior

fbshipit-source-id: 573267a26414a97ba23a1a7995bff1608f9ba34f
2020-06-29 12:57:25 -07:00
Tim Yung 4a1820dbdf EventEmitter: Import `{Native,RCTDevice}EventEmitter`
Summary:
Upgrades `require` expressions of `NativeEventEmitter` and `RCTDeviceEventEmitter` to `import`.

Changelog:
[Internal]

Reviewed By: cpojer

Differential Revision: D22203919

fbshipit-source-id: 4fdf01b66ba0501d0e0714931923531c97d29be2
2020-06-27 02:18:10 -07:00
Tim Yung 87a2e29f59 EventEmitter: Delete `once()` and `removeCurrentListener()`
Summary:
In an effort to simplify and clean up the `EventEmitter` abstractions in React Native, this removes `once()` and `removeCurrentListener()`. Across the Facebook codebase, there were only two callers of `once()` and no callers of `removeCurrentListener()`.

The same behavior can be achieved using:

```
const subscription = emitter.addListener('event', () => {
  subscription.remove();
  // ...
});
```

Changelog:
[General][Removed] - Removed `once()` and `removeCurrentListener()` fom `DeviceEventEmitter` and `NativeEventEmitter`.

Reviewed By: cpojer

Differential Revision: D22196474

fbshipit-source-id: 06ced186fd812e91d5c57f6580e647c100505807
2020-06-27 02:18:10 -07:00
Nick Gerleman e75557b48f Restore Previous Behavior for StyleSheet Validation of Null/Undefined Styles (#29171)
Summary:
https://github.com/facebook/react-native/issues/27264 changed stylesheet validation to avoid enumerating properties on the prototype of a style. It introduces a secondary behavior change, where null/undefined styles used to be tolerated but now lead to an exception. This is because `for in undefined` will noop where `for of Object.keys(undefined)` will throw.

This scenario of undefined/null styles seems to actually show up in practice and was previously well tolerated. E.g. `Button.js` has code that looks like this:

```jsx
const styles = StyleSheet.create({
  button: Platform.select({
    ios: {},
    android: {
      elevation: 4,
      // Material design blue from https://material.google.com/style/color.html#color-color-palette
      backgroundColor: '#2196F3',
      borderRadius: 2,
    },
  }),
```

For non ios/Android platforms, that creates a style object which looks like:
```js
{
  button: undefined,
  ...
}
```

This previously meant that the component would be unstyled if created, but now means out-of-tree platforms throw if the builtin Button component is required.

This change restores the previous `for in` loop but adds a `hasOwnProperty` check to avoid properties on prototypes.

## Changelog

[General] [Fixed] - Restore Previous Behavior for StyleSheet Validation of Null/Undefined Styles
Pull Request resolved: https://github.com/facebook/react-native/pull/29171

Test Plan: Validated that importing Buttons will no longer cause an exception, and that invalid properties are still caught.

Reviewed By: JoshuaGross

Differential Revision: D22118379

Pulled By: TheSavior

fbshipit-source-id: 650c64b934ccd12a3dc1b75e95debc359925ad73
2020-06-25 15:31:54 -07:00
Lulu Wu 6f99beff7e Fix for Unsupported top level event type "onAssetDidLoad"
Summary:
Fix for Unsupported top level event type "onAssetDidLoad"

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D22184964

fbshipit-source-id: d1ce920311fb380923ed9a2ef8aa5a49fc9f8dc2
2020-06-24 06:02:47 -07:00
Tim Yung 2933b887cd EventEmitter: Prefix Private Modules with `_`
Summary:
Renames `EventSubscription.js`, `EmitterSubscription.js`, and `EventSubscriptionVendor.js` to `_EventSubscription.js`, `_EmitterSubscription.js`, and `_EventSubscriptionVendor.js`, respectively.

This is to indicate that those files are implementation details and should not be directly referenced. Instead, the `EventSubscription` type exported from `EventEmitter.js` should be used.

The remaining stragglers that are importing `_EmitterSubscription.js` and `_EventSubscriptionVendor.js` after this commit will be cleaned up when `RCTDeviceEventEmitter` is refactored.

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: cpojer

Differential Revision: D22182310

fbshipit-source-id: 82be685f231395bd7b8e9986141b5df1367bec71
2020-06-23 13:50:26 -07:00
Tim Yung 70a73ca461 EventEmitter: Import `{Emitter => Event}Subscription`
Summary:
Changes dependents of `EmitterSubscription` to instead import the `EventSubscription` type from `EventEmitter.js`.

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: cpojer

Differential Revision: D22182309

fbshipit-source-id: 575f4c59248ef50182ddb33911f1e6f3ba88ec07
2020-06-23 13:50:26 -07:00
Tim Yung 331d3268e2 EventEmitter: Import `EventSubscription` from `EventEmitter`
Summary:
Changes dependents to import the `EventSubscription` interface type from `EventEmitter` instead of `EventSubscription.js`.

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: cpojer

Differential Revision: D22182313

fbshipit-source-id: 31448ea5ee3038f806a417f23597da1edd4e4e9b
2020-06-23 13:50:26 -07:00
Tim Yung 15911acd83 EventEmitter: Export `EventSubscription` Interface
Summary:
Changes `EventEmitter.js` to be Flow-typed so that it can export an interface for `EventSubscription`. In order to retain the untyped-ness of `EventEmitter.js`, I moved the entire definition into an untyped `_EventEmitter.js` file (which I hope no one will try importing from).

This new interface will be used to replace all the current type imports of `EventSubscription` and `EmitterSubscription`.

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: cpojer

Differential Revision: D22182311

fbshipit-source-id: c604a371a91963116621e89ca63f5a82167090b9
2020-06-23 13:50:26 -07:00
Tim Yung ab59e1819a EventEmitter: Upgrade from `require` to `import`
Summary:
Upgrades dependents of `EventEmitter`, `EventSubscription`, `EventSubscriptionVendor`, and `EmitterSubscription` to use `import` instead of `require`.

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: cpojer

Differential Revision: D22182312

fbshipit-source-id: e9444aa2728d89d52f577725f688871f7dbfba8a
2020-06-23 13:50:25 -07:00
Ramanpreet Nara e6d7f4a153 Make RCTNativeAnimatedModule a regular NativeModule
Summary:
There's a race when RCTNativeAnimatedModule is a TurboModule that breaks animations. More details here: T68603674. Even though this is a bit edge-casey, I think it's best to make this NativeModule a non-TurboModule until this problem is resolved.

Changelog: [iOS][Fixed] - Make RCTNativeAnimatedModule a regular NativeModule to unbreak animations with TurboModules on

Reviewed By: yungsters

Differential Revision: D22149179

fbshipit-source-id: 6bf9f0d5eab7c99a82b21ec07e76359181dcedd2
2020-06-19 18:24:38 -07:00
Luna Wei b095432e6d Catch getRouteEntry errors
Summary:
## Changelog:

[Internal][Changed] - Prevent symbolicating stacktrace and no logbox when running in express route

Context:
ExpressRoute doesn't support some things (like promises) due to the limited initialization we do.

Right now the app will crash when trying to evaluate those entrypoints in express route if they depend on such initialization. Ideally a redbox would warn the developer that express route would break if they modify their express-route compatible entrypoint. Displaying a redbox seems to require a bit of refactoring as it can't easily be triggered from native/express-route -- something more to investigate. Occasionally one does appear (when trying the attached test plan) but it is inconsistent and seems dependent on timing of bridge, express route initialization.

The plan:
* Since we are going to roll out an opt-in for each surface (note there are two flags, `fetchWithExpressRouteIfAvailable` and `useExpressRouteIfInitialized` - the former being for using `getPreloadProps` to parallel fetch and the latter as a flag to get route information) we have more control of the roll out of express route.

Things still to improve:
* It's obviously not great that we don't get better errors -- something to address if that is really the next blocker to rolling out ExpressRoute

Reviewed By: sahrens, ejanzer

Differential Revision: D22026444

fbshipit-source-id: 7698109f5921f82a2d0bc9a8346e12b67defca27
2020-06-18 16:58:21 -07:00
Jesse Katsumata a69bd9dadf chore: use es6 import for SafeAreaView component (#29143)
Summary:
This PR is to help proceed this discussion. https://github.com/react-native-community/discussions-and-proposals/issues/201#issuecomment-588454552

Converted `require` to `import` for SafeAreaView.

## Changelog

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

[General] [Changed] - switched to es6 import for SafeAreaView
Pull Request resolved: https://github.com/facebook/react-native/pull/29143

Test Plan: Tested that App runs on RNTester

Reviewed By: shergin

Differential Revision: D22109435

Pulled By: TheSavior

fbshipit-source-id: 57dc4ab88bf497b43422b20416afbe4c4a1e001d
2020-06-18 14:41:43 -07:00
Tim Yung 74ab8f6e5a RN: Consistent API for Image Events
Summary:
Changes the `onLoad` and `onError` events on `Image` to be consistent with each other and with the `ImageSource` type.

Changelog:
[Android][Breaking] - On `Image`, `onLoad` and `onError` event objects will no longer have an extra `uri` property.
[Android][Breaking] - On `Image`, `onLoad` event objects' `source.url` is now renamed to `source.uri`.
[iOS][Breaking] - On `Image`, `onLoad` event objects' `source.url` is now renamed to `source.uri`.

Reviewed By: mdvacca

Differential Revision: D22023565

fbshipit-source-id: 5ea7904c697f87e01118bdb81ed50ab0a5aecdce
2020-06-16 15:01:05 -07:00
Eddie Dugan 078e386024 fix setNativeSelectedPosition native command
Summary:
telling native that `selected` is the new selection is basically ignoring the most recent user input and resetting it back to the previous value. the reason it flips back and forth is that by the next time `onSelect` is called, the above code has updated the value of `selected` (line 63)

Changelog:
[Android] [Fixed] Picker - fix usage of setNativeSelectedPosition in onSelect

Reviewed By: mdvacca

Differential Revision: D22022456

fbshipit-source-id: fe51f9cbd712b5578e9fd9ea2992bd12d48f4ec4
2020-06-12 13:02:32 -07:00
Joshua Gross 23f2ec7e8c AnimatedDivision: pass zero instead of Inf/NaN in case of division by zero
Summary:
Fabric will crash if Inf/NaN values are passed to the native side, so just pass zero to native in those cases. It's an equally (in)valid value and we're already logging the error.

Also, debounce the error so we don't spam the LogBox/console.

This should potentially be changed to a warning.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22008980

fbshipit-source-id: 1aef33a13febed04311557718f05ef79bbbcca93
2020-06-11 20:46:48 -07:00
Mark Verlingieri 3346ac7f96 Don't scroll to initial item if ContentOffset is provided
Summary:
The initialScrollIndex in VirtualizedList contains a performance optimization to start rendering the list at the index provided.

ContentOffset does not contain this optimization and there is currently no way to specify the first item in the list to start rendering without contentOffset being ignored.

This change makes it so that if both initialScrollIndex and ContentOffset are provided, the list will start rendering at the initialScrollIndex but ContentOffset will still be used to set the scroll position.

initialScrollIndex functionality will remain the same if ContentOffset is not provided.

Changelog: [Changed] VirtualizedList will use contentOffset for scroll position instead of initialScrollIndex if both are provided

Reviewed By: sahrens

Differential Revision: D21980172

fbshipit-source-id: 36d2d2bc360845ef02329d2b95a2cf14b91c2b0b
2020-06-11 15:44:02 -07:00
Héctor Ramos 1c92b1cff6 Handle mixed union types and arrays of objects
Summary:
Restore legacy support for mixed union types.
These are not type safe and modules should use a different type, but we have a precedent for supporting these in the existing Linking native module. The new codegen will generate native code for these, and show a warning to encourage use of a better type.

Generate native code for elements in arrays of objects.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D21848260

fbshipit-source-id: 0b8cbf25e7a02791b4d77e349227a2b0744854f4
2020-06-09 17:48:19 -07:00
Joshua Gross fa5d3fb6b8 ScrollViewStickyHeader: update position (translateY) in Fabric ShadowTree when scrolling stops
Summary:
In Fabric, some uses of the ScrollViewStickyHeader don't work after scrolling because even though the UI correctly reflects the translateY that the StickyHeader should be at, the underlying C++ Fabric ShadowTree doesn't have the updated parameters.

1. We add a mechanism to pass static props through to animated nodes; these get passed to the platform through the normal commit-diff process. This is to allow passing props to the platform that are also controlled by the animation. This mechanism could be reused elsewhere.
2. In ScrollViewStickyHeader, listen to updates for the translateY value and pass them to the platform when it stops changing - for Fabric only. This noops for non-Fabric since it's not necessary.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21948830

fbshipit-source-id: b203ecde466732203dd12a86e2339e81f66b27e7
2020-06-09 16:35:36 -07:00
Spencer Ahrens 646605b90e update nested VList warning to error
Summary:
This has caused SEVs because the warning has gone unnoticed, so upgrading to error which should be much harder to miss or ignore.

https://fb.workplace.com/groups/rn.core/permalink/2680043542227367/

# Changelog
[Internal] update nested VList warning to error

Reviewed By: TheSavior

Differential Revision: D21945364

fbshipit-source-id: 88a9a9ab0b51e0afcf9b25be9854f65a61f419af
2020-06-09 16:31:28 -07:00
Jiayan Zhuang 345d0c1abb delete DEPRECATED_sendUpdatedChildFrames prop from ScrollView
Summary:
Changelog:
[iOS][Removed] - Removed DEPRECATED_sendUpdatedChildFrames prop to ScrollView component because there are no callsites of it anymore

Reviewed By: shergin

Differential Revision: D21941946

fbshipit-source-id: 0b7d6d0986ddff4b250e70e0450a6f7e166b41f4
2020-06-09 15:30:53 -07:00
Christoph Nakazawa ad879e50bc Add `RCTDevSplitBundleLoader` native module
Reviewed By: ejanzer

Differential Revision: D21302418

fbshipit-source-id: a868f6dad3306190c7add26e8f9a976866c16aef
2020-06-08 09:07:42 -07:00
Paige Sun 058eeb43b4 Prefetch images using a lower download priority
Reviewed By: fkgozali

Differential Revision: D21881729

fbshipit-source-id: 071a41aef2458df3d9a93a4ab0174af73e85b9fc
2020-06-05 20:55:36 -07:00
Ramanpreet Nara 6de3fffc37 Memoize repeated calls to getConstants() in MP Home, and Search
Reviewed By: fkgozali

Differential Revision: D21899206

fbshipit-source-id: 44ab118dc49697c1270d3c3f164c1ddf7bef0be4
2020-06-05 11:35:09 -07:00
Samuel Susla 851d01b0aa Move Collapsable into shared props
Summary:
Changelog: Move collapsable to Shared View props

I'm researching why `collapsable` isn't passed to Fabric UIManager in production build, I discovered that collapsable was Android only prop but in Fabric we use it in iOS as well.

This doesn't fix the collapsable not being passed through but I think this makes code semantically correct.

Reviewed By: mdvacca

Differential Revision: D21862770

fbshipit-source-id: 492c6a15955b907dbbeb8530c81f6a868cf379c3
2020-06-04 04:05:57 -07:00
Ramanpreet Nara 96fdaa541e Cache constants for MP Search NativeModules
Summary: TurboModules doesn't cache invocations of getConstants(). This diff looks at which NativeModules' getConstants() methods gets repeated called in Marketplace, and caches those invocations in JS.

Reviewed By: fkgozali

Differential Revision: D21874123

fbshipit-source-id: a44b98b3ac8621f67c9c0f3b7c4003a561d1e15d
2020-06-03 20:48:28 -07:00
Ramanpreet Nara 4e9c428328 Cache constants for MP Home NativeModules
Summary: TurboModules doesn't cache invocations of getConstants(). This diff looks at which NativeModules' getConstants() methods gets repeated called in Marketplace, and caches those invocations in JS.

Reviewed By: fkgozali

Differential Revision: D21874124

fbshipit-source-id: 03d2318e1b6d00236ef707f9f19a640bf8c08786
2020-06-03 20:48:27 -07:00
Peter Argany fdadff92ab RM stub function from MessageQueue.js
Summary:
Noticed this hanging around when reading MessageQueue, delete it.

Changelog: [internal]

Reviewed By: fkgozali

Differential Revision: D21874609

fbshipit-source-id: 627c6a18cdb859a1aaf2eb596f8744156d18393c
2020-06-03 18:22:36 -07:00
Janic Duplessis d3b937f990 Make sure LogBox is not included in production bundles (#28984)
Summary:
I was doing some bundle inspection and noticed the LogBox module was included. It does amount to around 15kb so I think it is worth making sure it is not there.

To fix it I moved some imports to require inside __DEV__ blocks to make sure metro is able to remove these imports.

## Changelog

[General] [Fixed] - Make sure LogBox is not included in production bundles
Pull Request resolved: https://github.com/facebook/react-native/pull/28984

Test Plan: Tested using react-native-bundle-visualizer and made sure nothing from LogBox was included in the bundle after these changes.

Reviewed By: TheSavior

Differential Revision: D21794466

Pulled By: rickhanlonii

fbshipit-source-id: 6cb0c0a89633e9850019bd61478c35e9c21638dc
2020-06-02 18:00:45 -07:00
Satyajit Sahoo 29f0cedc0a Remove usage of legacy context API in modal (#29002)
Summary:
Remove usage of the legacy context API in Modal in favor of the new context API. Closes https://github.com/facebook/react-native/issues/28103
Pull Request resolved: https://github.com/facebook/react-native/pull/29002

Test Plan: Run RNTester app and test the Modal example. Also add a `console.warn` to make sure we get the correct context value.

Differential Revision: D21793993

Pulled By: TheSavior

fbshipit-source-id: de2a30cbd46507bfa73a563d2429c5a7f0e320c9
2020-06-02 11:15:34 -07:00
Christoph Nakazawa 150d7f61c6 Remove docblock util from `@fb-tools/transformer`
Summary: Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D21718525

fbshipit-source-id: 38f44b45f30db71658fa969cd8bcf44638cb4ea7
2020-06-02 05:45:18 -07:00
Samuel Susla ee3994530d Force JS inspector to form stacking context
Summary:
Changelog: [Internal]

# Problem

JS inspector overlay gets flattened, therefore `onResponderMove` callback isn't called. JS inspector depends on `onResponderMove` because that's how it knows where on screen user has tapped.

https://our.intern.facebook.com/intern/diffusion/FBS/browse/master/xplat/js/react-native-github/Libraries/Inspector/InspectorOverlay.js?commit=2e9ab04b039a&lines=58

# Workaround

This is just a hack to get it working, setting nativeID forces stacking context to be created and therefore view not being flattened.

Reviewed By: mdvacca

Differential Revision: D21816513

fbshipit-source-id: 83aedbfaecdce22cfe202241cbe91cecb914ed6b
2020-06-01 09:40:06 -07:00
simek ad2f98df8f mark 'force' as optional property of PressEvent object (#29006)
Summary:
Refs:
* https://github.com/facebook/react-native/blob/master/React/Fabric/RCTSurfaceTouchHandler.mm#L93
* https://github.com/facebook/react-native/blob/master/RNTester/js/examples/Pressable/PressableExample.js#L25

According to the current implementation `force` will be returned only on `iOS` platform, only on the devices which have a hardware 3D touch capabilities.

## Changelog

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

[General] [Fixed] - mark `force` as an optional property of the PressEvent object
Pull Request resolved: https://github.com/facebook/react-native/pull/29006

Test Plan: Go CI!

Reviewed By: cpojer

Differential Revision: D21797241

Pulled By: TheSavior

fbshipit-source-id: e66be6958a2251bc8585e87e6bad54484a067949
2020-05-29 17:36:59 -07:00
Vojtech Novak 92160f3144 use React.Children.count for counting children (#28991)
Summary:
just a minor change - uses the [count api](https://reactjs.org/docs/react-api.html#reactchildrencount)

> Returns the total number of components in children, equal to the number of times that a callback passed to map or forEach would be invoked.

## Changelog

not needed I think
Pull Request resolved: https://github.com/facebook/react-native/pull/28991

Test Plan: tested locally

Differential Revision: D21794081

Pulled By: TheSavior

fbshipit-source-id: bf6d11b2bc854d938aed7268911f89a00bb3f596
2020-05-29 15:00:58 -07:00
Samuel Susla 163ec924fb Disable restoreDefaultValues in Native Animated in Fabric
Summary:
Changelog: [Internal]

# Problem

Before every update, restoreDefaults is called on animated nodes. In paper this makes sure no stale properties are on animated nodes. In paper it works fine because restoreDefaults is called before mounting and animations are triggered after mounting within single commit.

Details: https://github.com/facebook/react-native/pull/11819

In Fabric however it is called outside of other mounting operations and it applies default values to the view and then re-applies animated values.

Reviewed By: JoshuaGross

Differential Revision: D21786765

fbshipit-source-id: a2cb6d6d9cbd39d4c403c97c2f51e7d92078102f
2020-05-29 13:57:38 -07:00
Christoph Nakazawa 3b7679bd35 Clean up Flow & lint errors
Summary: Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D21703338

fbshipit-source-id: f33cf6dfdf8884ae76500ec55f44411e34e8cb76
2020-05-28 16:17:57 -07:00
David Vacca dc357b859c Revert Virtual Text Press Bug workaround
Summary:
This diff reverts the workaround added as part of D21432793, now that D21432793 is released in production for FB4A / FBiOS

changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D21772129

fbshipit-source-id: 3b39738cb8fc871ec85d87f347c7f0ef408ccc3e
2020-05-28 15:44:04 -07:00
Jacek Burys c8fed9e385 Move TimePickerAndroid to FB internal
Summary:
Moving TimePickerAndroid to FB internal.

Changelog:
[Android][Changed] - Moved TimePickerAndroid to FB internal.

Reviewed By: cpojer

Differential Revision: D21504128

fbshipit-source-id: 400c6ee7cff96a0d6b4205f7806ef8951b611b8c
2020-05-27 03:40:35 -07:00
Paige Sun 60b7a3085c Annotate <Image> components in QPL logging using ImageAnalyticsTagContext
Reviewed By: mdvacca

Differential Revision: D21696266

fbshipit-source-id: b5c9d167e9da77ed969f7b4bdea1af9dd2e471ae
2020-05-23 23:40:24 -07:00
Tim Yung 43c161c30a Touchable: Revert `minPressDuration` on Legacy Components
Summary:
When `minPressDuration` was introduced to `Pressability`, all of the legacy Touchable components inherited the new default.

This restore the former behavior for these legacy components so that only `Pressable` gets the new `minPressDuration` default value.

Changelog:
[General][Fixed] - Revert `minPressDuration` effect on legacy Touchable components

Reviewed By: fkgozali

Differential Revision: D21682764

fbshipit-source-id: b71a61843fae7f0f726155876a064fabd3ba1c64
2020-05-21 14:06:11 -07:00
Tim Yung 2c600b7c5a RN: Persist Asynchronously Consumed Events in Pressability
Summary:
There are a few places in `Pressability` where we asynchronously consume the `event` object.

Most places do not encounter any problems because the actual properties on `event` are seldom used.

Nonetheless, we should fix these gaps.

Changelog:
[General][Fixed] - Fix invalid `event` objects from `onPressOut` in certain cases

Reviewed By: rickhanlonii

Differential Revision: D21657126

fbshipit-source-id: e28d825b85d25602427beaf0bd603d22eaa5960a
2020-05-19 22:43:51 -07:00
Valentin Shergin c8d678abcf Revert D21396409: Add possibility to disable buttons in action sheet ios
Differential Revision:
D21396409

Original commit changeset: b3c3e4429651

fbshipit-source-id: 073bea94d96f0ebbb474c474c73e4e3f01f27b2e
2020-05-19 16:36:32 -07:00
Mike Vitousek 37e7b41419 deploy Flow 0.125.1 to xplat
Summary:
Changelog: [Internal]
allow-large-files

Reviewed By: gkz

Differential Revision: D21597387

fbshipit-source-id: dddec43885daa5a9c5c4dfe8e338ecedc9abcd1e
2020-05-19 01:24:57 -07:00
lukewalczak f0bf4b0986 Add possibility to disable buttons in action sheet ios (#28792)
Summary:
I've noticed that currently there is no option to disable button within the `ActionSheetIOS`. It can be really useful and decided to extend the API to support that functionality.

I added a new option called `disabledButtonsIndices` to `ActionSheetIOS` which is an array of button indices which should be disabled.

`ActionSheetIOS` documentation - PR https://github.com/facebook/react-native-website/pull/1898

## Changelog

[iOS] [Added] - Add disableButtonsIndices option to ActionSheetIOS component
Pull Request resolved: https://github.com/facebook/react-native/pull/28792

Test Plan:
1. Run the `RNTester`
2. Choose `ActionSheetIOS`
3. Check the fourth example `Show Action Sheet with disabled buttons`
4. `Option 1` and `Option 2` should be disabled

screenshot | gif
 --- | ---
<img width="493" alt="Screenshot 2020-04-30 at 15 16 22" src="https://user-images.githubusercontent.com/22746080/80739025-1ec52780-8b16-11ea-8b1c-30bb40ad8c99.png"> | ![action_sheet_disabled](https://user-images.githubusercontent.com/22746080/80739043-24227200-8b16-11ea-8bcb-af25eb57baac.gif)

Differential Revision: D21396409

Pulled By: shergin

fbshipit-source-id: b3c3e442965160e0c5e52854352f0540575c4d4c
2020-05-19 00:19:56 -07:00
Tim Yung 4aaf629982 Pressable: Minimum Press Duration
Summary:
When a `Pressable` has a configured (or the default) `delayPressIn` and no (or the default) `delayPressOut`, tapping very quickly can lead to intantaneous invocation of `onPressIn` and `onPressOut`. The end result is that users may never experience any intended visual press feedback.

This changes `Pressable` to accept (and be preconfigured with a default) **minimum press duration**. The minimum press duration ensures that even if the press is released before `delayPressIn` has elapsed, `onPressOut` will still wait the remaining time up to `minPressDuration` before firing.

Note that setting a non-zero `delayPressOut` is insufficient because if a user holds down on a `Pressable` for longer than `delayPressIn`, we still want `onPressOut` to fire immediately when the press is released.

Changelog:
[General][Changed] - Added `minPressDuration` to `Pressable`.

Reviewed By: TheSavior

Differential Revision: D21614708

fbshipit-source-id: 502f3d8ad6a40e7762435b6df16809c8798dd92c
2020-05-18 21:28:10 -07:00
Paige Sun 1f95c9b62e iOS: Fix logging lifecycle when image is scrolled out and immediately back in
Reviewed By: fkgozali

Differential Revision: D21619910

fbshipit-source-id: b94073afaacad45e12d22d593184cea97612fa26
2020-05-18 16:54:31 -07:00
Tim Yung 8ac467c51b Pressable: Add Support for Inspector Overlay
Summary:
Adds support for the debug overlay (enabled via the Inspector) that the legacy touchable components supported.

Changelog:
[General][Added] - Added Inspector overlay support for Pressable

Reviewed By: TheSavior

Differential Revision: D21614412

fbshipit-source-id: b884e04f8dba1bfd35e61de25d33d6d47bc34b03
2020-05-18 10:24:17 -07:00
Kevin Gozali f24b815fe6 use xplat BUCK attribution
Summary:
Internal code attribution update.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21603406

fbshipit-source-id: c3da1823e26beb0092d97e66d731618c0433a2f7
2020-05-15 21:55:52 -07:00
Paige Sun 6cba4d2006 iOS: Fix image instrumentation lifecycle on image cancel
Summary: Internal loggers were not deallocated when images were canceled on RCTImageView

Reviewed By: fkgozali

Differential Revision: D21380284

fbshipit-source-id: 00440cf49708ec03ecd7d9268001aa458ccbf923
2020-05-15 13:43:19 -07:00
Aditya Kumar c2c0581afb Enabling [-Werror,-Wunused-property-ivar] (#28895)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28895

## Summary
Enabling [-Werror,-Wunused-property-ivar]

## Changelog
[Warning] [-Werror,-Wunused-property-ivar] Enable the warning

## Test Plan
Build

Reviewed By: jdthomas

Differential Revision: D20961613

fbshipit-source-id: 8ec73935384800581a71ad96957b716a0d894152
2020-05-15 08:52:39 -07:00
David Vacca d0c4c5eaf9 Delete playTouchSound from UIManagerModule
Summary:
This diff deletes the deprecated PlayTouchSound method from UIManagerModules.

I verified there are no callsites of this method in Facebook sourcecode

changelog: [BREAKING][Android] Deletes the method PlayTouchSound method from UIManagerModule, this method was moved to the SoundManagerModule class.

Motivation: I'm cleaning up my fabric backlog before lockdown

Reviewed By: JoshuaGross, TheSavior

Differential Revision: D21487612

fbshipit-source-id: f630e2b7f927e0b607a30b9f4904feb63a561ab9
2020-05-13 18:18:31 -07:00
Eli White 66103277d2 Pressable: Rename pressRectOffset to pressRetentionOffset to be consistent with other touchables
Summary:
Text and the other Touchables have this prop called pressRetentionOffset. Pressable should be consistent with that.

Changelog:
[Breaking][General]: Pressable: Rename pressRectOffset to pressRetentionOffset to be consistent with other touchables

Reviewed By: yungsters

Differential Revision: D21552255

fbshipit-source-id: 31e64bad9e48ac98e4934dd2f4c0a7f526de5cb6
2020-05-13 12:59:48 -07:00
Rick Hanlon 94c45af136 Add dark mode to loading progress
Summary:
This diff updates the loading banner to respect the RCTAppearance dev mode setting.

Changelog: [General] [iOS] Add dark mode support to loading banner

Reviewed By: fkgozali

Differential Revision: D21429148

fbshipit-source-id: d7d9e778245112a19accf813dcff693f0d187a38
2020-05-12 20:56:06 -07:00
Peter Argany b01fcee4ce Get redbox working in bridgeless mode, disable logbox
Summary: This enables redbox in bridgeless mode, by removing a dep on the bridge. It also disables full screen logbox, since I couldn't figure out how to get it working without the bridge.

Reviewed By: rickhanlonii, ejanzer

Differential Revision: D21440233

fbshipit-source-id: cb1730fefe1639135fdf06039031975d53f95229
2020-05-12 19:55:37 -07:00
Emily Janzer df08d65920 Disable animations on Android again
Summary: We don't yet have native driver support for animations in bridgeless mode on Android, which leads to some weird bugs (like an overlay that never disappears). Let's just disable animations on Android again.

Reviewed By: mdvacca

Differential Revision: D21537982

fbshipit-source-id: b4e8882a414fecbd52dd25e02325b5c588ee68c0
2020-05-12 19:39:36 -07:00
Paige Sun e5a6655e71 iOS: Fix Animated image crash when CADisplayLink target in RCTWeakProxy is nil
Summary:
## Problem
When self is nil, this may crash in RCTUIImageViewAnimated.m.

```
_displayLink = [CADisplayLink displayLinkWithTarget:[RCTWeakProxy weakProxyWithTarget:self] selector:selector(displayDidRefresh:)];
```

## Fix

Replace `RCTWeakProxy` with a concrete class `RCTDisplayWeakRefreshable` that has the displayDidRefresh method, that calls the displayDidRefresh method in its weak target.

### Original Github Issue
https://github.com/facebook/react-native/pull/28070#issuecomment-619295254

Changelog: [iOS] [Fixed] -  Fix Animated image crash when CADisplayLink target in RCTWeakProxy is nil

Reviewed By: shergin

Differential Revision: D21419385

fbshipit-source-id: da7c3c38f81ea54f633da7f59359e07680ea2faf
2020-05-12 17:08:43 -07:00
Moti Zilberman b4785e5144 Forward all bundle URL params through HMR and bundle splitting
Summary:
Forwards any extra parameters set on the main bundle URL (in development) to the derived bundle URLs used in hot reloading and bundle splitting.

Changelog: [General] - Forward URL parameters from main bundle to hot reloaded bundles

Reviewed By: cpojer

Differential Revision: D21455592

fbshipit-source-id: e1c375e3b6a0f3387372f1d96498dbf7d5237a09
2020-05-12 07:35:51 -07:00
Manvir Singh d54113d8c4 implemented showSoftInputOnFocus for iOS (#28834)
Summary:
`showSoftInputOnFocus` was added in https://github.com/facebook/react-native/issues/25028, but it was only added for Android. There was a lot of discussion on the original issue being addressed (https://github.com/facebook/react-native/issues/14045), that there is a need for this on iOS as well. The issue with iOS was brought up again on https://github.com/facebook/react-native/issues/27243.

On a related note, when searching this repo's issues for `showSoftInputOnFocus`, it appears that there are several closed issues that claim that the Android implementation doesn't work (https://github.com/facebook/react-native/issues/25685, https://github.com/facebook/react-native/issues/25687, https://github.com/facebook/react-native/issues/26643). So perhaps the Android implementation needs to be looked at as well (I myself have not gotten around to confirming whether it works or not)

## Changelog

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

Test Plan:
You'd use this just like you would in the Android implementation:
```jsx
<TextInput showSoftInputOnFocus={false} />
```

## GIFs
### Before change
![May-04-2020 20-52-49](https://user-images.githubusercontent.com/4932784/81034028-9d89cf80-8e4a-11ea-906c-64f62504f80c.gif)

### After change
![May-04-2020 20-54-27](https://user-images.githubusercontent.com/4932784/81034035-a11d5680-8e4a-11ea-918e-119a1c9e2a19.gif)

Differential Revision: D21418763

Pulled By: shergin

fbshipit-source-id: 561e72fc2cf16b30446132f6b96b8aa2b4a92daf
2020-05-11 09:01:33 -07:00
William Candillon 797367c089 Fix skewX on Android and in the JS decomposition (#28862)
Summary:
This issue fixes https://github.com/facebook/react-native/issues/27649.

By using 2d decomposition that transforms a skewX into a rotate/scale/rotate, the skewX issue on Android was still there which made me suspect that the issue came from the decomposition algorithm. Then I noticed that the bug existed in the JavaScript decomposition as well which led me to a fix on the JS and therefore on the Android side most likely.

## Changelog

[Android] [Fixed] skewX transforms
Pull Request resolved: https://github.com/facebook/react-native/pull/28862

Test Plan:
Check that skewX works on Android.
On JS, making sure that processTransform() doesn't skip, you can try the following sequence:

```tsx
  const matrix = processTransform([{ skewX: `${Math.PI / 3}rad` }]);
  const result = MatrixMath.decomposeMatrix(matrix);
  console.log({ result });
```

Differential Revision: D21493021

Pulled By: shergin

fbshipit-source-id: 89f7aca5fbfd0f0f8c6f90a26bd76bf8550acaa5
2020-05-11 09:01:33 -07:00
Kevin Gozali e57a2d80a5 OSS: fixed incorrect license headers on some files
Summary:
de667fffa4 (commitcomment-39068402) had incorrect license headers. This fixed them.

Changelog: [General] [Fixed] - fixed license headers on some files

Reviewed By: cpojer

Differential Revision: D21496796

fbshipit-source-id: f9d6b0cf4af0ecf6caacbae2396d73efbc4975fe
2020-05-10 16:16:30 -07:00
Tim Yung a1ac2518a3 TextInput: Default `blurOnSubmit` in JS
Summary:
Consolidates the logic for the default value of `blurOnSubmit` on `TextInput` in the JavaScript component.

This only materially impacts Fabric.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D21491482

fbshipit-source-id: 16d8aba32e7d0321a4583e87e03405ea587e35d4
2020-05-09 17:24:19 -07:00
Peter Argany 13ee5c4c16 Enable animations in bridgeless mode on iOS
Reviewed By: ejanzer

Differential Revision: D21465166

fbshipit-source-id: b34e8e97330b897e20d9a4b05dba1826df569e16
2020-05-08 16:13:42 -07:00
João Vieira 16ea9ba813 Support excluding multiple platforms.
Summary:
Currently the schema only allows to exclude a single platform (iOS OR Android). There are cases where we need to exclude multiple. This change converts the previous `excludePlatform` string property into an `excludePlatforms` array.

Changelog:
[Internal][Changed] - Added support to exclude multiple platforms in Codegen.

Reviewed By: sammy-SC

Differential Revision: D21426950

fbshipit-source-id: eff36ffa207109274794b4b300bf6313f8286161
2020-05-07 09:43:52 -07:00
Rubén Norte 26c120c632 Handle initialProps as optional in renderApplication
Summary:
Pass a default empty object to `AppContainer` if no `initialProps` were passed to `renderApplication`.

This prevents issues on Android, where we do not pass a default empty `initialProps` from native, as we do on iOS.

Changelog: [General] [Fixed] - Handle nullish `initialProps` correctly in `renderApplication`

Reviewed By: motiz88

Differential Revision: D21448692

fbshipit-source-id: 9630bdc2414532999abf3bf9da25047f0482fcab
2020-05-07 05:02:26 -07:00
Yuanzhe Bian 851644cfc2 Fix Animated type
Summary:
- Fixed typing of Animated and fixed the callsites

Changelog: [Internal]

Reviewed By: kacieb

Differential Revision: D21311870

fbshipit-source-id: 386fb496ab00ef7917273dc3eb65e1ed76a8dd33
2020-05-07 00:06:27 -07:00
Tim Yung d14b89bd8a RN: Workaround Fabric + Virtual Text Press Bug
Summary:
Workaround for a bug with Fabric when pressing on virtual text.

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: JoshuaGross

Differential Revision: D21432793

fbshipit-source-id: fe20eeadd5365707fb71edae7a76d374e26b4c86
2020-05-06 14:23:05 -07:00
Kevin Gozali de667fffa4 Moved some NativeModule JS specs to OSS
Summary:
For some reason the specs were internal, but the native impl is still in github. So let's move these to github for consistency.

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D21419934

fbshipit-source-id: f2c4486edca43c4348f3a3c6ce98f76a322bab0b
2020-05-06 12:20:48 -07:00
Rick Hanlon 41f0d9ba8f Rename error titles
Summary:
Based on feedback we're updating these titles to be more clear for their source.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D21413486

fbshipit-source-id: c144e7f759a4ff263b7ec80fa643eeb8ffac741b
2020-05-06 11:40:22 -07:00
Rick Hanlon 5066b662f2 LogBox - Always display the first fatal error
Summary:
This diff fixes an off-by-one error probably caused by my font ligatures where when exactly two exceptions are thrown at the same time we would show the second exception instead of the first. If three or more were thrown, we would show the second.

I also fixed some tests that had the wrong descriptions and wrong behavior enforced.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D21413186

fbshipit-source-id: 8e2940c89251dc042b10c6a2a2186089b6e7b53d
2020-05-06 11:40:22 -07:00
Paige Sun b0d0e51a77 iOS: Animated image should animate at the same speed regardless of framerate
Summary:
In iOS 11, [CADisplayLink](https://developer.apple.com/documentation/quartzcore/cadisplaylink)'s frameInterval was deprecated in favor of preferredFramesPerSecond, but these two properties have different underlying assumptions.

- set frameInterval to 2 for 30fps
- set preferredFramesPerSecond to 30 for 30fps. When you use preferredFramesPerSecond, assume frameInterval is 1.

This fix ensures gifs in <Image> component will animate at same speed regardless of framerate.

Reviewed By: shergin

Differential Revision: D21414014

fbshipit-source-id: 40ab23bab1990cf65d2802830b6835f350999537
2020-05-06 10:38:14 -07:00
Emily Janzer edfd965c46 Update native module specs
Summary: As titled.

Reviewed By: fkgozali

Differential Revision: D21417307

fbshipit-source-id: 7c6b0179f9f1a5108da241d181a24f707a083deb
2020-05-05 19:37:02 -07:00
Mats Byrkjeland de7f69a58e Fix type of exported Touchables: ComponentType -> AbstractComponent (#28737)
Summary:
Fixes https://github.com/facebook/react-native/issues/28726

When importing TouchableOpacity, it is treated as any by Flow. Replacing ComponentType with AbstractComponent works.

The [Flow documentation](https://flow.org/en/docs/react/types/#toc-react-componenttype) says the following about ComponentType:
> Note: In 0.89.0+, React.ComponentType is an alias for React.AbstractComponent<Config, any>, which represents a component with config type Config and any instance type.

So I'm thinking that since the instance type is treated as any with ComponentType, Flow treats TouchableOpacity as any as well.

## Changelog

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

[General] [Fixed] - Fix Touchable{Opacity,Bounce,Highlight} being exported as `any` (Flow)
Pull Request resolved: https://github.com/facebook/react-native/pull/28737

Test Plan: I have done the same changes to react-native in my project's node_modules and seen that the components TouchableOpacity went from any to AbstractComponent with some props. Now I have a bunch of errors because I'm sending in wrong props to some touchables, which is good!

Reviewed By: cpojer

Differential Revision: D21362601

Pulled By: TheSavior

fbshipit-source-id: 5b98cc79eaef034eccdb7f47242f9f44be2ef2b8
2020-05-05 12:44:50 -07:00
Rubén Norte 4f5a092bf6 Pass initial props to WrapperComponent
Summary:
`renderApplication` receives the root component that we need to render and an optional wrapper component. There are cases where we want to use the initial props passed to the root component in the wrapper component as well (e.g.: to provide a specific context to the root component), so this adds modifies `AppContainer` to accept the initial props and inject them into the wrapper component.

Changelog: [General] [Added] - Modified `renderApplication` to forward `initialProps` to `WrapperComponent`

Reviewed By: fkgozali

Differential Revision: D21347486

fbshipit-source-id: 1c4f702a3875077630de1a44d3ac9ef2c80bc10c
2020-05-05 04:54:56 -07:00
Joshua Gross aae38c3dfe Support calling LayoutAnimation APIs in Fabric from JS
Summary:
Call Fabric's LayoutAnimation APIs from JS.

Changelog: [Internal] A step towards supporting LayoutAnimations on Fabric

Reviewed By: shergin, mdvacca

Differential Revision: D21297975

fbshipit-source-id: 6d530b01d8152e7c803a7c0299b918a32fb39dc0
2020-05-04 21:28:35 -07:00
Kacie Bawiec 7f2515ece8 Add warning when scrollRef does not have a scrollTo method
Summary:
Add a `console.warn()` call when calling `_scrollRef.scrollTo`, because `scrollTo` is not guaranteed to exist on `_scrollRef`.

Context:
`VirtualizedList` holds `_scrollRef`, which is usually a reference to a `ScrollView` component. However, there are several cases where it holds a `View` or other type of component instead.

A custom component can be passed in to `renderScrollComponent`, and then `_scrollRef` will point to that custom component. Additionally, if two VirtualizedLists are nested with the same orientation, `_defaultRenderScrollComponent` will return a View instead of a ScrollView.

Due to these possibilities, `_scrollRef` is not guaranteed to have a `scrollTo` method.

Changelog: [General] [Added] - Add warning when scrollRef does not have a scrollTo method

Reviewed By: JoshuaGross, TheSavior

Differential Revision: D21386842

fbshipit-source-id: 01e167e0ae0edea8f29853e8b242ce88a5103b49
2020-05-04 16:42:13 -07:00
Tim Yung ddea7c76b3 VirtualizedList: Remove `PropTypes` Dependency
Summary:
Removes `PropTypes` as a dependency of `VirtualizedList` by no longer validating the return value of `getItemLayout`.

Changelog: [Internal]

Reviewed By: TheSavior, cpojer

Differential Revision: D21370890

fbshipit-source-id: 966db3557b714987aa91179c7654a5ebf27818ad
2020-05-04 01:00:07 -07:00
Tim Yung 7bd694fc6f VirtualizedList: Migrate to React.Context
Summary:
Migrates `VirtualizedList` off legacy context by creating `VirtualizedListContext`.

Changelog:
[General][Changed] - Migrated `virtualizedList` legacy context to `React.Context`.

Reviewed By: TheSavior

Differential Revision: D21370882

fbshipit-source-id: 2fa99ee0bc0e6b747a2d3fe7c66ee402c6b9c5af
2020-05-04 01:00:06 -07:00
zhongwuzw 9cdc19a936 Fixes TextInput shaking when typing Chinese (#28805)
Summary:
Fixes https://github.com/facebook/react-native/issues/28488.

## Changelog

[iOS] [Fixed] - Fixes TextInput shaking when typing Chinese
Pull Request resolved: https://github.com/facebook/react-native/pull/28805

Test Plan: Demo see https://github.com/facebook/react-native/issues/28488.

Differential Revision: D21376803

Pulled By: shergin

fbshipit-source-id: b1fe6cc5f67d42ef98a6c12b8ab9990feac0e2a7
2020-05-04 00:28:58 -07:00
Kevin Gozali 8ad810717e iOS: when the bridge has been invalidated, NativeModule lookup should just return nil
Summary:
There's a corner case where:
* The bridge gets invalidated, and native modules are cleaning up themselves (but not done yet)
* Something asks for a NativeModule instance - ideally it should just get nil at this point
* If TM Manager is invalidating, we get nil correctly, but we continue thru the old NativeModule lookup logic
* The latter will fail anyway, and would throw a redbox (RCTLogError).

So, if the bridge is invalidated, if TM Manager returns nil, we should just return nil for old NativeModule lookup.

The module of interest is RCTImageLoader, which was requested by RCTImageView on deallocation. The problem is RCTImageView got dealloc'ed **after** the bridge has been invalidated, so the lookup would always fail...

Bonus: RCTImageView should just keep a weak ref to the RCTImageLoader, so that:
* if the imageLoader is still alive on image dealloc, it can still access them (last minute "meaningless" cleanup)
* if the imageLoader is gone, then the image deallocation doesn't do anything

Changelog: [iOS] [Fixed] - Fix module lookup race condition on bridge invalidation.

Reviewed By: p-sun, sammy-SC

Differential Revision: D21371845

fbshipit-source-id: 862dc07de18ddbfb90e87e24b8dbd001147ddce4
2020-05-03 09:32:54 -07:00
Boyang Yu 12f8b2598f fix duration calculation for RCTUIImageViewAnimated
Summary:
## Changelog:
[iOS] [Fixed] - Fix duration calculation for RCTUIImageViewAnimated

Reviewed By: p-sun, shergin

Differential Revision: D21321089

fbshipit-source-id: 7464231bbc3b90e70d3ba95288fd90707d3d24af
2020-05-01 12:41:31 -07:00
Samuel Susla 2047041c53 Use InteropLayer for ReactART
Summary:
Changelog: [Internal]

Use InteropLayer to bridge ReactART into Fabric.

Reviewed By: shergin

Differential Revision: D21302151

fbshipit-source-id: 46deb381389c6fa87ecad296f616fbaccb29fe30
2020-05-01 03:47:26 -07:00
David Vacca f7e88387fb Enable Animated in Venice
Summary:
This diff extends venice app to render an Animation example test

changelog: [Internal][Android] Internal change to enable Animated in RN Bridgless mode

Reviewed By: PeteTheHeat

Differential Revision: D21317630

fbshipit-source-id: 9726fea9baba86191e63df909639d1d47ef5f359
2020-04-29 19:32:48 -07:00
Rick Hanlon 3729fe8de0 Update loading banner text and colors
Summary:
This diff updates the loading banner text and color on iOS for better UX.

Flow before:
- Loading from localhost:8081...
- Loading 20% (1000/5000)...
- Downloading JavaScript Bundle 20% (10/50)
- Downloading JavaScript Bundle...

After:
- Loading from Metro...
- Bundling 20%...
- Downloading 20%...
- Downloading...

Changelog: [Added] [iOS] Updated loading banner messages and color

Reviewed By: PeteTheHeat

Differential Revision: D21279939

fbshipit-source-id: fd7d90f85e25ce175a87087dfccf2180d49e3e98
2020-04-28 23:20:17 -07:00
Daiki Ihara 78d2b3c813 refine invariant error message at scrollToIndex (#28464)
Summary:
I refined the error message of scrollToIndex.

When I used scrollToIndex with `index:0` and data that length is 0, I met the odd error message `Invariant Violation scrollToIndex out of range: requested index 0 but maximum is -1`.

Next, I thought that scrollToIndex with `index:-1` meant scrollToTop without checking data length. I met `Invariant Violation: scrollToIndex out of range: requested index -1 but maximum is -1`

Finally, I wondered what will happen to use scrollToIndex with `index:-1` and data that length is `5`. The result is `Invariant Violation: scrollToIndex out of range: requested index -1 but maximum is 5`

The above error messages will confuse us. I clarified the boudaries and separated the error messages

## Changelog

[General] [Fixed] - Clarified the boundaries in error message of scrollToIndex
Pull Request resolved: https://github.com/facebook/react-native/pull/28464

Test Plan:
I added 3 test cases to cover the new error messages for VirtualizedList.
Run `yarn test` and confirm it passes.

Reviewed By: cpojer

Differential Revision: D21140133

Pulled By: TheSavior

fbshipit-source-id: 9a7a704f7ec599d833d2ed3ca2be059d950539b5
2020-04-28 19:15:05 -07:00
Samuel Susla e68f9bf768 Calling Paper TextInput setTextAndSelection view command now dirties layout
Summary:
Changelog: [Internal]

Previously `setTextAndSelection` was not dirtying layout. This would cause an issue where `setTextAndSelection` causes layout change. For example calling setTextAndSelection with empty string on a multiline auto expanding text input.

I changed one example in TextInputSharedExamples.js, "Live Re-Write (no spaces allowed) and clear" example is now multiline. This allows to test whether `setTextAndSelection` dirties layout. Enter multiline string to to the example text input and press clear. Observe that the text input shrinks to single line height.

Reviewed By: shergin

Differential Revision: D21182990

fbshipit-source-id: de8501ea0b97012cf4cdf8d5f658649139f92da6
2020-04-27 03:23:34 -07:00
Paige Sun e3e900805b Fix image instrumentation internal lifecycle
Reviewed By: fkgozali

Differential Revision: D20980822

fbshipit-source-id: d0a4a031046509425fbf6662471246ed2ab48a4c
2020-04-27 01:39:49 -07:00
simek 2b56011f9c Add Dark Mode support to the App template and NewAppScreen components (#28711)
Summary:
This PR adds support for the dark mode and dynamic theme changing to the default App template and to the related `NewAppScreen` components. Using `useColorScheme` hook forced me to refactor a bit main `App.js` file, but I think those changes are step in the right direction according to way in which React Native is used in larger apps, so new `Section` component has been extracted to reduce code redundancy/repetition inside `App`.

Additional color `darker` has been added to the `Colors` statics from `NewAppScreen` because `dark` was too bright for the Dark Mode backgrounds.

Also main `StoryBoard` on iOS has been updated to use theme based colors instead of static or hardcoded ones. There was also an unused, empty `Label` which I have removed.

~~I'm not so much experienced with Android. If someone could also update Android splash screen (if Android requires such change) it will be nice. I want to look at this later using simulator.~~
> I have updated the Android splash screen and tested this change on the Android emulator.

If you have any comment or corrections feel free to post them out, I would like to put more work into this PR if it's needed. Dark Mode this days is a part of near every OS, so it could be considered as a standard feature. I hope those changes helps people which struggle with the basic theming implementation (+ there is now an example of hook and `children` prop usage in the template).

## Changelog

[Internal] [Added] - Add dark mode support to the default app template
Pull Request resolved: https://github.com/facebook/react-native/pull/28711

Test Plan:
I have tested the App from the template on the iOS device and in Android emulator with RN `0.63.0-rc`.

Screen recording on iOS (demonstarates both modes, both splash screens and transition):
![ezgif-6-e24ee8e839c9](https://user-images.githubusercontent.com/719641/80025923-a04b0300-84e1-11ea-824a-b4363db48892.gif)

Screenshot of iOS app in Dark Mode:
![IMG_6542](https://user-images.githubusercontent.com/719641/79885748-c98f6480-83f7-11ea-8c73-1351a721d5d6.PNG)

Screenshot of iOS app splash screen in Dark Mode:
![IMG_6544](https://user-images.githubusercontent.com/719641/79960431-add29f80-8485-11ea-985c-b39176024ffa.PNG)

Screenshot of Android app in the emulator:
![Screenshot_1587566100](https://user-images.githubusercontent.com/719641/79995454-88f72000-84b7-11ea-810b-dfb70de03c2a.png)

Differential Revision: D21236148

Pulled By: shergin

fbshipit-source-id: 0c8a9534d3a3f8f8099af939243a889ac4df6cda
2020-04-24 14:35:53 -07:00
Joshua Gross ed29ba13f9 Support `contentOffset` property in Android's ScrollView and HorizontalScrollView
Summary:
For a very long time, iOS has supported the `contentOffset` property but Android has not:

https://github.com/facebook/react-native/issues/6849

This property can be used, primarily, to autoscroll the ScrollView to a starting position when it is first rendered, to avoid "jumps" that occur by asynchronously scrolling to a start position.

Changelog: [Android][Changed] ScrollView now supports `contentOffset`

Reviewed By: mdvacca

Differential Revision: D21198236

fbshipit-source-id: 2b0773569ba42120cb1fcf0f3847ca98af2285e7
2020-04-23 15:39:45 -07:00
Joshua Gross bda8aaeec2 Modal: disable view flattening explicitly for the children of Modal, the content wrappers
Summary:
I noticed that in ModalHostShadowNode.java (not used in Fabric), there's an assumption that the Modal will have exactly one child on the native side; this child is explicitly specified in Modal.js.

However, in Fabric, these views are flattened and so the Modal will actually have N children - whatever children the product code passes into the Modal.

In *theory* this should be fine, but might be causing issues. Not sure.

This is an experiment and shouldn't be landed until we verify that (1) this actually matters, (2) that it fixes an issue with Modal on iOS or Android.

Changelog: [Internal] Change to make Fabric consistent with non-Fabric Modal

Reviewed By: mdvacca

Differential Revision: D21191822

fbshipit-source-id: 9d65f346387fd056649d4063d70220f637ba8828
2020-04-23 15:39:45 -07:00
Jesse Katsumata a903d1b86a BackHandler: specify function return type for handler (#28192)
Summary:
Following the comment https://github.com/DefinitelyTyped/DefinitelyTyped/pull/42618#discussion_r384584159

Modify the flowtype of BackHandler function to have more specific return type.

## Changelog

[General] [Changed] - Changed type of BackHandler to be more specific.
Pull Request resolved: https://github.com/facebook/react-native/pull/28192

Test Plan: No flow error in RNTester

Reviewed By: TheSavior

Differential Revision: D20771113

Pulled By: hramos

fbshipit-source-id: 5ca65e2a2b3f8726b8fb4606473d8fad5b0ce730
2020-04-23 14:13:06 -07:00
Jonny Burger a2f8b9c36e Set black as default text color for <TextInput/> on iOS (#28708)
Summary:
This is a follow-up pull request to https://github.com/facebook/react-native/issues/28280 (reviewed by shergin).
This pull request tried to solve the problem of the default color in a TextInput in dark mode on iOS being white instead of black. I got suggested to solve the problem not on the level of RCTTextAttributes, but on the level of RCTUITextField.

Setting `self.textColor = [UIColor black];` in the constructor did not work, because it gets overwritten by nil in `RCTBaseTextInputView.m`. There I implemented the logic that if NSForegroundColorAttributeName color is nil then the color is being set to black. I think the `defaultTextAttributes` property confuses here, because it ends up being the effective text attributes, e.g. if I unconditionally set the default text color to black, it cannot be changed in React Native anymore. So I put the nil check in.

## Changelog

[iOS] [Fixed] - TextInput color has the same default (#000) on iOS whether in light or dark mode
Pull Request resolved: https://github.com/facebook/react-native/pull/28708

Test Plan:
I have manually tested the following:
- The default text color in light mode is black
- The default text color in dark mode is black
- The color can be changed using the `style.color` attribute
- Setting the opacity to 0.5 results in the desired behavior, the whole TextInput becoming half the opacity.
– Setting the `style.color` to rgba(0, 0, 0, 0.5) works as intended, creating a half-opaque text color.

Differential Revision: D21186579

Pulled By: shergin

fbshipit-source-id: ea6405ac6a0243c96677335169b214a2bb9ccc29
2020-04-22 23:43:34 -07:00
Panagiotis Vekris 57fee33898 Flow 0.123.0 in xplat/js
Summary:
Changelog: [Internal]

## Sync of generated files

Ran
```
js1 upgrade www-shared -p core_windowless
```
but had to manually revert
```
RKJSModules/Libraries/www-shared/core_windowless/logging/FBLoggerType.flow.js
RKJSModules/Libraries/www-shared/core_windowless/logging/FBLogger.js
```
because they introduced more errors

## Flow version bump
```
~/fbsource/fbcode/flow/facebook/deploy_xplat.sh 0.123.0
```

Reviewed By: gkz

Differential Revision: D21159821

fbshipit-source-id: e106fcb43e4fc525b9185f8fc8a246e6c3a6b14f
2020-04-21 22:43:24 -07:00
Tim Yung 5242ad931b RN: Add `RootTag` Type to TurboModule
Summary:
Adds `RootTag` as a valid type for arguments and return types in TurboModules (on both Android and iOS).

This will enable us to change `RootTag` into an opaque type. There are two compelling reasons to do this:

- JavaScript will no longer be able to safely depend on `RootTag` being a number (which means we can change this in the future).
- Call sites using `unstable_RootTagContext` will can get a `RootTag`, but call sites using the legacy `context.rootTag` will not. This means the opaque type will give us a strategy for migrating away from legacy context and eventually making `unstable_RootTagContext` the only way to access `RootTag`.

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: RSNara

Differential Revision: D21127170

fbshipit-source-id: baec9d7ad17b2f8c4527f1a84f604fc0d28b97eb
2020-04-21 19:15:54 -07:00
Tim Yung a850d116dc RN: Create `RootTag` Type
Summary:
Creates a `RootTag` type and refactors the `RootTagContext` module a bit.

This creates space for eventually changing `RootTag` into an opaque type that is only created once by `AppContainer`, and only consumed by native abstractions.

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: cpojer

Differential Revision: D21127173

fbshipit-source-id: 60177a6e5e02d6308e87f76d12a271114f8f8fe0
2020-04-21 19:15:53 -07:00
Christoph Nakazawa f248ba1c8b Upgrade to Jest 25
Summary:
This diff upgrades Jest to the latest version which fixes a bunch of issues with snapshots (therefore allowing me to enable the Pressable-test again). Note that this also affects Metro and various other tooling as they all depend on packages like `jest-worker`, `jest-haste-map` etc.

Breaking changes: https://github.com/facebook/jest/blob/master/CHANGELOG.md

This diff increases node_modules by 3 MiB, primarily because it causes more duplicates of `source-map` (0.8 MiB for each copy) and packages like `chalk` 3.x (vs 2.x). The base install was 15 MiB bigger and I reduced it to this size by playing around with various manual yarn.lock optimizations. However, D21085929 reduces node_modules by 11 MiB and the Babel upgrade reduced node_modules by 13 MiB. I will subsequently work on reducing the size through other packages as well and I'm working with the Jest folks to get rid of superfluous TypeScript stuff for Jest 26.

Other changes in this diff:
* Fixed Pressable-test
* Blackhole node-notifier: It's large and we don't need it, and also the license may be problematic, see: https://github.com/facebook/jest/pull/8918
* Updated jest-junit (not a Jest package) but blackholed it internally because it is only used for open source CI.
* Updated some API calls we use from Jest to account for breaking changes
* Made two absolutely egrigious changes to existing product code tests to make them still pass as our match of async/await, fake timers and then/promise using `setImmediate` is tripping up `regenerator` with `Generator is already run` errors in Jest 25. These tests should probably be rewritten.
* Locked everything to the same `resolve` version that we were already using, otherwise it was somehow pulling in 1.16 even though nothing internally uses it.

Changelog: [General] Update Jest

Reviewed By: rickhanlonii

Differential Revision: D21064825

fbshipit-source-id: d0011a51355089456718edd84ea0af21fd923a58
2020-04-20 01:27:35 -07:00
Jason Safaiyeh 335f3aabe2 Migrate deprecated frameInterval to preferredFramesPerSecond (#28675)
Summary:
[frameInterval](https://developer.apple.com/documentation/quartzcore/cadisplaylink/1621231-frameinterval) was deprecated in favor of [preferredFramesPerSecond](https://developer.apple.com/documentation/quartzcore/cadisplaylink/1648421-preferredframespersecond).

This migrates the deprecated call over.

## Changelog

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

[iOS] [Fixed] - Migrate frameInterval to preferredFramesPerSecond
Pull Request resolved: https://github.com/facebook/react-native/pull/28675

Test Plan: Xcode should no longer throw warnings about the deprecated call.

Differential Revision: D21109710

Pulled By: shergin

fbshipit-source-id: 772b9f625d3e22cd4d8cd60bddad57ff8611af54
2020-04-18 17:52:52 -07:00
Zack Argyle 0a67133124 Make ColorValue public in StyleSheet.js
Summary:
This diff makes the ColorValue export "official" by exporting it from StyleSheet in order to encourage its use in product code.

Changelog: Moved ColorValue export from StyleSheetTypes to StyleSheet

Reviewed By: TheSavior

Differential Revision: D21076969

fbshipit-source-id: 972ef5a1b13bd9f6b7691a279a73168e7ce9d9ab
2020-04-17 13:03:47 -07:00
Ramanpreet Nara 03bd7d799e Part 2: Update ObjC++ codegen classes to use ObjCTurboModule::InitParams
Summary:
## Summary
Please check out D21035209.

## Changes
- Codemod all ObjC NativeModule `getTurboModuleWithJsInvoker:nativeInvoker:perfLogger` methods to `getTurboModule:(const ObjCTurboModule::Args)`

## Script
```
var withSpaces = (...args) => args.join('\s*')

var regexString = withSpaces(
  '-',
  '\(',
  'std::shared_ptr',
  '<',
  '(?<turboModuleClass>(facebook::react::|react::|::|)TurboModule)',
  '>',
  '\)',
  'getTurboModuleWithJsInvoker',
  ':',
  '\(',
  'std::shared_ptr',
  '<',
  '(?<fbNamespace>(facebook::react::|react::|::|))CallInvoker',
  '>',
  '\)',
  '(?<jsInvokerInstance>[A-Za-z0-9]+)',
  'nativeInvoker',
  ':',
  '\(',
  'std::shared_ptr',
  '<',
  '(facebook::react::|react::|::|)CallInvoker',
  '>',
  '\)',
  '(?<nativeInvokerInstance>[A-Za-z0-9]+)',
  'perfLogger',
  ':',
  '\(',
  'id',
  '<',
  'RCTTurboModulePerformanceLogger',
  '>',
  '\)',
  '(?<perfLoggerInstance>[A-Za-z0-9]+)',
  '{',
  'return',
  'std::make_shared',
  '<',
  '(?<specName>(facebook::react::|react::|::|)Native[%A-Za-z0-9]+SpecJSI)',
  '>',
  '\(',
  'self',
  ',',
  '\k<jsInvokerInstance>',
  ',',
  '\k<nativeInvokerInstance>',
  ',',
  '\k<perfLoggerInstance>',
  '\)',
  ';',
  '}',
)

var replaceString = `- (std::shared_ptr<$<turboModuleClass>>) getTurboModule:(const $<fbNamespace>ObjCTurboModule::InitParams &)params
{
  return std::make_shared<$<specName>>(params);
}`

const exec = require('../lib/exec');
const abspath = require('../lib/abspath');
const relpath = require('../lib/relpath');
const readFile = (filename) => require('fs').readFileSync(filename, 'utf8');
const writeFile = (filename, content) => require('fs').writeFileSync(filename, content);

function main() {
  const tmFiles = exec('cd ~/fbsource && xbgs -n 10000 -l getTurboModuleWithJsInvoker:').split('\n').filter(Boolean);

  tmFiles
    .filter((filename) => !filename.includes('microsoft-fork-of-react-native'))
    .map(abspath)
    .forEach((filename) => {
      const source = readFile(filename);
      const newSource = source.replace(new RegExp(regexString, 'g'), replaceString);

      if (source == newSource) {
        console.log(relpath(filename));
      }

      writeFile(filename, newSource);
    });
}

if (!module.parent) {
  main();
}
```

## Re-generating diff
```
> hg revert -r .^ --all
> node index.js # run script
```

Changelog: [iOS][Changed] - Make all ObjC NativeModules create TurboModules using ObjCTurboModule::Args

Reviewed By: PeteTheHeat

Differential Revision: D21036265

fbshipit-source-id: 404bcc548d1775ef23d793527606d02fe384a0a2
2020-04-16 17:29:55 -07:00
Ramanpreet Nara 251ff1bb0a Part 1: Update ObjC++ codegen classes to use ObjCTurboModule::InitParams
Summary:
## Summary
Please check out D21035208.

## Changes
- `ObjCTurboModule::ObjCTurboModule` changed to accept a bag of arguments `const ObjCTurboModule::InitParams` instead of an argument list.
- TurboModule iOS codegen scripts updated to generated `ObjCTurboModule` subclasses that accept a `const ObjCTurboModule::InitParams` object in their constructor, and forward it to `ObjCTurboModule::ObjCTurboModule`.
- All manually checked in code-generated ObjC++ classes (i.e: RCTNativeSampleTurboModule, RCTTestModule, FBReactNativeSpec) are updated.

## Rationale
This way, the code-gen can remain constant while we add, remove, or modify the arguments passed to ObjCTurboModule.

## Commands run
```
function update-codegen() {
  pushd ~/fbsource && js1 build oss-native-modules-specs -p ios && js1 build oss-native-modules-specs -p android && popd;
}

> update-codegen
```

Changelog:
[iOS][Changed] Update ObjCTurboModule to use ObjCTurboModule::InitParams

Reviewed By: PeteTheHeat

Differential Revision: D21036266

fbshipit-source-id: 6584b0838dca082a69e8c14c7ca50c3568b95086
2020-04-16 17:29:55 -07:00
Christoph Nakazawa 75a6178279 Update Babel to 7.8.x/7.9.x
Reviewed By: motiz88

Differential Revision: D20697095

fbshipit-source-id: ef35d02da0916109ce528d3026f7ca0956911dda
2020-04-15 01:30:45 -07:00
Samuel Susla b861782562 Remove setMostRecentEventCount from TextInput view commands
Summary:
Changelog: [Internal]

We don't use view command `setMostRecentEventCount`, let's get rid of it.

Reviewed By: JoshuaGross

Differential Revision: D21016600

fbshipit-source-id: 6491c063e9d6a89252300cb47c010b248e473f4b
2020-04-14 15:27:59 -07:00
Samuel Susla 9c54bf4199 Remove redundant input from TextInput
Summary:
`const ReactNative` is assigned to but never used. Let's get rid of it.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D21016502

fbshipit-source-id: afcb0cfc501adf07e0c4d4452a831160e1cda088
2020-04-14 10:59:43 -07:00