Commit Graph

15897 Commits

Author SHA1 Message Date
David Vacca 6a71d51250 Trivial rename
Summary: Trivial rename

Reviewed By: fkgozali

Differential Revision: D14011984

fbshipit-source-id: dd2e7e0221bdad7b482c6a39b1cc877779c9704c
2019-02-08 18:55:35 -08:00
Valentin Shergin fd3b8f2000 Fabric: Introducing Better: For faster, clear and ideomatic codebase
Summary:
`Better` is a trivial collection of basic tools borrowed from other low-level general purpose libraries (like Folly, Abseil or Boost). The main goals of Better:
 - Make the codebase more portable;
 - Make the dependency list explicit (by decoupling it as a dependency list of Better);
 - Make relying on modern C++ patterns and tools in code simple and easy.
 - Make executing experiments with different dependencies easier.

 As a first example usage, this diff replaces std::unordered_map with an efficient one from folly on the one of the hottest paths.

Reviewed By: JoshuaGross

Differential Revision: D13944565

fbshipit-source-id: 5fa2c4abe6c17f7361eddcc25f968b6440d5d9db
2019-02-08 13:57:33 -08:00
Christoph Nakazawa 7ecf55fc9d Enforce rules-of-hooks via eslint
Summary:
allow-large-files

Enforce rules-of-hooks in React Native via the eslint-plugin-react-hooks plugin. See https://reactjs.org/docs/hooks-rules.html

Reviewed By: rickhanlonii

Differential Revision: D13998695

fbshipit-source-id: 48f1cde18c7112ce91d5087461875bcd0b50bf4f
2019-02-08 07:08:10 -08:00
Christoph Nakazawa ccefc700d0 React sync for revisions 6bf5e85...aa94237 (#23320)
Summary:
allow-large-files

This sync includes the following changes:
- **[45fc46bfa](https://github.com/facebook/react/commit/45fc46bfa )**: 16.8.1 packages //<Brian Vaughn>//
- **[f2e2637c8](https://github.com/facebook/react/commit/f2e2637c8 )**: Backwards compat fix for ReactCurrentDispatcher on older react versions (#14770) //<Brian Vaughn>//
- **[1107b9673](https://github.com/facebook/react/commit/1107b9673 )**: [TestUtils.act] warn when using TestUtils.act in node (#14768) //<Sunil Pai>//
- **[0975ea327](https://github.com/facebook/react/commit/0975ea327 )**: eslint-plugin-react-hooks v1.0.0 //<Brian Vaughn>//
- **[bc9818f24](https://github.com/facebook/react/commit/bc9818f24 )**: Scheduler.unstable_next (#14756) //<Andrew Clark>//
- **[ce6ecd3fb](https://github.com/facebook/react/commit/ce6ecd3fb )**: Add 16.8.0 changelog and update some READMEs (#14692) //<Dan Abramov>//
- **[008a2ab9c](https://github.com/facebook/react/commit/008a2ab9c )**: 16.8.0 //<Brian Vaughn>//
- **[d1326f466](https://github.com/facebook/react/commit/d1326f466 )**: [TestUtils.act] fix return result checking  (#14758) //<Sunil Pai>//
- **[267ed9814](https://github.com/facebook/react/commit/267ed9814 )**: expose `TestUtils.act()` for batching actions in tests (#14744) //<Sunil Pai>//
- **[fb3f7bfde](https://github.com/facebook/react/commit/fb3f7bfde )**: Avoid importing Scheduler directly (#14757) //<Andrew Clark>//
- **[e602b5291](https://github.com/facebook/react/commit/e602b5291 )**: Use SameValue instead of === to check for dispatchAction equivalence (#14752) //<Jessica Franco>//
- **[e489c3f9c](https://github.com/facebook/react/commit/e489c3f9c )**: Update the version with Hooks proposal in README (#14751) //<SToneX>//
- **[c21c41ecf](https://github.com/facebook/react/commit/c21c41ecf )**: Tweak invalid Hook warning and error (#14747) //<Dan Abramov>//
- **[fec00a869](https://github.com/facebook/react/commit/fec00a869 )**: Typo in comment (#14739) //<Deniz Susman>//
- **[66eb29374](https://github.com/facebook/react/commit/66eb29374 )**: Restrict effect return type to a function or nothing (#14119) //<Andrew Clark>//
- **[51c07912a](https://github.com/facebook/react/commit/51c07912a )**: Warn when second argument is passed to useCallback (#14729) //<Dan Abramov>//
- **[70d407583](https://github.com/facebook/react/commit/70d407583 )**: Move Hook mismatch warning to first mismatch site (#14720) //<Andrew Clark>//
- **[ba6477aa3](https://github.com/facebook/react/commit/ba6477aa3 )**: Improve Reducer Hook's lazy init API (#14723) //<Andrew Clark>//
- **[cb1ff430e](https://github.com/facebook/react/commit/cb1ff430e )**: Phased dispatcher (#14701) //<Andrew Clark>//
- **[9d483dcfd](https://github.com/facebook/react/commit/9d483dcfd )**: Spelling abitrarily -> arbitrarily (#14710) //<Peter Donald>//
- **[e19c9e106](https://github.com/facebook/react/commit/e19c9e106 )**: Fix issue with multiple code branches in hooks linter (#14661) //<Yurick>//
- **[f11a9c1cb](https://github.com/facebook/react/commit/f11a9c1cb )**: State update bug in concurrent mode (#14698) //<Brian Vaughn>//
- **[e679a4b6e](https://github.com/facebook/react/commit/e679a4b6e )**: Fix typo in code comment (#14696) //<Greg Hurrell>//
- **[8bcc88f2e](https://github.com/facebook/react/commit/8bcc88f2e )**: Make all readContext() and Hook-in-a-Hook checks DEV-only (#14677) //<Dan Abramov>//
- **[6cb26774e](https://github.com/facebook/react/commit/6cb26774e )**: Enable hooks! (#14679) //<Brian Vaughn>//
- **[73962c366](https://github.com/facebook/react/commit/73962c366 )**: Revert "Revert "Double-render function components with Hooks in DEV in StrictMode" (#14652)" (#14654) //<Dan Abramov>//
- **[994439228](https://github.com/facebook/react/commit/994439228 )**: Put DEV-only code into DEV blocks (#14673) //<Dan Abramov>//
- **[f0befae65](https://github.com/facebook/react/commit/f0befae65 )**: Tweak context invariant message (#14671) //<Dan Abramov>//
- **[a129259ad](https://github.com/facebook/react/commit/a129259ad )**: Disallow reading context during useMemo etc (#14653) //<Dan Abramov>//
- **[c068d31cc](https://github.com/facebook/react/commit/c068d31cc )**: Add unit tests for concurrent mode event dispatching (#14415) //<Sebastian Markbåge>//
- **[38247cba3](https://github.com/facebook/react/commit/38247cba3 )**: --save is no longer needed (#14302) //<SamCortopassi>//
- **[3f0bcaf0d](https://github.com/facebook/react/commit/3f0bcaf0d )**: Importing React for the first example. (#14346) //<Ramón Chancay Ortega>//
- **[ecd919a2f](https://github.com/facebook/react/commit/ecd919a2f )**: RFC: warn when returning different hooks on subsequent renders (#14585) //<Sunil Pai>//
- **[3fbebb2a0](https://github.com/facebook/react/commit/3fbebb2a0 )**: Revert "Double-render function components with Hooks in DEV in StrictMode" (#14652) //<Dan Abramov>//
- **[5fce6488c](https://github.com/facebook/react/commit/5fce6488c )**: Revert "Disallow reading context during useMemo etc" (#14651) //<Dan Abramov>//
- **[fe2ecd276](https://github.com/facebook/react/commit/fe2ecd276 )**: Add test coverage for readContext() on the server (#14649) //<Dan Abramov>//
- **[8f45a7fdc](https://github.com/facebook/react/commit/8f45a7fdc )**: Warn about incorrect use of useImperativeHandle() (#14647) //<Dan Abramov>//
- **[1fcbd2243](https://github.com/facebook/react/commit/1fcbd2243 )**: Disallow reading context during useMemo etc (#14648) //<Dan Abramov>//
- **[2a084f51a](https://github.com/facebook/react/commit/2a084f51a )**: Warn about refs on lazy function components (#14645) //<Dan Abramov>//
- **[b5a3df6e8](https://github.com/facebook/react/commit/b5a3df6e8 )**: Fix typo (#14560) //<Linchengyi>//
- **[9c146e675](https://github.com/facebook/react/commit/9c146e675 )**: fix typo (#14316) //<liunian>//
- **[baa6d40fc](https://github.com/facebook/react/commit/baa6d40fc )**: Mention forwardRef() in <Fn ref={...} /> errors and warnings (#14644) //<Dan Abramov>//
- **[a1414e894](https://github.com/facebook/react/commit/a1414e894 )**: Double-render function components with Hooks in DEV in StrictMode (#14643) //<Dan Abramov>//
- **[10a7a5b5c](https://github.com/facebook/react/commit/10a7a5b5c )**: Fix synchronous thenable rejection (#14633) //<Dan Abramov>//
- **[a2fa6eb98](https://github.com/facebook/react/commit/a2fa6eb98 )**: Move lazy._result assignment (#14632) //<Dan Abramov>//
- **[9120f6c2d](https://github.com/facebook/react/commit/9120f6c2d )**: Support sync thenables for lazy() (#14626) //<Dan Abramov>//
- **[b66e6e41e](https://github.com/facebook/react/commit/b66e6e41e )**: Add directory details to the package.json of all packages (#14628) //<Grey Baker>//
- **[177fb7635](https://github.com/facebook/react/commit/177fb7635 )**: Warn when second callback is passed to setState/dispatch in Hooks (#14625) //<Dan Abramov>//
- **[d17d0b99c](https://github.com/facebook/react/commit/d17d0b99c )**: Use public context.report interface in eslint rules (#14623) //<Sebastian Silbermann>//
- **[4f332885a](https://github.com/facebook/react/commit/4f332885a )**: Fix shallow renderer set instance state after gDSFP before calling sCU (#14613) //<Yi-Shan, Chen>//
- **[e1cd83e49](https://github.com/facebook/react/commit/e1cd83e49 )**: Throw an error when using hooks inside useMemo/useState/useReducer, or .memo's comparator (#14608) //<Sunil Pai>//
- **[be457ca68](https://github.com/facebook/react/commit/be457ca68 )**: Small tweaks to SSR to match #14594 (#14618) //<Dan Abramov>//
- **[17d70df91](https://github.com/facebook/react/commit/17d70df91 )**: Warn when mixing createRoot() and old APIs (#14615) //<Dan Abramov>//
- **[4feab7fc9](https://github.com/facebook/react/commit/4feab7fc9 )**: Add hooks support to ReactShallowRenderer (#14567) //<Dominic Gannaway>//
- **[1454a8be0](https://github.com/facebook/react/commit/1454a8be0 )**: Don't bother comparing constructor when deps are not provided (#14594) //<Andrew Clark>//
- **[71b64d521](https://github.com/facebook/react/commit/71b64d521 )**: Warn if number of hooks increases (#14591) //<Andrew Clark>//
- **[790c8ef04](https://github.com/facebook/react/commit/790c8ef04 )**: Allow useReducer to bail out of rendering by returning previous state (#14569) //<Andrew Clark>//
- **[7ab8a8e97](https://github.com/facebook/react/commit/7ab8a8e97 )**: Added Flow type to keep hooks dispatchers in-sync (#14599) //<Brian Vaughn>//
- **[4392e3821](https://github.com/facebook/react/commit/4392e3821 )**: useDebugValue should throw if used in a class component (#14601) //<Brian Vaughn>//
- **[153a0b598](https://github.com/facebook/react/commit/153a0b598 )**: Add noop useDebugValue hook to partial/server renderer (#14597) //<Brian Vaughn>//
- **[7ad9806d1](https://github.com/facebook/react/commit/7ad9806d1 )**: Tweak to avoid property read (#14593) //<Brandon Dail>//
- **[0fc154751](https://github.com/facebook/react/commit/0fc154751 )**: Avoid new Set([iterable]) for thenables (#14592) //<Brandon Dail>//
- **[edb1f5956](https://github.com/facebook/react/commit/edb1f5956 )**: Support configurable labels for custom hooks (#14559) //<Brian Vaughn>//
- **[3e15b1c69](https://github.com/facebook/react/commit/3e15b1c69 )**: make a fork for ReactCurrentDispatcher (#14588) //<Sunil Pai>//
- **[0005d1e3f](https://github.com/facebook/react/commit/0005d1e3f )**: Fix typo (#14576) //<Carl Mungazi>//
- **[f290138d3](https://github.com/facebook/react/commit/f290138d3 )**: react-debug-tools accepts currentDispatcher ref as param (#14556) //<Brian Vaughn>//
- **[b4ad8e947](https://github.com/facebook/react/commit/b4ad8e947 )**: rename useImperativeMethods -> useImperativeHandle (#14565) //<Sunil Pai>//
- **[ab03e3d65](https://github.com/facebook/react/commit/ab03e3d65 )**: Inject ReactCurrentDispatcher ref to DevTools (#14550) //<Brian Vaughn>//
- **[19ef0ec11](https://github.com/facebook/react/commit/19ef0ec11 )**: Separate current owner and dispatcher (#14548) //<Brian Vaughn>//
- **[a9b035b0c](https://github.com/facebook/react/commit/a9b035b0c )**: Separate Object.is polyfill (#14334) //<Maksim Markelov>//
- **[547e059f0](https://github.com/facebook/react/commit/547e059f0 )**: Simplify wording of key warning (#14503) //<Sophie Alpert>//
- **[3494ee57e](https://github.com/facebook/react/commit/3494ee57e )**: Update ReactUpdateQueue.js (#14521) //<Carl Mungazi>//
- **[659c13963](https://github.com/facebook/react/commit/659c13963 )**: Update ReactFiberScheduler.js (#14477) //<Carl Mungazi>//
- **[c695b2384](https://github.com/facebook/react/commit/c695b2384 )**: React v16.7.0 //<Andrew Clark>//
- **[1c5aa2f23](https://github.com/facebook/react/commit/1c5aa2f23 )**: Move SchedulerFeatureFlags fork to src directory to fix lint //<Andrew Clark>//
- **[653bc582f](https://github.com/facebook/react/commit/653bc582f )**: Create separate SchedulerFeatureFlags instead of using ReactFeatureFlags (#14455) //<Andrew Clark>//
- **[8bfef0da5](https://github.com/facebook/react/commit/8bfef0da5 )**: Make scheduler debugging feature flag static //<Andrew Clark>//
- **[4a1072194](https://github.com/facebook/react/commit/4a1072194 )**: Memoize promise listeners to prevent exponential growth (#14429) //<Andrew Clark>//
- **[535804f5c](https://github.com/facebook/react/commit/535804f5c )**: Removed Fabric-specific feature flag files and updated Rollup to use the (non-Fabric) React Native flag files. (#14437) //<Brian Vaughn>//
- **[2743fb7b2](https://github.com/facebook/react/commit/2743fb7b2 )**: Enable hooks by default for FB React Native renderer (#14435) //<Brian Vaughn>//
- **[7325ebe4d](https://github.com/facebook/react/commit/7325ebe4d )**: Inject overrideProps() fn to DevTools (#14427) //<Brian Vaughn>//
- **[a22880e5e](https://github.com/facebook/react/commit/a22880e5e )**: Add support for Suspense & lazy() to the react-is package (#14423) //<Pleun Vanderbauwhede>//
- **[947bddd5c](https://github.com/facebook/react/commit/947bddd5c )**: Remove redundant argument of getPlugins function (#14419) //<Heaven>//
- **[8df4d59be](https://github.com/facebook/react/commit/8df4d59be )**: Implement pauseExecution, continueExecution, dumpQueue for Scheduler (#14053) //<Kevin Chavez>//
- **[5bb4ad737](https://github.com/facebook/react/commit/5bb4ad737 )**: Added ErrorBoundary tests for useEffect and useLayoutEffect (#14401) //<Brian Vaughn>//
- **[98eb5ae53](https://github.com/facebook/react/commit/98eb5ae53 )**: TestRenderer toJSON should not expose the Array wrapper Suspense uses for hidden trees (#14392) //<Brian Vaughn>//
- **[39489e767](https://github.com/facebook/react/commit/39489e767 )**: Enable hooks in fabric (#14301) //<Spencer Ahrens>//
- **[1dc108e58](https://github.com/facebook/react/commit/1dc108e58 )**: Tweaked wording for v8 "performance cliff" issue //<Brian Vaughn>//

Release Notes:
[GENERAL] [Changed] - React sync for revisions 6bf5e85...aa94237 (React 16.8.1)

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

Reviewed By: rickhanlonii

Differential Revision: D13976467

fbshipit-source-id: 4ce198e86a54658e1c35aa36bffe4a7dc2956a2e
2019-02-08 07:08:10 -08:00
Dulmandakh b640b6faf7 nullable annotations to ReadableMap, WritableMap, ReadableArray, Writable. (#23329)
Summary:
Kotlin is getting traction and more developers write RN native modules in it. This PR adds nullable annotations to help with Kotlin null inference and improve developer experience. Also it'll help checking code quality using lint.

I skimmed through JavaOnlyMap.java, JavaOnlyArray.java, ReadableNativeArray.java, ReadableNativeMap.java, WritableNativeArray.java and WritableNativeMap.java to infer nullability.

This is breaking change to Kotlin code.

[Android] [Changed] - Add nullable annotations to ReadableMap, WritableMap, ReadableArray, Writable.
Pull Request resolved: https://github.com/facebook/react-native/pull/23329

Differential Revision: D14002571

Pulled By: cpojer

fbshipit-source-id: 899d8b3b0a5dad43e8300e6c4ea4208cca0f01a9
2019-02-08 04:16:24 -08:00
Héctor Ramos d002d30325 Danger, be nice to PRs. (#23334)
Summary:
Changed Danger's config so that it provides advice whenever it finds an issue with the pull request template, instead of posting a warning.

Updated Danger several major versions, from 2 to 7. I worked through any breaking changes, which were minimal (change `yarn danger` to `yarn danger ci`).

Added a flag to have Danger post these messages as GitHub Checks instead of as a comment. This slightly buries Danger's output, as it's no longer posted as a comment, but I believe it integrates more nicely into the GitHub interface.

[GENERAL] [Changed] - GitHub-only change: updated Danger config to be nicer to PRs
Pull Request resolved: https://github.com/facebook/react-native/pull/23334

Differential Revision: D14002313

Pulled By: cpojer

fbshipit-source-id: b97ca7b7bd164646b249b7c64b1134306e0f38a8
2019-02-08 03:36:58 -08:00
Daniel Sainati af41a53500 make xplat lints explicit
Summary: Turn on xplat warnings individually rather than all at once. This makes it easier for the team to add new lints that we don't necessarily want to enable globally.

Reviewed By: panagosg7

Differential Revision: D13993571

fbshipit-source-id: 019f301f584be268fdcbf5b0540f63ce6fcd54e3
2019-02-07 14:00:45 -08:00
Peter Argany 0bde29e197 Consider SSTs in Platform.isTesting
Summary:
A common util from RN to gate on testing code is `Platform.isTesting()`

Unfortunately, this util does not account for ServerSnapshotTests, since they don't use apple's XCTest infra.

Reviewed By: sahrens

Differential Revision: D13981728

fbshipit-source-id: bf902a04f5d7fcb98a06816f5c2c9b082e7d14b8
2019-02-07 11:07:17 -08:00
Christoph Nakazawa a6bdacb257 Kill react-native-git-upgrade
Summary: This tool doesn't work and is a frequent source of pain for people. Nobody maintains it. Let's kill it and stop recommending it to people (PR on the website repo here: https://github.com/facebook/react-native-website/pull/761 ).

Reviewed By: TheSavior

Differential Revision: D13987587

fbshipit-source-id: d04d31d3ecba4b9f9387ecb86355b5a5d08485c4
2019-02-07 09:27:02 -08:00
David Aurelio 5319cb29a8 Move `.clang-format` to repo root (#23328)
Summary:
Moves `.clang-format` to repo root to allow for easier discoverability, and integration with auto-format plugins for editors and IDEs.
Pull Request resolved: https://github.com/facebook/react-native/pull/23328

Differential Revision: D13986715

Pulled By: davidaurelio

fbshipit-source-id: fcfda59842da10cd4bc02e4550b74782fbb59e0d
2019-02-07 04:19:49 -08:00
Christoph Nakazawa 5ed749e1b2 Move codegen into packages/react-native-codegen
Summary: This is the first step in organizing React Native slightly differently. This doesn't set up a "monorepo" structure for the GitHub repo yet, it merely moves a few files around and I slightly updated the package.json file for the codegen project.

Reviewed By: rickhanlonii, TheSavior

Differential Revision: D13974180

fbshipit-source-id: f53375f3b6618ef12658064cb1fc690ef1f95299
2019-02-07 03:09:05 -08:00
dchersey f307ac7c5e Fixes capitalized I's when emojiis are present after the text being edited. (#21951)
Summary:
Fixes #21243.
Fixes #20908.

Credit goes to superandrew213 who provided the patch based on 0.56; this commit merges and resolved the conflict introduced in 0.57.
Pull Request resolved: https://github.com/facebook/react-native/pull/21951

Differential Revision: D13980799

Pulled By: cpojer

fbshipit-source-id: 6b9f1a1ae54ad9dba043005d683d6a221472c729
2019-02-07 02:15:58 -08:00
Valentin Shergin 9842e39019 Fabric: folly::dynamic was replaced with RawValue in prop-parsing infra
Summary:
Our long-term plan is to completely illuminate `jsi::Value`-to-`folly::dynamic` serialization step in prop parsing process improving performance and memory pressure. At the same time, we don't want to introduce a hard dependency in application code to JSI because it exposes direct access to VM and prevents parsing some data that come *NOT* from JSVM.
RawValue is an extremely light-weight (hopefully fully optimized-out) abstraction that provides limited JSON-like and C++-idiomatic interface.

The current particular implementation is still using `folly::dynamic` inside, but I have fully JSI-powered one which will replace the current one right after we figure out how to deal with folly::dynamic-specific callsites. Or we can implement RawValue in a hybrid manner if a code-size implication of that will be minimal.

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D13962466

fbshipit-source-id: e848522fd242f21e9e771773f2103f1c1d9d7f21
2019-02-06 16:34:46 -08:00
Valentin Shergin b0c8275369 Fabric: Lost comment in EventQueue
Summary: Just a comment.

Reviewed By: JoshuaGross

Differential Revision: D13962465

fbshipit-source-id: 31780a8ccf02d768e3d4b91e7205ceb0ee10fedf
2019-02-06 16:34:46 -08:00
Valentin Shergin 2332cb6fe2 Fabric: A bunch of `#ifdef ANDROID`
Summary: Nothing really changed; the change is only to better express an original intent.

Reviewed By: JoshuaGross

Differential Revision: D13962464

fbshipit-source-id: f385db8ba8662f2150181e47fc6a2a981f809e96
2019-02-06 16:34:46 -08:00
Kevin Gozali 94925d5eb7 TM iOS: Verify that module class conforms to RCTTurboModule before instantiating
Summary: At times, the lookup logic may find a class that's not compliant with RCTTurboModule. If so, it shouldn't be instantiated, and we assume the module doesn't exist.

Reviewed By: JoshuaGross, RSNara

Differential Revision: D13979004

fbshipit-source-id: ac1fa9cc456715cddd101fff13f5a41f9528a74e
2019-02-06 16:10:30 -08:00
Kevin Gozali 3e9f9cfe47 TM iOS: Util to check if an id is TurboModule instance
Summary: Simple macro to do check if TurboModule is enabled and the particular object is RCTTurboModule compliant.

Reviewed By: PeteTheHeat

Differential Revision: D13978368

fbshipit-source-id: 660c7cab7bb074d80d57abead951dad19306ae73
2019-02-06 16:01:31 -08:00
Dulmandakh adc1410572 ReactPicker extends AppCompatSpinner (#23303)
Summary:
Google recommends to extend AppCompat widget, and this PR changes ReactPicker to extend AppCompatSpinner.

[Android] [Changed] - ReactPicker extends AppCompatSpinner
Pull Request resolved: https://github.com/facebook/react-native/pull/23303

Differential Revision: D13973918

Pulled By: cpojer

fbshipit-source-id: f925994eb631815c7461ed519701cd77e7068f38
2019-02-06 12:00:09 -08:00
Joshua Gross 3cca9e76c5 Partially implemented view recycling for Slider with note to improve
Summary: Recycling and dealloc were not implemented at all before for Slider, so I've taken a first stab at it. It's a little more complex than I initially thought, due to things I don't 100% understand about UISlider as well as Fabric, so I've left a TODO note to fix this at some point. We should be aware that view recycling doesn't appear to be working the way I would expect currently though.

Reviewed By: shergin

Differential Revision: D13965475

fbshipit-source-id: fd18a219cead770b63b514fdc868e23214e735b7
2019-02-06 11:51:32 -08:00
Joshua Gross 550a14c216 ImageResponseObserverCoordinator does not need to be shared_ptr
Summary: Don't use shared_ptr in this case, it's not needed.

Reviewed By: shergin

Differential Revision: D13965413

fbshipit-source-id: ec98c13f53c7d558a0cb68cea0f97568dd202cd8
2019-02-06 11:51:32 -08:00
Héctor Ramos 1a76f28fb7 Rename labels in stale.yml (#23319)
Summary:
Otherwise, the bot will nag issues that should be whitelisted. This is a trivial change,
Pull Request resolved: https://github.com/facebook/react-native/pull/23319

Differential Revision: D13974621

Pulled By: hramos

fbshipit-source-id: e3b0f98f0332c75563b2031474fecf4317525cad
2019-02-06 11:29:24 -08:00
Héctor Ramos 9bcd98f1a9 Update issue templates (#23296)
Summary:
Go back to simpler issue template titles, with emoji. The goal is to make it easier, at a glance, to pick the right template.

We also add a new "regression" template that will automatically label the issue as a regression.

Other changes:
- Added Christoph as a CODEOWNER for package.json and markdown file changes. Usually, any PR that touches package.json has to be imported manually by a Facebook employee.

[General] [Changed] - Updated GitHub issue templates.
Pull Request resolved: https://github.com/facebook/react-native/pull/23296

Differential Revision: D13974378

Pulled By: hramos

fbshipit-source-id: d8962a84397c16e7556ac167a3505f7c7d725915
2019-02-06 11:23:12 -08:00
Dulmandakh cf52ab561d add back buildToolsVersion to build.gradle (#23316)
Summary:
add back buildToolsVersion to build.gradle, because many third-party modules depend on it. The lack of this info causing issues in 0.58.

[Android] [Changed] - add back buildToolsVersion to template
Pull Request resolved: https://github.com/facebook/react-native/pull/23316

Differential Revision: D13974264

Pulled By: hramos

fbshipit-source-id: 058fc5617196d6481d1b69d2420c8b2be9cf4f81
2019-02-06 11:15:54 -08:00
Peter Argany 8a5614b283 Add jest test to ensure consistency between AnimatedMock and AnimatedImplementation
Summary: Flow doesn't guarantee that AnimatedMock and AnimatedImplementation won't diverge. Christoph suggested a quick jest test in D13811035

Reviewed By: cpojer

Differential Revision: D13953915

fbshipit-source-id: ba5aeafded429113cc60a6250b5b29d2f8c8ab28
2019-02-06 11:02:33 -08:00
Dulmandakh 833429dd63 ReactSlider extends AppCompatSeekBar (#23304)
Summary:
Google recommends to use AppCompat widgets, and this PR changes ReactSlider to extend AppCompatSeekBar.

[Android] [Changed] - ReactSlider extends AppCompatSeekBar
Pull Request resolved: https://github.com/facebook/react-native/pull/23304

Differential Revision: D13973636

Pulled By: cpojer

fbshipit-source-id: 9aa160b186fcea593224c5760a2de0fc3a2b6f85
2019-02-06 10:34:02 -08:00
David Vacca 185320db23 Initialize internals of ReadableNativeMap with the correct initial capacity
Summary: This diff initializes internals maps of ReadableNativeMap with the correct initial capacity

Reviewed By: kathryngray

Differential Revision: D13970989

fbshipit-source-id: d104fcbaf938f377a0138b839375c4bc146f1732
2019-02-06 09:24:19 -08:00
Ram N aa3fc0910a Move CoreModulesPackage to use TurboReactPackage
Summary:
In the path to TurboModules, this was the only package that was using LazyReactPackage. Moving this to use TurboReactPackage now ensures that all the packages now have a similar interface, and more importantly, implement `NativeModule getModule(String name)` method.

Note that in OSS, we still do not run the annotation processor. As a result, we manually create the ReactModuleInfoProvider map, so that this works in OSS also.

Reviewed By: fkgozali

Differential Revision: D9419573

fbshipit-source-id: f5b15713aff0c1a221767f1c23d9b76b04434570
2019-02-06 08:54:05 -08:00
zhongwuzw fb8ba3fe95 Enhance image freshness check before stored into cache (#23226)
Summary:
This is a re-submit of D13895627 which got landed but didn't include a fix to Instagram's code. The sheriffs were unsure how it got landed without running the build.

Currently, before we store the image to cache, we only respect `Cache-Control`, actually, we also may need to check `Expires`、`Last-Modified`, refer to [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#Freshness), and  [okhttp](568a91c44a/okhttp/src/main/java/okhttp3/internal/cache/CacheStrategy.java (L268)) respect the `MDN`, so in iOS, we can also respect this.

[iOS] [Fixed] - Respect `MDN` cache strategy before cache the image.

Reviewed By: shergin

Differential Revision: D13896822

Pulled By: cpojer

fbshipit-source-id: 8c1714f4a17ad40496146806cff3e188a60be93c
2019-02-06 02:07:17 -08:00
Dulmandakh a4840e7ae3 remove redundant targetApi and version checks (#23302)
Summary:
RN supports API 16 and above, but we have redundant historical artifacts where we check and target APIs 16 and below. This PR removes redundant artifacts.

[Android] [Changed] - remove redundant targetApi and version checks
Pull Request resolved: https://github.com/facebook/react-native/pull/23302

Differential Revision: D13970434

Pulled By: mdvacca

fbshipit-source-id: 096b5ee6c8f076b0365e7dda0e77940290077ea2
2019-02-05 23:12:53 -08:00
Joshua Gross b6318acbab Support image props for Slider component, feature parity with pre-Fabric Slider
Summary: The biggest change is that (1) the image proxy/observer code from the Image component has been generalized, (2) the four image props for the Slider component are fully supported, (3) a handful of props that were ignored or buggy on iOS now perform as expected.

Reviewed By: shergin

Differential Revision: D13954892

fbshipit-source-id: bec8ad3407c39a1cb186d9541a73b509dccc92ce
2019-02-05 17:31:40 -08:00
Peter Argany 7f646a5b68 Remove AnimatedImplementation spread from AnimatedMock
Summary:
Follow up to address Spencer's feedback on D13811035

With the spread of AnimatedImplementation, it's impossible to tell whether AnimatedMock gets out of date.

This change coupled with D13953915 forces anyone adding to AnimatedImplementation to consider the mock.

Reviewed By: sahrens

Differential Revision: D13965249

fbshipit-source-id: e324364a75abd42d89d6222151453021618bcd5d
2019-02-05 15:41:57 -08:00
Spencer Ahrens 10c8352141 Fix flow typing of Text
Summary:
Make Text prop types exact to catch tons of errors, including typos like in https://fb.workplace.com/groups/rn.support/permalink/2306953619353240/.

I tried to fix things when it was totally obvious what the intent was, but otherwise tried to keep the existing behavior the same, even if it meant that usage of some props was getting ignored, like `hitSlop`.

Reviewed By: TheSavior

Differential Revision: D13892999

fbshipit-source-id: 5003508a648287e4eca8055fb59da5f03bd066cc
2019-02-05 15:26:53 -08:00
empyrical cae6beff74 JSBigString.h: Remove duplicate include of 'unistd.h' (#23297)
Summary:
This removes the accidental double include of the header `unistd.h` from `JSBigString.h`. One was added by me as part of #22330, and one by matthargett as part of #21764

[General] [Fixed] - `JSBigString.h`: Removed accidental double include of header `unistd.h`
Pull Request resolved: https://github.com/facebook/react-native/pull/23297

Differential Revision: D13961223

Pulled By: hramos

fbshipit-source-id: c0dba8a475b3c09356d34cb65b989c286793fa67
2019-02-05 12:41:46 -08:00
Dulmandakh 3b9604feda ReactActivity extends AppCompatActivity (#23278)
Summary:
Google recommends to extend AppCompatActivity. and This PR changes ReactActivity to extend AppCompatActivity

[Android] [Changed] - ReactActivity extends AppCompatActivity
Pull Request resolved: https://github.com/facebook/react-native/pull/23278

Reviewed By: fkgozali

Differential Revision: D13937917

Pulled By: mdvacca

fbshipit-source-id: 4216482b30349b24e3cbf2bdc24d9a890744132f
2019-02-05 12:20:38 -08:00
Dulmandakh d53dbb0dfb SuppressLint("MissingPermission") in Location, NetInfo, Vibration mod… (#23294)
Summary:
Location, NetInfo and Vibration modules require its own permissions to work properly, and Android Studio and lint shows warning in the modules because permissions are not found in AndroidManifest.xml of ReactAndroid, due to that not all apps require these functionalities/permissions. Therefore, developers have to add required permissions if they want to use before mentioned functionalities.

This PR suppresses missing permission warnings.

[Android] [Changed] - Suppress missing permission warnings
Pull Request resolved: https://github.com/facebook/react-native/pull/23294

Differential Revision: D13959120

Pulled By: cpojer

fbshipit-source-id: 10526f1218989b805528a5415e03371d5865be63
2019-02-05 10:34:46 -08:00
Dulmandakh 38eb2a70af Enable Java8 (#23295)
Summary:
Running *lint* on RN found that there are some Java 8 features used without specifying Java 8 compatibility in projects. This PR adds Java 8 compatibility and fixes errors caused by Java 8 feature use. I suspend that it may be cause of many failures on older Androids, but also found that many modules/packages switched to and require Java 8.

```java
../../src/main/java/com/facebook/react/devsupport/BundleDownloader.java:167: Try-with-resources requires API level 19 (current min is 16)
../../src/main/java/com/facebook/react/devsupport/DevServerHelper.java:658: Try-with-resources requires API level 19 (current min is 16)
```

For more information https://developer.android.com/studio/write/java8-support

[Android] [Changed] - Enable Java 8
Pull Request resolved: https://github.com/facebook/react-native/pull/23295

Differential Revision: D13959096

Pulled By: cpojer

fbshipit-source-id: 0bfd0565b61a132906cf35ee55b4afcf5450f7cb
2019-02-05 10:18:27 -08:00
REDMOND\acoates 8beb4bb58a Various minor changes to allow compliation with msvc (#22182)
Summary:
This change is aiming to reduce some of the forking changes we have internally in order to use CxxReact for some additional out of tree platforms.

Some of the fixes allow more of the code to compile when using Microsoft Visual Studio Compiler. In particular the change around the default value of RN_EXPORT and some changes around how to enable the packing attribute.

Another change moves more of the code for JSBigFileString into the cpp file, so that people can share the header but replace the implementation as appropriate for other platforms.

And finally the removal of an unused header include.

This is unlikely to be the extent of the changes required for MSVC, but at least gets one of our complication blocks to work against an unforked RN.
Pull Request resolved: https://github.com/facebook/react-native/pull/22182

Differential Revision: D12967758

Pulled By: cpojer

fbshipit-source-id: a2cc018aedaa9916cd644bfbd9e3a55330cd4c52
2019-02-05 06:14:14 -08:00
Dulmandakh 4d95e85f64 remove unnecessary Android version checks (#23277)
Summary:
React Native's minSdkVersion is 16, or we support Android versions 16 (Jelly Bean) and above. But in the code we have many checks if Android is Jelly Bean or newer, which are unnecessary. This PR removes unnecessary Android version checks, also uses Android version names instead of numbers.

[Android] [Changes] - remove unnecessary Android version checks
Pull Request resolved: https://github.com/facebook/react-native/pull/23277

Differential Revision: D13955909

Pulled By: cpojer

fbshipit-source-id: 6b1caa5ef4fe42273d3c69a6617fff140a697b5c
2019-02-05 03:08:16 -08:00
empyrical 9a7fff9eb1 Introduce generic `warnOnce` function for warning messages (#22109)
Summary:
This pull request adds a function called `warnOnce` that prints a warning message to the console once per session.

It uses a unique key per callsite to help ensure that the message is not printed multiple times.

[General] [Added] - Added new `warnOnce` function for printing a message to the developer console once per session
[General] [Changed] - Changed the warnings in `react-native-implementation` to use `warnOnce`
Pull Request resolved: https://github.com/facebook/react-native/pull/22109

Differential Revision: D13955887

Pulled By: cpojer

fbshipit-source-id: aa51ac427a80cc0554a6bcc915715821d0bd5439
2019-02-05 02:24:59 -08:00
Angel Kjoseski 52bdf34059 Add support for intent:// URIs
Summary:
Adding support for `intent://` URIs.
More details about this type of URIs: https://developer.chrome.com/multidevice/android/intents

Reviewed By: mdvacca

Differential Revision: D13817496

fbshipit-source-id: e1eeb8bd4e293e2c24ce0910286724108b3e10de
2019-02-05 02:18:43 -08:00
Peter Argany 45686c86e2 Mock Animated for testing
Summary:
Animated views can cause flakiness in snapshot tests. This mock replaces all provided Animated transforms with a blank animation.

This could potentially break some tests which animate in elements and then verify their existence. I can deal with that fallout in follow up diffs. One option is making all animations take 0 seconds when testing.

Reviewed By: cpojer

Differential Revision: D13811035

fbshipit-source-id: cc6b13c7d6bad29b125d35ef759a269bb0372e67
2019-02-04 18:33:52 -08:00
Ramanpreet Nara f37093319b Start using getConstants
Summary:
TurboModules depend on a getConstants method. Existing ObjectiveC modules do not have this method. Therefore, I moved the contents of `constantsToExport` to `getConstants` and then had `constantsToExports` call `getConstants`.

facebook
Since all NativeModules will eventually need to be migrated to the TurboModule system, I didn't restrict this to just the NativeModules in Marketplace.

```
const fs = require('fs');

if (process.argv.length < 3) {
    throw new Error('Expected a file containing a list of native modules as the third param');
}

function read(filename) {
    return fs.readFileSync(filename, 'utf8');
}

const nativeModuleFilenames = read(process.argv[2]).split('\n').filter(Boolean);

nativeModuleFilenames.forEach((fileName) => {
    if (fileName.endsWith('.h')) {
        return;
    }

    const absPath = `${process.env.HOME}/${fileName}`;
    const fileSource = read(absPath);

    if (/(\n|^)-\s*\((.+)\)getConstants/.test(fileSource)) {
        return;
    }

    const constantsToExportRegex = /(\n|^)-\s*\((.+)\)constantsToExport/;
    const result = constantsToExportRegex.exec(fileSource);

    if (result == null) {
        throw new Error(`Didn't find a constantsToExport function inside NativeModule ${fileName}`);
    }

    const returnType = result[2];

    const newFileSource = fileSource.replace(
        constantsToExportRegex,
        '$1- ($2)constantsToExport\n' +
        '{\n' +
        `  return ${returnType.includes('ModuleConstants') ? '($2)' : ''}[self getConstants];\n` +
        '}\n' +
        '\n' +
        '- ($2)getConstants'
    );

    fs.writeFileSync(absPath, newFileSource);
});
```

```
> xbgs -l ')constantsToExport'
```

Reviewed By: fkgozali

Differential Revision: D13951197

fbshipit-source-id: 394a319d42aff466c56a3d748e17c335307a8f47
2019-02-04 17:46:56 -08:00
Gabe Levi ffc9908bef Back out "[Flow] Set wait_for_recheck=true to work around crash"
Summary: Now that Flow v0.92.1 is deployed, we can backout {D13942380}, which was a temporary fix.

Reviewed By: avikchaudhuri

Differential Revision: D13952515

fbshipit-source-id: d423379a03fff09316aa499e1152b410a1bb4178
2019-02-04 17:41:04 -08:00
David Vacca 7f27888878 Add performance counters for Fabric
Summary:
This diff adds performance loggers for Fabric in Android to be able to compare current version or RN with Fabric

This is the summary of Points and Annotations:

- **UIManager_CommitStart**: time that React starts the commit (react tree is ready to start rendering in native)
- **UIManager_LayoutTime**: this is the time it takes to calculate layout in yoga
- **UIManager_FabricFinishTransactionTime**: Time it takes transform "C++ mutationInstructions" into "Java MountItems" and cross boundaries from C++ to Java (including serialization of data) (THIS IS ONLY FABRIC)
- **UIManager_DispatchViewUpdates**: time right before RN moves the mount operations to the Queue that is going to be processed in the next tick UI thread
- **UIManager_BatchRunStart**: time right before the mountItems are going to be process in the UI Thread
- **UIManager_BatchedExecutionTime**: time it took to run batched mountItems (usually layout and prop updates on views)
- **UIManager_NonBatchedExecutionTime**: time it took to run non-batched mountItems (usually creation of views)

Reviewed By: fkgozali

Differential Revision: D13838337

fbshipit-source-id: 0a707619829e7d95ce94d9305ff434d1224afc46
2019-02-04 17:27:30 -08:00
Dulmandakh c493cfe708 remove ViewHelper, use ViewCompat instead (#23280)
Summary:
ViewHelper has only setBackground method which works identical to ViewCompat.setBackground from Android Support Library. This PR removes ViewHelper, and uses ViewCompat instead.

[Android] [Changed] - remove ViewHelper, use ViewCompat instead
Pull Request resolved: https://github.com/facebook/react-native/pull/23280

Differential Revision: D13950510

Pulled By: mdvacca

fbshipit-source-id: 10b5122affac17d4b66fb995339c6715c0871ed0
2019-02-04 16:16:39 -08:00
Igor Mandrigin 05ebf77175 Apply the fix for CJK languages on single-line text fields. (#22546)
Summary:
Follow-up to https://github.com/facebook/react-native/pull/19809

This fix generalizes the `setAttributedString:` fix to single-line text fields.

Fixes #19339

_Pull requests that expand test coverage are more likely to get reviewed. Add a test case whenever possible!_
Pull Request resolved: https://github.com/facebook/react-native/pull/22546

Differential Revision: D13948951

Pulled By: shergin

fbshipit-source-id: 67992c02b32f33f6d61fac4554e4f46b973262c1
2019-02-04 15:09:46 -08:00
Kevin Gozali 8ae185280d TM iOS: guard against nullptr in module lookup
Summary: Just tightened up the lookup logic to guard against nullptr.

Reviewed By: RSNara

Differential Revision: D13948001

fbshipit-source-id: 55bf46619712e60e195ea12f2b8eb799f80a3bbe
2019-02-04 14:57:18 -08:00
Ramanpreet Nara aa39cb6d9f Remove assertion on TurboModule existence
Summary:
It's okay for TurboModules to not exist. Therefore, `__turboModuleProvider(moduleName)` should return null if `moduleName` doesn't refer to an actual TurboModule. The current implementation assumes that the TurboModule must exist, and therefore, it crashes the app when it doesn't (assertion error).

This change is important because it helps us land D13887962. When we switch `I18nResources` to `TurboModuleRegistry` in D13887962, on Wilde, it won't be found in `NativeModules`. Therefore, we'll try to lookup this module in `__turboModuleProvider`, and this will crash the app. It seems like `I18nResources` is a Java-only module?

Reviewed By: fkgozali

Differential Revision: D13924589

fbshipit-source-id: 7ac7b1873e06852e5aafcaaef5c24cbc548ee444
2019-02-04 11:36:05 -08:00
Ramanpreet Nara e1451caddd Only call __turboModuleProxy when it exists
Summary: `__turboModuleProxy` doesn't exist if you're not in the TurboModules QE. If such is the case, then we should just return null when `TurboModuleRegistry.get` is called.

Reviewed By: fkgozali

Differential Revision: D13937143

fbshipit-source-id: d3f11c52b7cbecaefba675d714f0d67236071389
2019-02-04 11:08:10 -08:00
David Aurelio 0e1d4ecbb7 Make `==` operator for `YGStyle` free function
Summary:
@public

Makes it work nicely with gtest.

Also allows rhs *and* lhs to offer `operator(YGStyle)()`.

Reviewed By: SidharthGuglani

Differential Revision: D13942573

fbshipit-source-id: ff8b3a9aa6f05ca1b0572eb97d0ad23b09d77871
2019-02-04 10:24:50 -08:00