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

5904 Коммитов

Автор SHA1 Сообщение Дата
Ramanpreet Nara 69698b25fc Codemod all getTurboModuleWithJsInvoker methods to accept a native CallInvoker
Summary:
To make iOS TurboModules integrate with the bridge's onBatchComplete event, they need to use a native CallInvoker. This call invoker is created by the `NativeToJsBridge`, and ObjCTurboModule will use this native CallInvoker to dispatch TurboModule method calls. This diff makes sure that ObjCTurboModules are created with that native CallInvoker.

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

var regexString = withSpaces(
  '-',
  '\(',
  'std::shared_ptr',
  '<',
  '(?<turboModuleClass>(facebook::react::|react::|::|)TurboModule)',
  '>',
  '\)',
  'getTurboModuleWithJsInvoker',
  ':',
  '\(',
  'std::shared_ptr',
  '<',
  '(?<callInvokerClass>(facebook::react::|react::|::|)CallInvoker)',
  '>',
  '\)',
  '(?<jsInvokerInstance>[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<perfLoggerInstance>',
  '\)',
  ';',
  '}',
)

var replaceString = `- (std::shared_ptr<$<turboModuleClass>>)
    getTurboModuleWithJsInvoker:(std::shared_ptr<$<callInvokerClass>>)$<jsInvokerInstance>
                  nativeInvoker:(std::shared_ptr<$<callInvokerClass>>)nativeInvoker
                     perfLogger:(id<RCTTurboModulePerformanceLogger>)$<perfLoggerInstance>
{
  return std::make_shared<$<specName>>(self, $<jsInvokerInstance>, nativeInvoker, $<perfLoggerInstance>);
}`

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();
}
```

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D20809202

fbshipit-source-id: 5d39b3cacdaa5681b70ce1803351d0432dd74550
2020-04-03 02:27:10 -07:00
Ramanpreet Nara 7e16a9d5e2 Manual changes required to make ObjCTurboModule accept native CallInvoker
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D20809200

fbshipit-source-id: d540eec9a3360a031f75d76a6ab9fb15303f8af5
2020-04-03 02:27:10 -07:00
Rick Hanlon ec0c65c4b2 Improve component stack parsing
Summary:
Update the error log message parsing to fix missing component stacks in console.errors.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D20801985

fbshipit-source-id: ae544200315a8c3c0310e8370bc38b0546734f38
2020-04-01 16:43:15 -07:00
Emilis Baliukonis 232517a574 Implement nativePerformanceNow to improve Profiler API results (#27885)
Summary:
When experimenting with React Profiler API (https://reactjs.org/docs/profiler.html), I noticed that durations are integers without a debugger, but they are doubles with higher precision when debugger is attached. After digging into React Profiler code, I found out that it's using `performance.now()` to accumulate execution times of individual units of work. Since this method does not exist in React Native, it falls back to Javascript `Date`, leading to imprecise results.

This PR introduces `global.nativePerformanceNow` function which returns precise native time, and a very basic `performance` polyfill with `now` function.

This will greatly improve React Profiler API results, which is essential for profiling and benchmark tools.

Solves https://github.com/facebook/react-native/issues/27274

## Changelog

[General] [Added] - Implement `nativePerformanceNow` and `performance.now()`
Pull Request resolved: https://github.com/facebook/react-native/pull/27885

Test Plan:
```
const initialTime = global.performance.now();
setTimeout(() => {
  const newTime = global.performance.now();
  console.warn('duration', newTime - initialTime);
}, 1000);
```

### Android + Hermes

![Screenshot_1580198068](https://user-images.githubusercontent.com/13116854/73245757-af0d6c80-41b5-11ea-8130-dde14ebd41a3.png)

### Android + JSC

![Screenshot_1580199089](https://user-images.githubusercontent.com/13116854/73246157-92256900-41b6-11ea-87a6-ac222383200c.png)

### iOS

![Simulator Screen Shot - iPhone 8 - 2020-01-28 at 10 06 49](https://user-images.githubusercontent.com/13116854/73245871-f136ae00-41b5-11ea-9e31-b1eff5717e62.png)

Reviewed By: ejanzer

Differential Revision: D19888289

Pulled By: rickhanlonii

fbshipit-source-id: ab8152382da9aee9b4b3c76f096e45d40f55da6c
2020-03-31 10:23:51 -07:00
Bartosz Kaszubowski f21f922c83 Update PixelRatio 'getFontScale' method description (#28407)
Summary:
Refs facebook/react-native-website#1776.

Despite in-code description `PixelRatio.getFontScale()` is working properly on the iOS (it also reflects the user settings).

This PR updates the in-code description to match current behaviour.

I have decided to skip in the code information about additional setting in `Accessibility` menu and in `Control Centre`, but if you think it is important just let me know, I can update this PR.

## Changelog

[Internal] [Fixed] - Fix PixelRatio getFontScale method description
Pull Request resolved: https://github.com/facebook/react-native/pull/28407

Test Plan: N/A

Differential Revision: D20750260

Pulled By: shergin

fbshipit-source-id: c40ec2fd49cd60e2975351c3a1c453aab0045da4
2020-03-30 16:37:18 -07:00
Rick Hanlon 21396bb380 Enable inspector for Fabric
Summary:
## Overview
This diff refactors the Inspector, moving logic to look up view data for a touched view inside the renderer as `getInspectorDataForViewAtPoint`. We then implement that same function for Fabric in order to support the inspector in that renderer.

Requires https://github.com/facebook/react/pull/18388

## Motivation

Reason one for this refactor is that, previously, the inspector held all of the logic to look up view data for a given x,y touch coordinate. To do this, it would take the React tag and coordinates, look up the native view tag, measure it, and then ask React internals for the Fiber information of that tag. All of this is deeply coupled to React internals, yet the logic is outside of React core in the Inspector.

Reason two is that, for Fabric, the logic for getting the view data is different than Paper. In Fabric, we pass the x,y coordinates to native directly, which returns an instance handle. That handle can be used to measure the ShadowNode, or retrieve the Fiber information.

By moving the logic into the renderer in React core, we decouple the implementation details of looking up view data for a tapped point and allow ourselves the ability to add and change renderer-specific code for the actual lookup without impacting outsiders like the Inspector.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D20291710

fbshipit-source-id: a125223f2e44a6483120c41dc6146ad75a0e3e68
2020-03-30 14:05:27 -07:00
Rick Hanlon 3276563806 Partial React Sync for Inspector
Summary:
Partial sync for React that includes:

- https://github.com/facebook/react/pull/18388
- dd7e5e4f5a

Created from this branch: https://github.com/facebook/react/compare/master...rickhanlonii:rh-partial-3-24?expand=1

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D20651395

fbshipit-source-id: 67baf7c407f75d9fd01c17f2203a77a38567100e
2020-03-30 14:05:26 -07:00
Tom Underhill 602070f44b Add ES Lint rules for `DynamicColorIOS()`and `ColorAndroid()` (#28398)
Summary:
The [PlatformColor PR](https://github.com/facebook/react-native/pull/27908) added support for iOS and Android to express platform specific color values.   The primary method for an app to specify such colors is via the `PlatformColor()` method that takes string arguments.   The `PlatformColor` method returns an opaque Flow type enforcing that apps use the PlatformColor method instead of creating Objects from scratch -- doing so would make it harder to write static analysis tools around Color values in the future.   But in addition to `PlatformColor()`, iOS has a `DynamicColorIOS()` method that takes an Object.   The Flow type for this Object cannot be opaque, but we still want to enforce that app code doesn't pass variables instead of Object literals or that values in the Objects are variables.   To ensure `DynamicColorIOS()` can be statically analyzed this change adds an ESLint rule to enforce that `DynamicColorIOS()` takes an Object literal of a specific shape.   A `ColorAndroid()` was also introduced not for practical use but just to test having platform specific methods for more than one platform in the same app.   A second ESLint rule is created for `ColorAndroid` as well.

## Changelog

[General] [Changed] - Add ES Lint rules for `DynamicColorIOS()`and `ColorAndroid()`
Pull Request resolved: https://github.com/facebook/react-native/pull/28398

Test Plan: `yarn lint` passes.

Reviewed By: cpojer

Differential Revision: D20685383

Pulled By: TheSavior

fbshipit-source-id: 9bb37ccc059e74282b119577df0ced63cb9b1f53
2020-03-27 23:02:15 -07:00
Kacie Bawiec b119a00c45 Remove console warnings from ScrollView methods
Summary:
The newly added console warnings in D19304480 are adding a lot of warning noise due to missed infra callsites. Those callsites need to be updated before these warnings can be added.

Changelog:
[Removed] Remove console warnings from ScrollView methods

Reviewed By: rickhanlonii

Differential Revision: D20700917

fbshipit-source-id: cb618ee3a291d26e1942e4f91bbc02dee41fb78b
2020-03-27 15:28:48 -07:00
Martin Sherburn d3658bc2b6 Fix issue with onEndReached
Summary:
onEndReached can be triggered twice when more items are added to the end of the list. This change makes it so that a second call to onEndReached won't happen until the user scrolls down to the new end of the list.

Changelog:

[General] [Fixed] - Fix double call to onEndReached in VirtualizedList

Reviewed By: sahrens

Differential Revision: D20066740

fbshipit-source-id: 129d7ae6bfd241eeea18fe0bb12b82be67735874
2020-03-27 03:58:39 -07:00
Kacie Bawiec d2f314af75 Make ScrollView use ForwardRef
Summary:
Have ScrollView use forwardRef so that the host component methods like `measure` and `measureLayout` are available without having to call `getNativeScrollRef`. Instead, you can use `<ScrollView ref={myRef} />` and directly call all methods of ScrollView and host components on `myRef`.

Previous usage:
```
const myRef = React.createRef<React.ElementRef<typeof ScrollView>>();
<ScrollView ref={myRef} />

const innerViewRef = myRef.current.getNativeScrollRef();

innerViewRef.measure();
```
New usage:
```
const myRef = React.createRef<React.ElementRef<typeof View>>();
<ScrollView ref={myRef} />

// now, myRef.current can be used directly as the ref
myRef.current.measure();
myRef.current.measureLayout();

// Additionally, myRef still has access to ScrollView methods
myRef.current.scrollTo(...);
```

Changes:

* Added deprecation warnings to ScrollView methods `getNativeScrollRef`, `getScrollableNode`, and `getScrollResponder`
* Added the forwardRef call to create `ForwardedScrollView` - this takes in `ref` and passes it into the class ScrollView as `scrollViewRef`.
* Forwarded the ref to the native scroll view using `setAndForwardRef`.
* Added statics onto `ForwardedScrollView` so that `ScrollView.Context` can still be accessed.
* Added type `ScrollViewImperativeMethods`, which lists the public methods of ScrollView.
* Converted all public methods of ScrollView to arrow functions. This is because they need to be bound to the forwarded ref.
* Bound all public methods of ScrollView to the forwarded ref in the `setAndForwardRef` call.
* Flow typed the final output (ForwardedScrollView) as an abstract component that takes in the props of the `ScrollView` class, and has all methods of both the inner host component (`measure`, `measureLayout`, etc) and the public methods (`scrollTo`, etc).

Changes to mockScrollView:
* Changed mockScrollView to be able to mock the function component instead of a class component
* Updated necessary tests

Changelog:
[General] [Changed] - Make ScrollView use forwardRef

Reviewed By: TheSavior

Differential Revision: D19304480

fbshipit-source-id: 6c359897526d9d5ac6bc6ab6d5f9d82bfc0d8af4
2020-03-26 16:53:46 -07:00
Kevin Gozali 25f7aea86c Replace fbsource// with // in xplat/js/ files [1]
Summary:
`fbsource//xplat` and `//xplat` are equivalent for FB BUCK targets. Removing extra prefix for consistency.

Changelog: [Internal]

Reviewed By: scottrice

Differential Revision: D20495655

fbshipit-source-id: a57b72f694c533e2e16dffe74eccb8fdec1f55f5
2020-03-25 21:55:47 -07:00
Spencer Ahrens be35664009 Flow type infoLog
Summary:
Changelog:
[General][Internal] flow type infoLog

Reviewed By: zackargyle

Differential Revision: D20577939

fbshipit-source-id: eed4401b2ae0a6bf845fdcb54c6abe1fe98fe7c1
2020-03-25 21:50:12 -07:00
Ramanpreet Nara faff19a7c6 De-jank DevLoadingView
Summary:
## Problems
Repro steps:
1. Disable Fabric (because CMD + R doesn't work with Fabric right now).
2. Open up Marketplace and hit `CMD + OPT + R`
3. **Observe:** The progress bar doesn't show up right away. It also doesn't actually show progress.
https://pxl.cl/140g1

RN Support post: https://fb.workplace.com/groups/rn.support/permalink/3437652016283389/

## Fixes
The first problem is that progress bar doesn't actually show progress.

**Fix:** Bundle load progress is updated in `RCTCxxBridge`, where we first require `RCTDevLoadingView`, and then call its `updateProgress` method. Previously, we wouldn't  lazily load `RCTDevLoadingView`, it already didn't exist. Lazily loading `RCTDevLoadingView` causes the progress view to show up. Here: https://pxl.cl/140gt

If you look at the above video, you'll notice there are two stages to the progress bar: stage 1 displays the actual progress. Stage 2 prompts that we're downloading the JS bundle. As you can see, stage 1 and stage 2 have different background colors, even though both of them are green.

**Fix:** I adjusted the JS to match the Native color. Here: https://pxl.cl/140gT

We're almost there, but the progress bar is dismissed twice?

**Fix:** I dug into the code, and the reason why was because when we hit `CMD + R`, we invalidate the bridge, and immediately re-initialize it. This means that we asynchronously invalidate the old TurboModuleManager, and immediately create a brand new one. Therefore, two `RCTDevLoadingView` modules can (and do) exist at once. So, I moved `RCTDevLoadingView` to be an instance member of `FBReactModule`, to ensure that it doesn't get cleaned up and re-created when TurboModuleManager is deleted and re-created. This finally fixed the progress bar jank:
https://pxl.cl/140hn

Changelog:
[iOS][Fixed] - Remove RCTDevLoadingView jank

Reviewed By: rickhanlonii

Differential Revision: D20607815

fbshipit-source-id: 05825c67adaf3cfda70be0fa2dc92d413dc8921b
2020-03-25 12:09:40 -07:00
Michael Bolin 0b9ea60b4f Back out "Upgrade Prettier from 1.17 to 2.0.2."
Differential Revision: D20639755

fbshipit-source-id: 5028563f9cf0527a30b4259daac50cdc03934bfd
2020-03-24 21:47:35 -07:00
Michael Bolin cf44650b3f Upgrade Prettier from 1.17 to 2.0.2.
Summary:
This gets us on the latest Prettier 2.x:
https://prettier.io/blog/2020/03/21/2.0.0.html

Notably, this adds support for TypeScript 3.8,
which introduces new syntax, such as `import type`.

Reviewed By: zertosh

Differential Revision: D20636268

fbshipit-source-id: fca5833d003804333a05ba16325bbbe0e06d6c8a
2020-03-24 20:24:47 -07:00
Janic Duplessis cf02bd9b76 Fix Animated Value initialized with undefined in ScrollView (#28349)
Summary:
When passing an object to contentOffset that doesn't have `y` prop set it causes the following error:

```
 Error: AnimatedValue: Attempting to set value to undefined

This error is located at:
    in ScrollView (at src/index.js:638)
...
```

This happens since a runtime check was added to the `AnimatedValue` constructor. (a3aaa471ec)

According to flow types the object passed to contentOffset should always contain both x and y props but since it worked before when y is undefined I think its fine to patch the runtime behaviour defensively, especially since the code change is simple.

## Changelog

[General] [Fixed] - Fix Animated Value initialized with undefined in ScrollView
Pull Request resolved: https://github.com/facebook/react-native/pull/28349

Test Plan: Tested that the crash no longer reproduces when passing an empty object to contentOffset.

Reviewed By: cpojer

Differential Revision: D20601664

Pulled By: hramos

fbshipit-source-id: b098a2dd1e702f995a9a92fa6e4e9a204187dac4
2020-03-24 04:07:40 -07:00
Alexander Kawrykow 15434c7c43 Guard against null values in object parameters for bridged methods
Summary:
Handles the case when a value in an object parameter of a turbo module spec is null (even if the type is nullable).

For example, given:
```
export interface Spec extends TurboModule {
  +myFunc: ({|
    foo: ?string,
  |}) => void;
}
```
and calling `NativeModule.myFunc({foo: null})`, we see an error like:
```
JSON value '<null>' of type NSNull cannot be converted to NSString
```
Guarding against this by converting NSNull's to nils

## Changelog:

[iOS] [Fixed] - Fix crash when passing null value in object parameter of bridged method

Reviewed By: fkgozali

Differential Revision: D20591590

fbshipit-source-id: fdb90f34131427a235f2e3c99147bf1e6a9c6732
2020-03-23 17:21:00 -07:00
Eddie Dugan 22eb711c84 RN picker - implement background color
Summary:
add support to the android implementation of the Picker component for setting the background color.

Changelog: [Android] [Added] - Support item background color in Dialog Picker

Differential Revision: D20566131

fbshipit-source-id: d693b40803fa1051ec955c5728994c820fecd9e9
2020-03-23 08:37:16 -07:00
Sebastian Markbage 8bbb2ca44b Remove ReactTypes from fbsource and React sync
Summary:
See https://github.com/facebook/react/pull/18366

This contains a fork of the upstream Flow types. We shouldn't be syncing this since these leads to conflicting types.

As a result, these uses have already been codemodded away. Only the imports remained.

Changelog:

[React Core] - Remove ReactTypes from sync.

Reviewed By: gaearon

Differential Revision: D20583740

fbshipit-source-id: fc86a934cbdca8ff90fe90282b86ecc945a85e5f
2020-03-22 20:34:04 -07:00
Samuel Susla 56cf99a96e Validate selection range passed to setTextAndSelection
Summary:
Changelog: [Internal]

# Fabric

1. If `start` and `end` parameters in `setTextAndSelection` are -1, we don't move the cursor. Previously the cursor would be moved to beginning of text input.

2. In view commands, do not validate `eventCount`. It is passed in as undefined from JS because Fabric's text input doesn't use `eventCount`.

# Paper

1. If `start` and `end` parameters in `setTextAndSelection` are -1, we don't move the cursor. Previously the cursor would be moved to beginning of text input.

Reviewed By: shergin

Differential Revision: D20538290

fbshipit-source-id: c7aeddc25f58697254474058ce901df958321f7c
2020-03-22 06:11:35 -07:00
Rick Hanlon 9c64bd5739 Properly handle LogBox errors during tests
Summary:
This diff fixes an issue where errors in LogBox during tests would cause the tests to crash.

The crash is due to the NativeExceptionsManager module not being mocked (as all native module need to be in tests). The fix is to properly mock the NativeExceptionManger.

This fix exposed an infinite loop issue where failures in LogBox will be logged to the ExceptionManager, which logs to the console, which logs to LogBox, creating a loop. This diff also fixes that look by moving the LogBox internal error check to the top of the monkey patched console methods.

Changelog: [Internal]

Differential Revision: D20428590

fbshipit-source-id: 7289a480c99ba8dee67772178b7629afb40b330a
2020-03-19 20:31:01 -07:00
Ramanpreet Nara 652fa1b8d4 Add a perfLogger argument to getTurboModuleWithJSInvoker:
Summary:
## Purpose
We must modify the `getTurboModuleWithJsInvoker:` method of all our NativeModules to also accept a `id<RCTTurboModulePerformanceLogger>` object. This performance logger object should then be forwarded to the `Native*SpecJSI` constructor.

## Script
Run the following script via Node:
```
var withSpaces = (...args) => args.join('\s*')

var regexString = withSpaces(
  '-',
  '\(',
  'std::shared_ptr',
  '<',
  '(?<turboModuleClass>(facebook::react::|react::|::|)TurboModule)',
  '>',
  '\)',
  'getTurboModuleWithJsInvoker',
  ':',
  '\(',
  'std::shared_ptr',
  '<',
  '(?<callInvokerClass>(facebook::react::|react::|::|)CallInvoker)',
  '>',
  '\)',
  'jsInvoker',
  '{',
  'return',
  'std::make_shared',
  '<',
  '(?<specName>(facebook::react::|react::|::|)Native[A-Za-z0-9]+SpecJSI)',
  '>',
  '\(',
  '(?<arg1>[A-Za-z0-9]+)',
  ',',
  '(?<arg2>[A-Za-z0-9]+)',
  '\)',
  ';',
  '}',
)

var replaceString = `- (std::shared_ptr<$<turboModuleClass>>)
    getTurboModuleWithJsInvoker:(std::shared_ptr<$<callInvokerClass>>)jsInvoker
                     perfLogger:(id<RCTTurboModulePerformanceLogger>)perfLogger
{
  return std::make_shared<$<specName>>($<arg1>, $<arg2>, perfLogger);
}`

const exec = (cmd) => require('child_process').execSync(cmd, { encoding: 'utf8' });
const abspath = (filename) => `${process.env.HOME}/${filename}`;
const relpath = (filename) => filename.replace(process.env.HOME + '/', '');
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();
}
```

Also, run: `pushd ~/fbsource && js1 build oss-native-modules-specs -p ios && js1 build oss-native-modules-specs -p android && popd;`

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D20478718

fbshipit-source-id: 89ee27ed8a0338a66a9b2dbb716168a4c4582c44
2020-03-18 11:01:15 -07:00
Jesse Katsumata 5e472b314b chore(switch): migrate to es6 import/export (#28333)
Summary:
Migrate Switch component to use ES6 import/exports

motivation: trying to slowly migrate each files to use es6 import/exports to make this discussion happen
https://github.com/react-native-community/discussions-and-proposals/issues/201#issuecomment-588454552

## Changelog

[General] [Changed] - Use es6 import/export syntax for Switch component
Pull Request resolved: https://github.com/facebook/react-native/pull/28333

Test Plan: Test on RNTester

Reviewed By: TheSavior

Differential Revision: D20493110

Pulled By: hramos

fbshipit-source-id: 25279ec41955b0dbda1abab6e45b93ca1c28fa32
2020-03-17 18:35:22 -07:00
Ramanpreet Nara 91c5ff4a12 Guard against nil methodQueue in RCTBlobManager
Summary:
## Description
In T63516227, we're seeing a crash that occurs because `networking.methodQueue` is `nil`, and we try to `dispatch_async` to it.

## Hypothesis
This looks like a problem with NativeModule cleanup:
1. Some JS executes a call to `RCTBlobManager.addNetworkingHander`. This schedules an async method call on the `RCTBlobManager` method queue.
2. In `RCTCxxBridge invalidate`, on the JS thread, we loop through all the `RCTModuleData`s, and invalidate them. This invalidates our NativeModules (perhaps not all but only `RCTNetworking`).
3. The `RCTBlobManager.addNetworkingHander` method call finally executes, with `RCTNetworking`'s methodQueue set to nil, which throws this error.

Changelog:
[iOS][Fixed] - Fix RCTBlobManager cleanup crash

Reviewed By: PeteTheHeat

Differential Revision: D20498096

fbshipit-source-id: d2d60984637ddf883278289258aa9b2ae81bb172
2020-03-17 14:56:14 -07:00
Nick Gerleman 161b910494 Do not explicitly include ".js" in Library imports (#28311)
Summary:
A few recent imports have explicitly added ".js" to the end of their path. This prevents Metro from resolving platform-specific JS files, e.g. "Foo.android.js" or "Foo.windows.js" instead of "Foo.js".

React Native Windows provides its own implementation of files in a few cases where stock React Native will share them between Android and iOS. We hope to reduce/eliminate these long term, but requiring explicit ".js" files currently breaks us in a couple of places where we have custom implementations.

This change is a quick regex replace of ES6 and CommonJS imports in 'Libraries/" to eliminate ".js".

## Changelog

[General] [Fixed] - Do not explicitly include ".js" in Library imports
Pull Request resolved: https://github.com/facebook/react-native/pull/28311

Test Plan: I haven't done any manual validation of this, but `flow-check` should catch any issues with this during CI.

Reviewed By: cpojer

Differential Revision: D20486466

Pulled By: TheSavior

fbshipit-source-id: 31e1ccc307967417d7d09c34c859f0b2b69eac84
2020-03-17 02:11:53 -07:00
Hans Halverson 4482e531d8 Move suppressions to primary locations in xplat/js
Reviewed By: gkz

Differential Revision: D20446329

fbshipit-source-id: 2713e7713f6b0e8d1dfd9ab8c0ccb27294177589
2020-03-16 21:28:17 -07:00
Luna Ruan bac9e69593 React Native sync for revisions 241c446...b5c6dd2
Summary:
This sync includes the following changes:
- **[b5c6dd2de](https://github.com/facebook/react/commit/b5c6dd2de )**: Don't use Spread in DevTools Injection (#18277) //<Sebastian Markbåge>//
- **[a463fef31](https://github.com/facebook/react/commit/a463fef31 )**: Revert "[React Native] Add getInspectorDataForViewAtPoint (#18233)" //<Sebastian Markbage>//
- **[dc7eedae3](https://github.com/facebook/react/commit/dc7eedae3 )**: Encode server rendered host components as array tuples (#18273) //<Sebastian Markbåge>//
- **[bf351089a](https://github.com/facebook/react/commit/bf351089a )**: [React Native] Add getInspectorDataForViewAtPoint (#18233) //<Ricky>//
- **[99d737186](https://github.com/facebook/react/commit/99d737186 )**: [Flight] Split Streaming from Relay Implemenation (#18260) //<Sebastian Markbåge>//
- **[160505b0c](https://github.com/facebook/react/commit/160505b0c )**: ReactDOM.useEvent: Add more scaffolding for useEvent hook (#18271) //<Dominic Gannaway>//
- **[526c12f49](https://github.com/facebook/react/commit/526c12f49 )**: Enable enableProfilerCommitHooks flag for FB (#18230) //<Brian Vaughn>//
- **[29534252a](https://github.com/facebook/react/commit/29534252a )**: ReactDOM.useEvent add flag and entry point (#18267) //<Dominic Gannaway>//
- **[704c8b011](https://github.com/facebook/react/commit/704c8b011 )**: Fix Flow type for AnyNativeEvent (#18266) //<Dominic Gannaway>//
- **[bdc5cc463](https://github.com/facebook/react/commit/bdc5cc463 )**: Add Relay Flight Build (#18242) //<Sebastian Markbåge>//
- **[7a1691cdf](https://github.com/facebook/react/commit/7a1691cdf )**: Refactor Host Config Infra (getting rid of .inline*.js) (#18240) //<Sebastian Markbåge>//
- **[238b57f0f](https://github.com/facebook/react/commit/238b57f0f )**: [Blocks] Make it possible to have lazy initialized and lazy loaded Blocks (#18220) //<Sebastian Markbåge>//
- **[235a6c4af](https://github.com/facebook/react/commit/235a6c4af )**: Bugfix: Dropped effects in Legacy Mode Suspense (#18238) //<Andrew Clark>//
- **[562cf013d](https://github.com/facebook/react/commit/562cf013d )**: Add a flag to disable module pattern components (#18133) //<Dan Abramov>//
- **[115cd12d9](https://github.com/facebook/react/commit/115cd12d9 )**: Add test run that uses www feature flags (#18234) //<Andrew Clark>//
- **[4027f2a3b](https://github.com/facebook/react/commit/4027f2a3b )**: Break up require/import statements in strings (#18222) //<Christoph Nakazawa>//
- **[024a76431](https://github.com/facebook/react/commit/024a76431 )**: Implemented Profiler onCommit() and onPostCommit() hooks (#17910) //<Brian Vaughn>//
- **[d35f8a581](https://github.com/facebook/react/commit/d35f8a581 )**: feat: honor displayName of context types (#18224) //<Brian Vaughn>//
- **[3ee812e6b](https://github.com/facebook/react/commit/3ee812e6b )**: Revert "feat: honor displayName of context types (#18035)" (#18223) //<Dominic Gannaway>//
- **[6a0efddd8](https://github.com/facebook/react/commit/6a0efddd8 )**: Modern Event System: export internal FB flag for testing (#18221) //<Dominic Gannaway>//
- **[fa03206ee](https://github.com/facebook/react/commit/fa03206ee )**: Remove _ctor field from Lazy components (#18217) //<Sebastian Markbåge>//
- **[2fe0fbb05](https://github.com/facebook/react/commit/2fe0fbb05 )**: Use accumulateTwoPhaseDispatchesSingle directly (#18203) //<Dominic Gannaway>//
- **[503fd82b4](https://github.com/facebook/react/commit/503fd82b4 )**: Modern Event System: Add support for internal FB Primer (#18210) //<Dominic Gannaway>//
- **[45c172d94](https://github.com/facebook/react/commit/45c172d94 )**: feat: honor displayName of context types (#18035) //<Brian Vaughn>//
- **[ec652f4da](https://github.com/facebook/react/commit/ec652f4da )**: Bugfix: Expired partial tree infinite loops (#17949) //<Andrew Clark>//
- **[d2158d6cc](https://github.com/facebook/react/commit/d2158d6cc )**: Fix flow types (#18204) //<Brian Vaughn>//
- **[7e83af17c](https://github.com/facebook/react/commit/7e83af17c )**: Put React.jsx and React.jsxDEV behind experimental build (#18023) //<Luna Ruan>//
- **[8cb2fb21e](https://github.com/facebook/react/commit/8cb2fb21e )**: Refine isFiberSuspenseAndTimedOut (#18184) //<Dominic Gannaway>//
- **[62861bbcc](https://github.com/facebook/react/commit/62861bbcc )**: More event system cleanup and scaffolding (#18179) //<Dominic Gannaway>//
- **[8ccfce460](https://github.com/facebook/react/commit/8ccfce460 )**: Only use Rollup's CommonJS plugin for "react-art" (#18186) //<Sebastian Markbåge>//
- **[c26506a7d](https://github.com/facebook/react/commit/c26506a7d )**: Update react-shallow-renderer from 16.12.0 to 16.13.0 (#18185) //<Minh Nguyen>//
- **[26aa1987c](https://github.com/facebook/react/commit/26aa1987c )**: [Native] Enable and remove targetAsInstance feature flag. (#18182) //<Eli White>//
- **[4469700bb](https://github.com/facebook/react/commit/4469700bb )**: Change ReactVersion from CJS to ES module (#18181) //<Sebastian Markbåge>//
- **[58eedbb02](https://github.com/facebook/react/commit/58eedbb02 )**: Check in a forked version of object-assign only for UMD builds (#18180) //<Sebastian Markbåge>//
- **[053347e6b](https://github.com/facebook/react/commit/053347e6b )**: react-test-renderer: improve findByType() error message (#17439) //<Henry Q. Dineen>//
- **[4ee592e95](https://github.com/facebook/react/commit/4ee592e95 )**: Add an early invariant to debug a mystery crash (#18159) //<Dan Abramov>//
- **[7ea4e4111](https://github.com/facebook/react/commit/7ea4e4111 )**: Fix typo in warning text (#18103) //<Sophie Alpert>//
- **[79a25125b](https://github.com/facebook/react/commit/79a25125b )**: feat: add recommended config eslint rule (#14762) //<Simen Bekkhus>//
- **[ae60caacf](https://github.com/facebook/react/commit/ae60caacf )**: [Fabric] Fix targetAsInstance dispatchEvent "cannot read property of null" (#18156) //<Joshua Gross>//
- **[d72700ff5](https://github.com/facebook/react/commit/d72700ff5 )**: Remove runtime dependency on prop-types (#18127) //<Dan Abramov>//
- **[549e41883](https://github.com/facebook/react/commit/549e41883 )**: Move remaining things to named exports (#18165) //<Sebastian Markbåge>//
- **[739f20bed](https://github.com/facebook/react/commit/739f20bed )**: Remove Node shallow builds (#18157) //<Sebastian Markbåge>//
- **[3e809bf5d](https://github.com/facebook/react/commit/3e809bf5d )**: Convert React Native builds to named exports (#18136) //<Sebastian Markbåge>//
- **[869dbda72](https://github.com/facebook/react/commit/869dbda72 )**: Don't build shallow renderer for FB (#18153) //<Dan Abramov>//
- **[293878e07](https://github.com/facebook/react/commit/293878e07 )**: Replace ReactShallowRenderer with a dependency (#18144) //<Minh Nguyen>//
- **[b4e314891](https://github.com/facebook/react/commit/b4e314891 )**: Remove unused flag (#18132) //<Dan Abramov>//
- **[849e8328b](https://github.com/facebook/react/commit/849e8328b )**: Remove unnecessary warnings (#18135) //<Dan Abramov>//
- **[f9c0a4544](https://github.com/facebook/react/commit/f9c0a4544 )**: Convert the rest of react-dom and react-test-renderer to Named Exports (#18145) //<Sebastian Markbåge>//
- **[c1c5499cc](https://github.com/facebook/react/commit/c1c5499cc )**: update version numbers for 16.13 (#18143) //<Sunil Pai>//
- **[e1c7e651f](https://github.com/facebook/react/commit/e1c7e651f )**: Update ReactDebugHooks to handle composite hooks (#18130) //<Brian Vaughn>//
- **[d28bd2994](https://github.com/facebook/react/commit/d28bd2994 )**: remove OSS testing builds (#18138) //<Sunil Pai>//
- **[8e13e770e](https://github.com/facebook/react/commit/8e13e770e )**: Remove /testing entry point from 'react' package (#18137) //<Sebastian Markbåge>//
- **[60016c448](https://github.com/facebook/react/commit/60016c448 )**: Export React as Named Exports instead of CommonJS (#18106) //<Sebastian Markbåge>//
- **[8d7535e54](https://github.com/facebook/react/commit/8d7535e54 )**: Add nolint to FB bundle headers (#18126) //<Dominic Gannaway>//
- **[bf13d3e3c](https://github.com/facebook/react/commit/bf13d3e3c )**: [eslint-plugin-react-hooks] Fix cyclic caching for loops containing a… (#16853) //<Moji Izadmehr>//
- **[501a78881](https://github.com/facebook/react/commit/501a78881 )**: runAllPassiveEffectDestroysBeforeCreates's feature flag description typo fixed (#18115) //<adasq>//
- **[09348798a](https://github.com/facebook/react/commit/09348798a )**: Codemod to import * as React from "react"; (#18102) //<Sebastian Markbåge>//
- **[78e816032](https://github.com/facebook/react/commit/78e816032 )**: Don't warn about unmounted updates if pending passive unmount (#18096) //<Brian Vaughn>//
- **[2c4221ce8](https://github.com/facebook/react/commit/2c4221ce8 )**: Change string refs in function component message (#18031) //<Sebastian Markbåge>//
- **[65bbda7f1](https://github.com/facebook/react/commit/65bbda7f1 )**: Rename Chunks API to Blocks (#18086) //<Sebastian Markbåge>//
- **[8b596e00a](https://github.com/facebook/react/commit/8b596e00a )**: Remove unused arguments in the reconciler (#18092) //<Dan Abramov>//
- **[5de5b6150](https://github.com/facebook/react/commit/5de5b6150 )**: Bugfix: `memo` drops lower pri updates on bail out (#18091) //<Andrew Clark>//
- **[abfbae02a](https://github.com/facebook/react/commit/abfbae02a )**: Update Rollup version to 1.19.4 and fix breaking changes (#15037) //<Kunuk Nykjær>//
- **[b789060dc](https://github.com/facebook/react/commit/b789060dc )**: Feature Flag for React.jsx` "spreading a key to jsx" warning (#18074) //<Sunil Pai>//
- **[3f85d53ca](https://github.com/facebook/react/commit/3f85d53ca )**: Further pre-requisite changes to plugin event system (#18083) //<Dominic Gannaway>//
- **[ea6ed3dbb](https://github.com/facebook/react/commit/ea6ed3dbb )**: Warn for update on different component in render (#17099) //<Andrew Clark>//
- **[085d02133](https://github.com/facebook/react/commit/085d02133 )**: [Native] Migrate focus/blur to call TextInputState with the host component (#18068) //<Eli White>//
- **[1000f6135](https://github.com/facebook/react/commit/1000f6135 )**: Add container to event listener signature (#18075) //<Dominic Gannaway>//
- **[a12dd52a4](https://github.com/facebook/react/commit/a12dd52a4 )**: Don't build some packages for WWW (#18078) //<Dan Abramov>//
- **[2512c309e](https://github.com/facebook/react/commit/2512c309e )**: Remove Flare bundles from build (#18077) //<Dominic Gannaway>//
- **[4912ba31e](https://github.com/facebook/react/commit/4912ba31e )**: Add modern event system flag + rename legacy plugin module (#18073) //<Dominic Gannaway>//
- **[4d9f85006](https://github.com/facebook/react/commit/4d9f85006 )**: Re-throw errors thrown by the renderer at the root in the complete phase (#18029) //<Andrew Clark>//
- **[14afeb103](https://github.com/facebook/react/commit/14afeb103 )**: Added missing feature flag //<Brian Vaughn>//
- **[691096c95](https://github.com/facebook/react/commit/691096c95 )**: Split recent passive effects changes into 2 flags (#18030) //<Brian Vaughn>//
- **[56d8a73af](https://github.com/facebook/react/commit/56d8a73af )**: [www] Disable Scheduler `timeout` w/ dynamic flag (#18069) //<Andrew Clark>//
- **[d533229fb](https://github.com/facebook/react/commit/d533229fb )**: Fix Prettier //<Dan Abramov>//
- **[56a8c3532](https://github.com/facebook/react/commit/56a8c3532 )**: eslint-plugin-react-hooks@2.4.0 //<Dan Abramov>//
- **[93a229bab](https://github.com/facebook/react/commit/93a229bab )**: Update eslint rule exhaustive deps to use new suggestions feature (#17385) //<Will Douglas>//
- **[9def56ec0](https://github.com/facebook/react/commit/9def56ec0 )**: Refactor DOM plugin system to single module (#18025) //<Dominic Gannaway>//
- **[2d6be757d](https://github.com/facebook/react/commit/2d6be757d )**: [Native] Delete NativeComponent and NativeMethodsMixin (#18036) //<Eli White>//
- **[d4f2b0379](https://github.com/facebook/react/commit/d4f2b0379 )**: Add Auto Import to Babel Plugin  (#16626) //<Luna Ruan>//
- **[8777b44e9](https://github.com/facebook/react/commit/8777b44e9 )**: Add Modern WWW build (#18028) //<Dan Abramov>//
- **[a607ea4c4](https://github.com/facebook/react/commit/a607ea4c4 )**: Remove getIsHydrating (#18019) //<Dan Abramov>//
- **[f7278034d](https://github.com/facebook/react/commit/f7278034d )**: Flush all passive destroy fns before calling create fns (#17947) //<Brian Vaughn>//
- **[529e58ab0](https://github.com/facebook/react/commit/529e58ab0 )**: Remove legacy www config from Rollup build (#18016) //<Dominic Gannaway>//
- **[42918f40a](https://github.com/facebook/react/commit/42918f40a )**: Change build from babylon to babel (#18015) //<Dominic Gannaway>//
- **[df5faddcc](https://github.com/facebook/react/commit/df5faddcc )**: Refactor commitPlacement to recursively insert nodes (#17996) //<Dominic Gannaway>//
- **[517de74b0](https://github.com/facebook/react/commit/517de74b0 )**: Tweak comment wording (#18007) //<Dan Abramov>//
- **[b63cb6f6c](https://github.com/facebook/react/commit/b63cb6f6c )**: Update ReactFiberExpirationTime.js (#17825) //<haseeb>//
- **[89c6042df](https://github.com/facebook/react/commit/89c6042df )**: fix: typo in test (#18005) //<Jesse Katsumata>//
- **[4f71f25a3](https://github.com/facebook/react/commit/4f71f25a3 )**: Re-enable shorthand CSS property collision warning (#18002) //<Sophie Alpert>//
- **[c55c34e46](https://github.com/facebook/react/commit/c55c34e46 )**: Move React Map child check to behind flags or __DEV__ (#17995) //<Dominic Gannaway>//
- **[3f814e758](https://github.com/facebook/react/commit/3f814e758 )**: Fix Flow type for React Native (#17992) //<Dan Abramov>//
- **[256d78d11](https://github.com/facebook/react/commit/256d78d11 )**: Add feature flag for removing children Map support (#17990) //<Dominic Gannaway>//
- **[9dba218d9](https://github.com/facebook/react/commit/9dba218d9 )**: [Mock Scheduler] Mimic browser's advanceTime (#17967) //<Andrew Clark>//
- **[d6e08fe0a](https://github.com/facebook/react/commit/d6e08fe0a )**: Remove Suspense priority warning (#17971) //<Dan Abramov>//
- **[812277dab](https://github.com/facebook/react/commit/812277dab )**: Fix onMouseEnter is fired on disabled buttons (#17675) //<Alfredo Granja>//
- **[3e9251d60](https://github.com/facebook/react/commit/3e9251d60 )**: make testing builds for React/ReactDOM (#17915) //<Sunil Pai>//
- **[ace9e8134](https://github.com/facebook/react/commit/ace9e8134 )**: Simplify Continuous Hydration Targets (#17952) //<Sebastian Markbåge>//
- **[7df32c4c8](https://github.com/facebook/react/commit/7df32c4c8 )**: Flush `useEffect` clean up functions in the passive effects phase (#17925) //<Brian Vaughn>//
- **[434770c3b](https://github.com/facebook/react/commit/434770c3b )**: Add beforeRemoveInstance method to ReactNoop (#17959) //<Dominic Gannaway>//
- **[6ae2c33a7](https://github.com/facebook/react/commit/6ae2c33a7 )**: StrictMode should call sCU twice in DEV (#17942) //<Brian Vaughn>//
- **[9dbe1c54d](https://github.com/facebook/react/commit/9dbe1c54d )**: Revert "Bugfix: Expiring a partially completed tree (#17926)" (#17941) //<Andrew Clark>//
- **[b2382a715](https://github.com/facebook/react/commit/b2382a715 )**: Add ReactDOM.unstable_renderSubtreeIntoContainer warning flag (#17936) //<Dominic Gannaway>//
- **[01974a867](https://github.com/facebook/react/commit/01974a867 )**: Bugfix: Expiring a partially completed tree (#17926) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 241c446...b5c6dd2

Reviewed By: gaearon

Differential Revision: D20347361

fbshipit-source-id: e9e6282474ab6471585e8e7fb6ea8518aa48390d
2020-03-16 13:09:54 -07:00
Jesse Katsumata 66e7a4c1aa Fix outdated urls (#28285)
Summary:
Fixed some url in the code that was outdated.

## Changelog

[Internal] [Fixed] - Fix outdated url in Image Example of RNTester and comment in StyleSheet Type
Pull Request resolved: https://github.com/facebook/react-native/pull/28285

Test Plan: Url can be accessed, and content displayed makes sense.

Differential Revision: D20464293

Pulled By: shergin

fbshipit-source-id: f0c97f7a95ed2a3d6c396cff6cda0bdaab7f5c35
2020-03-15 22:58:14 -07:00
maschad bcf2a716fb Removed core RCTConvert CoreLocation Libraries as well as reference i… (#28300)
Summary:
This PR is to address https://github.com/facebook/react-native/issues/28200

Even though GeoLocation was extracted from the Core, there are still libraries i.e. the CoreLocation.h library included which cause Apple to reject Apps, as mentioned here.

This removed all references to the CoreLocation library that where remaining.

## Changelog

[iOS] [Removed] - Message
Pull Request resolved: https://github.com/facebook/react-native/pull/28300

Test Plan:
- Flow check passes.
- RNTest built successfully.

Differential Revision: D20441145

Pulled By: shergin

fbshipit-source-id: 03faa4d20dc15cea931b42f34f13814df9c94a01
2020-03-15 22:36:53 -07:00
Héctor Ramos 07def55396 fbshipit-source-id: da15f69185e724eaf7d4bc78dbc61fcdcb3074d5 2020-03-13 21:46:45 -07:00
Tim Yung 5ca1d8f260 Pressability: Fix Missing `onLongPress` Gestures
Summary:
The current implementation of `Pressability` has a bug related to `onLongPress`.

When a user starts a press gesture, we keep track of the activation position (occurs after waiting `delayPressIn` milliseconds). If the touch moves away from that position by more than 10dp, we rule out the long press gesture. This means no matter how long you hold down the press, even if you move it back to within 10dp, we will not fire `onLongPress`.

However, there is currently a bug where we never reset the cached activation position. This means that after the first press gesture, all subsequent long press gestures must start within 10dp of that first press gesture. This leads to seemingly intermittent missing long press gestures.

This fixes the bug by ensuring that whenever a press gestures is terminated (either via a cancel or release), we reset the activation position.

Changelog:
[General][Fixed] - Fixed Pressability to properly fire `onLongPress`.

Reviewed By: TheSavior

Differential Revision: D20410075

fbshipit-source-id: e4727b7a9585ce3ea39481fc13e56b6b91740c8c
2020-03-11 23:10:48 -07:00
Tommy Nguyen f332fac163 iOS: Add UIScene support to RCTImageView (#28141)
Summary:
Apps implementing `UISceneDelegate` no longer clear out images when backgrounded because `UIApplicationDidEnterBackgroundNotification` no longer gets fired.

## Changelog

[iOS] [Added] - UIScene support for RCTImageView
Pull Request resolved: https://github.com/facebook/react-native/pull/28141

Test Plan:
1. Create a new iOS app implementing `UISceneDelegate` or modify an existing one
2. Open a React view with some images
3. Switch to another app, or background the current app
4. Observe that `-[RCTImageView clearImageIfDetached]` gets called

Reviewed By: shergin

Differential Revision: D20009200

Pulled By: hramos

fbshipit-source-id: bdbf79d6cf56a295344c036b9225efec672fa780
2020-03-11 18:01:32 -07:00
Samuel Susla 3198009410 Remove redundant queue switch from RCTLocalAssetImageLoader
Summary:
Switching queues in `RCTLocalAssetImageLoader` is unnecessary. We dispatch to main queue before assigning the image to `UIImageView`.

Changelog: Remove redundant queue switch from RCTLocalAssetImageLoader

Reviewed By: PeteTheHeat

Differential Revision: D20347223

fbshipit-source-id: ff6215838f0462356d4a516e6ec31c82a742881a
2020-03-11 14:01:21 -07:00
Joshua Gross f3a53fd338 TextInput: keep less stateful data on the View
Summary:
Allow JS to keep track of mostRecentEventCount and pass it into each event or prop update. We really don't want to separately keep track of that data.

In non-Fabric, the ShadowNode will keep track of the mostRecentEventCount associated to prop updates. In Fabric, that happens on the C++ ShadowNode.

Changelog: [Internal] Simplification to TextInput native state

Reviewed By: mdvacca

Differential Revision: D20374573

fbshipit-source-id: 385fba6ec69a071c78832a686b397699a6c55d67
2020-03-11 12:32:40 -07:00
Miguel Bolivar 686d8a57f8 Update: Fixing typo on Modal comment code � (#28057)
Summary:
This PR only fixes a little typo that I noticed working on the documentation of React Native website taking reference from this source code, and then saw it 😅

## Changelog

[General] [Fixed] - Fixed typo from `inly` to `only` inside `Modal.js` library code.
Pull Request resolved: https://github.com/facebook/react-native/pull/28057

Test Plan: Not needed.

Reviewed By: cpojer

Differential Revision: D20197178

Pulled By: TheSavior

fbshipit-source-id: 372f263a16a2de665ced7c0d3f10e3897777d19f
2020-03-11 10:00:04 -07:00
Luna Wei a3aaa471ec Add JS error to AnimatedValue constructor
Summary:
Changelog: [Internal]
Add one more error around AnimatedValue.js returning an undefined value for "value" property.

Since this error happens in construction of the animated node, it makes sense that the constructor could be passed an undefined value?

Reviewed By: zackargyle

Differential Revision: D20354532

fbshipit-source-id: ba35172cd91977c48c849a2b1e27596c4dd8b4d4
2020-03-10 18:03:22 -07:00
Max Kareta c38318d084 deleting marker cancel 2/N. [DO NOT LAND]
Summary: Added markerDrop API that will replace markerCancel in future.

Reviewed By: furdei

Differential Revision: D20003457

fbshipit-source-id: 38cf68455d9274761a49014d9cbb50d82f4e9437
2020-03-10 07:11:42 -07:00
Spencer Ahrens 08c338eebf update JSTime to last call
Summary: ChangeLog: [General] [Added] - support PerformanceLogger stopTimespan updates

Reviewed By: alexeylang

Differential Revision: D20095949

fbshipit-source-id: 3522a8d16ced44d6b699b294004371e223f9f619
2020-03-09 19:47:36 -07:00
Jesse Katsumata 42c1957aff chore: fix typo in comments (#28269)
Summary:
Fixed some typos in the comment.

## Changelog

[Internal] [Fixed] - Fixed typo in the comments
Pull Request resolved: https://github.com/facebook/react-native/pull/28269

Test Plan: Changes are only made in the comments, so test is not necessary.

Reviewed By: cpojer

Differential Revision: D20342637

Pulled By: shergin

fbshipit-source-id: f6e7dd538ee54c43e1570c35e1f8c4502054e328
2020-03-09 15:37:33 -07:00
Rick Hanlon 69126069fc LogBox - Handle invalid requires
Summary:
This diff updates the errors thrown by Metro for invalid requires, and fixed a bug in Fast Refresh that was failing to handle errors returned by metro. The net result is that invalid requires are displayed as syntax errors with code frames.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D20107057

fbshipit-source-id: 59f77aa1da620d2c619a7cc45d90f40ef8b54448
2020-03-09 06:02:07 -07:00
Logan Daniels 074a2fab74 Update measurements for Footer in VirtualizedList when the footer's onLayout is called
Summary:
When any list cell that may contain nested VirtualizedLists is laid out, it's possible that the offset of any child lists relative to the outermost list has changed. We need to tell these children to re-measure themselves relative to that outermost list, so that their viewability calculations are correct.

We already do this for regular list cells -- we just need to extend that logic to any child lists that may live in the ListFooterComponent.

Changelog: [General] [Fixed] - Fix viewability calculations for nested VirtualizedLists inside of a parent list's FooterComponent

Differential Revision: D20310961

fbshipit-source-id: 4bfcfb95c87329f2ee337d5499e5c7162ba692e8
2020-03-06 15:51:33 -08:00
Daniel Sainati 1beef1e18d deploy 120 to xplat
Summary:
Changelog: [Internal]

bypass-lint
allow-large-files

Reviewed By: mroch

Differential Revision: D20290164

fbshipit-source-id: 6f8633b1a8685b0551757fc4841b82eab77525c5
2020-03-06 11:09:08 -08:00
Christoph Nakazawa 78de0865cf Adjust React error messages to obfuscate imports
Summary:
Similar to the previous diff in this stack, I'm adjusting the React files we use to make sure require and import statements don't get extracted by Jest. Right now Jest extracts them, and when it looks up dependencies in reverse it just ignores the ones that don't exist.

Corresponding React PR (to make sure this change doesn't get reverted during the next sync): https://github.com/facebook/react/pull/18222

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D20282829

fbshipit-source-id: 5ff6a64d31672dd29243d020e8174797a44d9267
2020-03-06 03:57:40 -08:00
Logan Daniels b85cb0cf7a Back out "Moving towards UIWindowScene support"
Summary:
Original commit changeset: ae2a4478e2e7

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D20289851

fbshipit-source-id: 1167ce8f5135411b80630b523c91c10e2b7eece1
2020-03-05 15:58:44 -08:00
Jesse Katsumata fbd09b1797 Image: remove unused ImageProps (#28151)
Summary:
I noticed that there was a `height` and `width` props in `Image` component, but those props are not being used in `RCTImageView`(ios) or `ReactImageView`(android).

## Changelog

[GENERAL] [Removed] - Remove Unused ImageProp
Pull Request resolved: https://github.com/facebook/react-native/pull/28151

Test Plan: Start a new React Native Project, and use `Image` component with `width` and `height` props and verify that it does not display the image on both iOS and Android

Reviewed By: shergin

Differential Revision: D20197126

Pulled By: TheSavior

fbshipit-source-id: 186119448826659d7c01c7c8a271157228169c30
2020-03-05 13:33:08 -08:00
Logan Daniels c203ec00e5 Add flow types for ReactTestRenderer
Summary: Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D20260771

fbshipit-source-id: 3935e546ebbc65a1baa9d0a25cff47753f6bc590
2020-03-05 12:01:18 -08:00
radex b58e176af0 Moving towards UIWindowScene support (#28058)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28058

I'm taking the first step towards supporting iOS 13 UIScene APIs and modernizing React Native not to assume an app only has a single window. See discussion here: https://github.com/facebook/react-native/issues/25181#issuecomment-505612941

The approach I'm taking is to take advantage of `RootTagContext` and passing it to NativeModules so that they can identify correctly which window they refer to. Here I'm just laying groundwork.

- [x] `Alert` and `ActionSheetIOS` take an optional `rootTag` argument that will cause them to appear on the correct window
- [x] `StatusBar` methods also have `rootTag` argument added, but it's not fully hooked up on the native side — this turns out to require some more work, see: https://github.com/facebook/react-native/issues/25181#issuecomment-506690818
- [x] `setNetworkActivityIndicatorVisible` is deprecated in iOS 13
- [x] `RCTPerfMonitor`, `RCTProfile` no longer assume `UIApplicationDelegate` has a `window` property (no longer the best practice) — they now just render on the key window

Next steps: Add VC-based status bar management (if I get the OK on https://github.com/facebook/react-native/issues/25181#issuecomment-506690818 ), add multiple window demo to RNTester, deprecate Dimensions in favor of a layout context, consider adding hook-based APIs for native modules such as Alert that automatically know which rootTag to pass

## Changelog

[Internal] [Changed] - Modernize Modal to use RootTagContext
[iOS] [Changed] - `Alert`, `ActionSheetIOS`, `StatusBar` methods now take an optional `surface` argument (for future iPadOS 13 support)
[iOS] [Changed] - RCTPresentedViewController now takes a nullable `window` arg
[Internal] [Changed] - Do not assume `UIApplicationDelegate` has a `window` property
Pull Request resolved: https://github.com/facebook/react-native/pull/25425

Test Plan:
- Open RNTester and:
- go to Modal and check if it still works
- Alert → see if works
- ACtionSheetIOS → see if it works
- StatusBar → see if it works
- Share → see if it works

Reviewed By: PeteTheHeat

Differential Revision: D16957751

Pulled By: hramos

fbshipit-source-id: ae2a4478e2e7f8d2be3022c9c4861561ec244a26
2020-03-04 14:25:12 -08:00
Tim Yung fc45530ded Pressability: Restore Press In Delay
Summary:
During the development of `Pressability`, I removed the default "press in delay" in order to minimize differences between `Touchable` (as used by `TouchableWithoutFeedback`) and `Pressability`. However, it was a bug that `TouchableWithoutFeedback` zero'd out the default press delay.

This restores the original "press in delay". This will make it so that when users swipe over a pressable element in a scroll view, the scroll view will have time to cancel the touch and prevent a press in behavior (visual jank).

Changelog:
[General] [Changed] - Increase default `delayPressIn` value for `Pressability` to 130ms.

Reviewed By: TheSavior

Differential Revision: D20176152

fbshipit-source-id: 5d6481395ee501bcab20ab98cb46a6be2c423ddf
2020-03-04 11:06:48 -08:00
Samuel Susla 3ee1e5312a Back out "Rename measure to measureContent and pass it LayoutContext"
Summary:
Original commit changeset: 8928b59d5194

Changelog: [Internal]

Reviewed By: makovkastar

Differential Revision: D20246918

fbshipit-source-id: 0b9142d9bc4774a07304769126411a34cc8c33c5
2020-03-04 05:01:53 -08:00