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

5883 Коммитов

Автор SHA1 Сообщение Дата
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
Vojtech Novak 884c86ae02 change onRefresh flow typing (#28167)
Summary:
I propose this change because we (and a lot of other people, I'd guess) pass an `async` function as a parameter to `onRefresh`. Because the `async` function returns a `promise`, flow is reporting an error. I think the type checking here can be relaxed either all the way to `any` (because RN does not care here what we return) or to `void | Promise<void>` to account for async functions.

looking at fb7b2d3533 (diff-a9c5687ae65236ba3e7f34bfdcdec81d) seems like the second is preferred

## Changelog

[General] [changed] - relax RefreshControl's onRefresh flow typing
Pull Request resolved: https://github.com/facebook/react-native/pull/28167

Test Plan: * flow passes

Reviewed By: hramos

Differential Revision: D20196529

Pulled By: TheSavior

fbshipit-source-id: bb5a314bcfb5fb9c8ab71eccb449f1322aeebacb
2020-03-03 16:00:52 -08:00
Samuel Susla b40f0562f5 Rename measure to measureContent and pass it LayoutContext
Summary:
In order to build dynamic text sizing, `LayoutableShadowNode::measure` needs to accept `LayoutContext`

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D20184598

fbshipit-source-id: 8928b59d51948caf3654f40049212a89a91dceb6
2020-03-03 04:14:04 -08:00
Riley Dulin ce1703a84d Change stringifySafe to have limits on larger objects
Summary:
In heap snapshots, it was found that really large (20 MB) strings representing network data
were being logged as part of `Systrace.beginEvent` strings from `MessageQueue` in DEV mode.

To combat this, use `JSON.stringify` with limits to keep the depth, strings, arrays, and objects
in check.

Changelog: [Internal] Change `stringifySafe` to have max limits on string size

Reviewed By: yungsters

Differential Revision: D20016501

fbshipit-source-id: e123016557bc154e4210e0b4df44360570da8016
2020-03-02 17:28:21 -08:00
Tom Underhill f4de45800f PlatformColor implementations for iOS and Android (#27908)
Summary:
This Pull Request implements the PlatformColor proposal discussed at https://github.com/react-native-community/discussions-and-proposals/issues/126.   The changes include implementations for iOS and Android as well as a PlatformColorExample page in RNTester.

Every native platform has the concept of system defined colors. Instead of specifying a concrete color value the app developer can choose a system color that varies in appearance depending on a system theme settings such Light or Dark mode, accessibility settings such as a High Contrast mode, and even its context within the app such as the traits of a containing view or window.

The proposal is to add true platform color support to react-native by extending the Flow type `ColorValue` with platform specific color type information for each platform and to provide a convenience function, `PlatformColor()`, for instantiating platform specific ColorValue objects.

`PlatformColor(name [, name ...])` where `name` is a system color name on a given platform.  If `name` does not resolve to a color for any reason, the next `name` in the argument list will be resolved and so on.   If none of the names resolve, a RedBox error occurs.  This allows a latest platform color to be used, but if running on an older platform it will fallback to a previous version.
 The function returns a `ColorValue`.

On iOS the values of `name` is one of the iOS [UI Element](https://developer.apple.com/documentation/uikit/uicolor/ui_element_colors) or [Standard Color](https://developer.apple.com/documentation/uikit/uicolor/standard_colors) names such as `labelColor` or `systemFillColor`.

On Android the `name` values are the same [app resource](https://developer.android.com/guide/topics/resources/providing-resources) path strings that can be expressed in XML:
XML Resource:
`@ [<package_name>:]<resource_type>/<resource_name>`
Style reference from current theme:
`?[<package_name>:][<resource_type>/]<resource_name>`
For example:
- `?android:colorError`
- `?android:attr/colorError`
- `?attr/colorPrimary`
- `?colorPrimaryDark`
- `android:color/holo_purple`
- `color/catalyst_redbox_background`

On iOS another type of system dynamic color can be created using the `IOSDynamicColor({dark: <color>, light:<color>})` method.   The arguments are a tuple containing custom colors for light and dark themes. Such dynamic colors are useful for branding colors or other app specific colors that still respond automatically to system setting changes.

Example: `<View style={{ backgroundColor: IOSDynamicColor({light: 'black', dark: 'white'}) }}/>`

Other platforms could create platform specific functions similar to `IOSDynamicColor` per the needs of those platforms.   For example, macOS has a similar dynamic color type that could be implemented via a `MacDynamicColor`.   On Windows custom brushes that tint or otherwise modify a system brush could be created using a platform specific method.

## Changelog

[General] [Added] - Added PlatformColor implementations for iOS and Android
Pull Request resolved: https://github.com/facebook/react-native/pull/27908

Test Plan:
The changes have been tested using the RNTester test app for iOS and Android.   On iOS a set of XCTestCase's were added to the Unit Tests.

<img width="924" alt="PlatformColor-ios-android" src="https://user-images.githubusercontent.com/30053638/73472497-ff183a80-433f-11ea-90d8-2b04338bbe79.png">

In addition `PlatformColor` support has been added to other out-of-tree platforms such as macOS and Windows has been implemented using these changes:

react-native for macOS branch: https://github.com/microsoft/react-native/compare/master...tom-un:tomun/platformcolors

react-native for Windows branch: https://github.com/microsoft/react-native-windows/compare/master...tom-un:tomun/platformcolors

iOS
|Light|Dark|
|{F229354502}|{F229354515}|

Android
|Light|Dark|
|{F230114392}|{F230114490}|

{F230122700}

Reviewed By: hramos

Differential Revision: D19837753

Pulled By: TheSavior

fbshipit-source-id: 82ca70d40802f3b24591bfd4b94b61f3c38ba829
2020-03-02 15:12:09 -08:00
Luna Wei b8715dc31c Throw error when setting value of AnimatedValue to undefined
Summary:
Changelog: [Internal] Throw error when setting Animated value to undefined.

Background:
ReadableNativeMap removes keys that have undefined values. Somewhere some animation is setting the value to be undefined.

Follow up: Find a way to warn generally that undefined values are being set for maps that become ReadableNativeMaps

Reviewed By: JoshuaGross

Differential Revision: D20169325

fbshipit-source-id: 404b727dc238703ebe5f71a0939340d5f1b3b211
2020-03-02 13:17:01 -08:00
Janic Duplessis 0569d4c431 Remove JS autoFocus implementation (#27923)
Summary:
Follow up to https://github.com/facebook/react-native/issues/27803 and https://github.com/facebook/react-native/issues/27924. We no longer need to call focus on mount from JS as both iOS and Android implements it natively now.

## Changelog

[General] [Fixed] - Remove JS autoFocus implementation
Pull Request resolved: https://github.com/facebook/react-native/pull/27923

Test Plan: Test that focus works in RN Tester with this, https://github.com/facebook/react-native/issues/27803 and https://github.com/facebook/react-native/issues/27924

Differential Revision: D19956373

Pulled By: TheSavior

fbshipit-source-id: 5d99ead55011663b3edaf499ac7616765a24cb50
2020-03-02 11:34:36 -08:00
Kevin Gozali 30822e3923 make RN infra labels public
Summary:
Internal build target labeling.

Changelog: [Internal]

Reviewed By: zlern2k

Differential Revision: D20152676

fbshipit-source-id: 89615a0b3a6f3994b18f2c07b86d0ae93e052327
2020-02-28 12:46:49 -08:00
Pieter De Baets 64720ab14a Improve typing of Animated component wrappers
Summary:
Provides flow-types for callers of AnimatedScrollView etc

Changelog: [Internal] [Fixed] Fixed flow types of Animated components

Reviewed By: cpojer

Differential Revision: D20158990

fbshipit-source-id: 3d06a89086629eb9f9d2cc0f3e7a819a80456fb0
2020-02-28 09:31:12 -08:00
Arjan Zuidema 0a9cc34dd8 Added userInterfaceStyle prop to ActionSheetmanager to override user interface style for iOS 13 (#26401)
Summary:
Support to override actionsheet and share interface style to match your app. For example, when your app has it's own theming you want to match the stying on actionsheet and the share menu.

## Changelog

[iOS] [Added] - Added userInterfaceStyle for ActionSheetIOS and Share to override user interface style on IOS 13
Pull Request resolved: https://github.com/facebook/react-native/pull/26401

Test Plan:
Set dark style
![dark](https://user-images.githubusercontent.com/30040390/64685321-12a53080-d487-11e9-8846-f2ef89e114a2.jpg)
Set light style
![light](https://user-images.githubusercontent.com/30040390/64685322-12a53080-d487-11e9-9dfd-1e07b9fe0ce2.jpg)

Differential Revision: D17314080

Pulled By: hramos

fbshipit-source-id: f84278ca99ba20347d17e27295f661d6690fa68c
2020-02-28 00:08:54 -08:00
Eli White 9fdb96eec7 Partial React Sync from 241c4467e...00d8e5b80
Summary:
- **[00d8e5b80](https://github.com/facebook/react/commit/00d8e5b80 )**: [Fabric] Fix targetAsInstance dispatchEvent "cannot read property of null" (#18156) //<Joshua Gross>//
- **[ad84625f8](https://github.com/facebook/react/commit/ad84625f8 )**: [Native] Migrate focus/blur to call TextInputState with the host component (#18068) //<Eli White>//
- **[edab5c074](https://github.com/facebook/react/commit/edab5c074 )**: Re-throw errors thrown by the renderer at the root in the complete phase (#18029) //<Andrew Clark>//
- **[a6dfe9aa4](https://github.com/facebook/react/commit/a6dfe9aa4 )**: [Native] Delete NativeComponent and NativeMethodsMixin (#18036) //<Eli White>//

Changelog:
[General][React] Partial React Sync from 241c4467e...00d8e5b80

Reviewed By: JoshuaGross

Differential Revision: D20153744

fbshipit-source-id: 09c5fec620370f1844a89af1c6ba2d487020216d
2020-02-27 19:39:26 -08:00
Ramanpreet Nara 6a9a76e420 Make RCTDevLoadingView TurboModule-compatible
Summary:
This is a redo of D16969764, with a few extensions.

## Changes
1. Move `RCTDevLoadingView.{h,m}` to `CoreModuels/RCTDevLoadingView.{h,mm}`
2. Extract ObjC API of `RCTDevLodingView` into `RCTDevLoadingViewProtocol` in `ReactInternal`.
3. Create API `RCTDevLoadingViewSetEnabled.h` in `ReactInternal` to enable/disable `RCTDevLoadingView`

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

Reviewed By: PeteTheHeat

Differential Revision: D18642554

fbshipit-source-id: 6b62e27e128d98254b7a6d018399ec1c06e274fc
2020-02-27 17:06:13 -08:00
Hans Halverson a3d9e91203 Move suppression to primary locations in xplat/js
Summary:
We will soon be enforcing that flow suppressions will only apply when on an error's primary location ([post](https://fb.workplace.com/groups/179614562644215/permalink/559286354677032/)). This diff uses the codemod created in D20008770 to move all suppression comments to their primary locations in the  `xplat/js` flow root, and deletes suppression comments that are not on any primary locations.

This diff was generated with:
```
~/fbsource/fbcode/flow/packages/flow-dev-tools/bin/tool suppression-primary-locations --json-file ~/www/errors.json  ~/fbsource/xplat/js
hg st -n | xargs grep -l -P '@(partially-)?generated' | xargs hg revert
hg st -n | xargs grep -l 'format' | xargs prettier --write
```

Changelog: [Internal]

bypass-lint

Reviewed By: dsainati1

Differential Revision: D20122544

fbshipit-source-id: d94e409aadb18bb399a1ddbf9f3f2494fe4fb54c
2020-02-27 12:14:57 -08:00
Samuel Susla d33ead3f16 Fix matricesDiffer ignoring first value of matrix
Summary:
Changelog: [internal]

# Problem

Implementation of `matricesDiffer` was ignoring first element in the matrix, therefore two matrixes that were different were actually evaluated as same and React didn't pass value to native.

# Solution

Take first element in the matrix into account when comparing matrices.

Reviewed By: cpojer

Differential Revision: D20117210

fbshipit-source-id: 84c3b4e580da44bda4fc8bd8669318282ae9aa32
2020-02-27 05:43:02 -08:00
Nikita Kraev 79efa43428 Update ImageEditingManager to use internal storage before falling back to external for cache
Summary:
Changelog: [Android] [Changed] - Internal storage now will be preferred for caching images from ImageEditor.

Now we try to write to internal cache directory first.
If that fails (due to no memory error or other IOException), we attempt to write to external storage (if that is allowed).

I introduced additional configuration flag, `allowExternalStorage` which is true by default.
And i updated documentation for new behaviour - see
 `ImageEditor.cropImage(..)` comment.

Reviewed By: makovkastar

Differential Revision: D19878158

fbshipit-source-id: 7e338ce68f535f74c62b5eecd5a94af7e7396f8b
2020-02-25 05:46:59 -08:00
Rick Hanlon 956359bee6 Handle errors in Metro by showing a code frame
Summary:
Right now the code frame and stack trace for metro errors are useless. This diff improved these errors by showing the metro code frame for the source of the issue, and stripping the stack trace.

Ideally we could show the metro stack trace as well, but since stack traces are tightly coupled to symbolication (and metro source code does not need symbolicated, nor could it be), this is an acceptable incremental improvement.

Arguably, even showing the code frame is inappropriate and we should show a generic crash screen with reload and report buttons.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D20057353

fbshipit-source-id: 5e999cea14c1cbd2f69737e3992a3e8d159fdf89
2020-02-25 04:34:38 -08:00
Joshua Gross ed5f9eeb2a TextInput: use commands instead of setNativeProps on Android
Summary:
Use codegen'd ViewCommands added in previous diff as a replacement for setNativeProps.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18619298

fbshipit-source-id: 08069e828e92ac3cca9813bbcdca99d99fb50883
2020-02-24 16:19:36 -08:00
Joshua Gross 7f80b1c8c7 TextInput: Fix controlled TextInput selection in Paper
Summary:
The migration from classy to functional component partially broke controlled TextInput selections. This fixes it.

The nuance is that even though we have "event counters" sent from native, "onChange" and "onChangeSelection" are separate events;
so even if you receive new text and a new native event counter, your selection may be out-of-date. Incrementing the event counter
when sending selection events breaks text updates; and adding another native event counter seems like overkill. Instead, in JS, we statefully
keep track of (1) the native event counter, (2) whether or not the selection has been updated for that event counter.

Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D18867152

fbshipit-source-id: c569ecd03ce0042d6feb5fa8af4c756588607a09
2020-02-24 16:19:35 -08:00
Kacie Bawiec aebeb3b0a9 Add Snapshot Rendering Test to ScrollView
Summary:
As title.

Changelog: [Added] Add snapshot rendering test to ScrollView

Reviewed By: zackargyle, TheSavior

Differential Revision: D20037673

fbshipit-source-id: 4270bc63a6065789f072893756468b67deae169d
2020-02-24 14:48:40 -08:00
Rachel Nabors c0d8c1db90 Updating the URLs to point at new domain name reactnative.dev
Summary:
We recently updated React Native's docs site to have its own domain reactnative.dev and needed to update the URLs in the source code

CHANGELOG:
[INTERNAL]

Reviewed By: hramos

Differential Revision: D20072842

fbshipit-source-id: 1970d9214c872a6e7abf697d99f8f5360b3b308e
2020-02-24 13:09:11 -08:00
generatedunixname89002005287564 796a4ea7e3 Add "complete_nullability = True" to compatible libraries
Reviewed By: natestedman

Differential Revision: D19968574

fbshipit-source-id: cf31e22e4a624f2f2a37bfd1b23ae65ff121f263
2020-02-24 07:38:53 -08:00
Pieter De Baets bcc6f9b5e4 Avoid unneccessary array copies in timer callbacks
Summary:
Removed an array.slice() call in the callImmediatesPass, which seems unnecessary to me, as the variable is immediately re-assigned on the next line.

Also fixed some flow issues, clarified a systrace marker and opensourced the relevant tests.

Changelog: [Internal] [Fixed] Improved JSTimer efficiency

Reviewed By: yungsters

Differential Revision: D20039181

fbshipit-source-id: 9b146980e8fa9f94b2f6153cc67cc7ced58104e5
2020-02-24 03:17:27 -08:00