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

631 Коммитов

Автор SHA1 Сообщение Дата
Emily Janzer 96a5001024 Add spec for DeviceInfo module
Summary: Adding flow types for DeviceInfo module and migrating our codebase over to using `DeviceInfo.getConstants()`

Reviewed By: fkgozali

Differential Revision: D14645744

fbshipit-source-id: e30a060c6dc92938cd1420ba11a1d837c79d1e32
2019-05-29 16:37:15 -07:00
Emily Janzer d83ba5ad51 Revert D15488008: Use JS ViewConfig for View
Differential Revision:
D15488008

Original commit changeset: 48e925ec0ca2

fbshipit-source-id: 4ffa223e636116777c178386b6e966a4f253c30a
2019-05-28 16:37:46 -07:00
Emily Janzer 77a6617a39 Use JS ViewConfig for View
Summary: Rick manually created view config in JS for View; adding some missing attributes/events and using this instead of `requireNativeComponent`

Reviewed By: rickhanlonii

Differential Revision: D15488008

fbshipit-source-id: 48e925ec0ca2aeba9e6cc66edef0b70ee1c94d27
2019-05-28 10:22:43 -07:00
Rick Hanlon ac62274e56 Use generated view config for ActivityIndicatorView
Summary: This diff moves ActivityIndicatorView to the generated view config

Reviewed By: shergin

Differential Revision: D15392561

fbshipit-source-id: 67a2fa0dbbb884af9e9c02b9062d3a610a023240
2019-05-24 09:21:27 -07:00
James Ide a7a7970e54 Replace more Haste imports with path-based imports (#25001)
Summary:
This is another step in moving RN towards standard path-based requires, updating more code to use path-based requires. See the umbrella issue at https://github.com/facebook/react-native/issues/24316 for more detail.

## Changelog

[General] [Changed] - Replace more Haste imports with path-based imports
Pull Request resolved: https://github.com/facebook/react-native/pull/25001

Differential Revision: D15467829

Pulled By: cpojer

fbshipit-source-id: 58c364bb4c1c757689907d5ed0d0f3fac0e22f3f
2019-05-23 00:51:31 -07:00
Wojteg1337 94029eee54 Add spec for HeapCapture (#24899)
Summary:
Part of #24875, adds a spec for HeapCapture

## Changelog

[General] [Added] - TM Spec for HeapCapture
Pull Request resolved: https://github.com/facebook/react-native/pull/24899

Reviewed By: fkgozali

Differential Revision: D15393464

Pulled By: RSNara

fbshipit-source-id: d8778285753ce8dbc87204ecfbddfa7339acd264
2019-05-22 13:10:25 -07:00
Michał Pierzchała 8ea749ad3e Add spec for ExceptionsManager (#24900)
Summary:
Part of #24875, adds a spec for ExceptionsManager

## Changelog

[General] [Added] - TM Add spec for ExceptionsManager
Pull Request resolved: https://github.com/facebook/react-native/pull/24900

Reviewed By: fkgozali

Differential Revision: D15434006

Pulled By: RSNara

fbshipit-source-id: 1a505744a84c0c4ac3a9fac6c91a391fbd8a9f46
2019-05-22 13:10:24 -07:00
Eric Lewis d7a5e3e215 add spec for JSDevSupport (#24905)
Summary:
Part of #24875.

## Changelog

[General] [Added] - add TM spec for JSDevSupport
Pull Request resolved: https://github.com/facebook/react-native/pull/24905

Reviewed By: fkgozali

Differential Revision: D15391754

Pulled By: rickhanlonii

fbshipit-source-id: afca6ce3d6bcfaaf097e13c148496cdd1f062465
2019-05-22 03:27:54 -07:00
Eric Lewis c44d4f9ef6 add spec for RedBox (#24922)
Summary:
part of #24875.

## Changelog

[General] [Added] - add TM spec for RedBox
Pull Request resolved: https://github.com/facebook/react-native/pull/24922

Reviewed By: RSNara

Differential Revision: D15423532

Pulled By: fkgozali

fbshipit-source-id: 3c30e5b32a29628caf0bb9286c0628597ac64fb7
2019-05-20 18:05:55 -07:00
Glenna Buford 35cf427365 Add spec for DevLoadingView (#24930)
Summary:
Part of #24875

## Changelog

[General] [Added] - add TM spec for DevLoadingView
Pull Request resolved: https://github.com/facebook/react-native/pull/24930

Reviewed By: RSNara

Differential Revision: D15423524

Pulled By: fkgozali

fbshipit-source-id: 18ca65abcd4fb3c0ec0434ccba0c0e1d97c17995
2019-05-20 18:05:55 -07:00
Uilque Messias 580088c199 Add spec for NativeDeviceEventManager (#24914)
Summary:
Part of #24875.

## Changelog

[General] [Added] - TM add spec for NativeDeviceEventManager
Pull Request resolved: https://github.com/facebook/react-native/pull/24914

Reviewed By: RSNara

Differential Revision: D15421462

Pulled By: fkgozali

fbshipit-source-id: 78b90c615cd031ecd010a552751e506406ab739a
2019-05-20 18:05:54 -07:00
Rick Hanlon 531f11f084 Fix flow and formatting
Summary: Fixes a flow failure in the generated output and adds trailing commas to pass linting

Reviewed By: yungsters

Differential Revision: D15354725

fbshipit-source-id: 1eac27fa753af595a9a2787426b147e5f49a4e1d
2019-05-20 02:52:37 -07:00
Rick Hanlon 382846aefd Add viewconfig verification
Summary: This diff adds a line to the codegen'd view configs which will check that all of the properties in the native view config are also in the JS view config we generate (note that the JS view config may have more properties than one native platform because it includes a union of both platforms)

Reviewed By: TheSavior

Differential Revision: D15278478

fbshipit-source-id: 0fef20c12265b952c69aca4e4c070a7d036db05a
2019-05-16 10:51:06 -07:00
James Ide 0ee5f68929 Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749)
Summary:
This is the next step in moving RN towards standard path-based requires. All the requires in `Libraries` have been rewritten to use relative requires with a few exceptions, namely, `vendor` and `Renderer/oss` since those need to be changed upstream. This commit uses relative requires instead of `react-native/...` so that if Facebook were to stop syncing out certain folders and therefore remove code from the react-native package, internal code at Facebook would not need to change.

See the umbrella issue at https://github.com/facebook/react-native/issues/24316 for more detail.

[General] [Changed] - Migrate "Libraries" from Haste to standard path-based requires
Pull Request resolved: https://github.com/facebook/react-native/pull/24749

Differential Revision: D15258017

Pulled By: cpojer

fbshipit-source-id: a1f480ea36c05c659b6f37c8f02f6f9216d5a323
2019-05-08 08:48:59 -07:00
Christopher Hogan fedfabcecb facebook 59.0 merge- with conflicts 2019-04-22 10:37:26 -07:00
REDMOND\acoates 7f3192cf9d put RN58 back 2019-03-28 13:44:57 -07:00
REDMOND\acoates b988169e72 Squashed commit of the following:
commit 4c43e301d97042e9eec4401dd81b8ebce053f691
Author: REDMOND\acoates <acoates@microsoft.com>
Date:   Tue Mar 26 10:49:02 2019 -0700

    Squashed commit of the following:

    commit 862f3fb5d9e3161feab6e5e0e61c7b28e8ac1ef9
    Author: REDMOND\acoates <acoates@microsoft.com>
    Date:   Tue Mar 26 10:46:37 2019 -0700

        Revert "Merge 1b12e2caaa into 9f1e90947421ad0ea2de1b534117c500dc8c9744"

        This reverts commit d036bc4c57, reversing
        changes made to 9f1e909474.

    commit 41477c33c1bcc78f40da00ac7e86ab4dd3f7d062
    Author: REDMOND\acoates <acoates@microsoft.com>
    Date:   Tue Mar 26 10:46:23 2019 -0700

        Revert "Applying package update to 0.58.6-microsoft.1"

        This reverts commit 852df1af0e.

    commit 4993963205e737849e4880309ef86aeac9f2a765
    Author: REDMOND\acoates <acoates@microsoft.com>
    Date:   Tue Mar 26 10:46:16 2019 -0700

        Revert "Applying package update to 0.58.6-microsoft.2"

        This reverts commit 774513fec9.

    commit 41f8beadb2030593208ffc6ff29339991dde3798
    Author: REDMOND\acoates <acoates@microsoft.com>
    Date:   Tue Mar 26 10:46:07 2019 -0700

        Revert "Merge 4f3c37886c into 774513fec948ee5595543e23ab4e7b9cccbdcbf1"

        This reverts commit a840490784, reversing
        changes made to 774513fec9.

    commit 143e70ec6228e110cd94a5ae9c56309040c1f1eb
    Author: REDMOND\acoates <acoates@microsoft.com>
    Date:   Tue Mar 26 10:45:57 2019 -0700

        Revert "Applying package update to 0.58.6-microsoft.3"

        This reverts commit 54dfee820d.

commit 138191b0d6bf9e4370fb5126dc2095a3fb122a57
Author: REDMOND\acoates <acoates@microsoft.com>
Date:   Tue Mar 26 10:45:16 2019 -0700

    Revert "Merge d8be239fac into 54dfee820d107cb897c5aca14131cf7fbde616d7"

    This reverts commit faae1e56f8, reversing
    changes made to 54dfee820d.

commit 40a77c8365c5273df0bba4fc2b0439db17d247d0
Author: REDMOND\acoates <acoates@microsoft.com>
Date:   Tue Mar 26 10:34:44 2019 -0700

    Revert "Applying package update to 0.58.6-microsoft.4"

    This reverts commit 043f6330e7.

commit adf5c26c8f7132a6643ecfea116226632173447b
Author: REDMOND\acoates <acoates@microsoft.com>
Date:   Tue Mar 26 10:34:42 2019 -0700

    Revert "Applying package update to 0.58.6-microsoft.5"

    This reverts commit 4004f889c2.

commit e68d497a58e32d26f0d04130895954d7b654c2bf
Author: REDMOND\acoates <acoates@microsoft.com>
Date:   Tue Mar 26 10:34:39 2019 -0700

    Revert "Fix the builds... (#20)"

    This reverts commit 745eeda26f.

commit 4cdef1eef22edbcdc9ca86e31846a175b944999e
Author: REDMOND\acoates <acoates@microsoft.com>
Date:   Tue Mar 26 10:34:31 2019 -0700

    Revert "Applying package update to 0.58.6-microsoft.6"

    This reverts commit 34a3077388.
2019-03-26 10:54:53 -07:00
Andrew Coates (REDMOND) 1b12e2caaa merge master 2019-03-23 16:38:05 -07:00
Alexey Lang c3475419a9 Add removeExtra()
Reviewed By: bestander

Differential Revision: D14386282

fbshipit-source-id: 045dd0f12cc462da694d20da52f3a591b538dc57
2019-03-19 10:24:52 -07:00
Alexey Lang abe737fe74 Proxy statics for the wrapped component
Summary: Currently we can't access navigationOptions  from measureAppRequire and that breaks fetchRelayQuery logs.

Reviewed By: fkgozali

Differential Revision: D14505525

fbshipit-source-id: 97ae4461ebb0e703633f782323b13b4e4f7c5cb7
2019-03-19 07:32:20 -07:00
Casper Boone f541c34067 Add tests for utilities (#23989)
Summary:
This PR add tests for several utilities in `Libraries/Utilities`, as a follow-up of #23903.

The following utilities are now tested:
* `clamp.js`
* `binareToBase64.js`
* `DeviceInfo.js`
* `mergeIntoFast.js`
* `PixelRatio.js`
* `infoLog.js`
* `logError.js`
* `warnOnce.js`
* `mapWithSeparator` (added a missing test)

Not applicable, since it only adds tests.
Pull Request resolved: https://github.com/facebook/react-native/pull/23989

Differential Revision: D14502806

Pulled By: cpojer

fbshipit-source-id: e2c3b3a35f4f765d5336b998ab92dba14eeac7bc
2019-03-18 07:40:55 -07:00
Alexey Lang 022dc8ef38 Implement withPerformanceLoggerContext
Summary:
This function returns a HOC that passes `scopedPerformanceLogger` as a prop to the wrapped component. That HOC
can be used whenever we can't declare `static contextType` as `PerformanceLoggerContext` on a component,
for example because React supports only one React Context per component.

Reviewed By: sahrens

Differential Revision: D14385560

fbshipit-source-id: 41971b4bf499f336c34b9220a3ee97c4ed89498d
2019-03-15 07:38:00 -07:00
Georgios Andreadis 47e061549f Add tests for utility functions of library (#23903)
Summary:
I was looking at the coverage report of the JavaScript code in the `Libraries` folder, and found some of the modules and functions to be (partially) untested. I believe that adding tests to them would formally capture their behaviour and avoid future regressions. In this PR, I've added some unit tests for 3 utility components.

Perhaps a more general question: Are these kinds of PRs appreciated? I'd be interested in submitting more of them in the future.

Not applicable, since it only adds tests.
Pull Request resolved: https://github.com/facebook/react-native/pull/23903

Differential Revision: D14477601

Pulled By: cpojer

fbshipit-source-id: c0700c5b514cd0df983fecfd91c93fc2bd049f5d
2019-03-15 04:46:48 -07:00
Tom Underhill 0d619f87ea Fix Flow and ESLint errors. (#14)
* Fix Flow and ESLint errors.

* Fixed some warnings in code that is in the MS fork only.
2019-03-14 12:59:12 -07:00
Peter van der Zee dcd4e90d9a Bump Prettier to 1.16.4
Summary:
@public
This bumps Prettier to v1.16.4
Only format source files were updated.

Reviewed By: mjesun

Differential Revision: D14454893

fbshipit-source-id: 72f9872fe764a79dbf0d9fab9bebb1456b039f2f
2019-03-14 07:00:27 -07:00
Alexey Lang 03841cf08c Migrate PerformanceLoggerFlag to scoped performance logger
Reviewed By: xyin96

Differential Revision: D14385136

fbshipit-source-id: beaf060866ed5b7dee80e18fcd432e7701cff5d3
2019-03-14 06:49:47 -07:00
Alexey Lang 40143519a1 Use GlobalPerformanceLogger explicitly during bundle load
Reviewed By: sahrens

Differential Revision: D14377700

fbshipit-source-id: 66bc120701ffb7fb15030e5dcb5c6200e7c04434
2019-03-14 06:49:46 -07:00
Christopher Hogan 27381d39db facebook 0.58.6 merge with conflicts (although some iOS files had conflicts removed) 2019-03-11 13:49:58 -07:00
Evan Bacon 05d5eeb818 Removed `Platform.web` (#23830)
Summary:
Initially if a `react-native-web` project were to use a library that required internals `expo/webpack-config` would polyfill those internals. This `Platform.web` was used for cases where `react-native` modules needed other internal `react-native` modules, ex: `Animated/src/AnimatedEvent -> Renderer/shims/ReactNative -> Renderer/oss/ReactNativeRenderer-dev -> Core/InitializeCore -> Devtools/setupDevtools -> WebSocket/WebSocket -> Utilities/Platform`

The consensus is that if any `react-native` library references a `react-native` internal (ex: `react-native/*`), it should continue to throw errors. We've removed the use of internals from all of the Unimodules, `react-navigation`, and `react-native-gesture-handler`. This covers a wide enough area for a lot of projects to get web support.

* Add emitters for libs referencing internals necolas/react-native-web#1275
* Remove monkey patch that bundles RN, libs that use internals will crash instead expo/expo-cli#409
* Remove all unsupported internals and polyfills from the Expo suite expo/expo#3676
* Remove internals from react-native-gesture-handler kmagiera/react-native-gesture-handler#406

* Related #23387

[GENERAL] [REMOVED] - Platform.web.js
Pull Request resolved: https://github.com/facebook/react-native/pull/23830

Differential Revision: D14406145

Pulled By: hramos

fbshipit-source-id: bdda99a334d33f5543fdb954eb80e2e7186f985a
2019-03-11 11:38:22 -07:00
Alexander Zhang efd28bdc84 Revert D14186694: [RN] Use global or scoped performance loggers everywhere
Differential Revision:
D14186694

Original commit changeset: 062c76eea8fc

fbshipit-source-id: 6d99b94d21da6df4375e342fdecceeebf05959d5
2019-03-07 13:12:12 -08:00
George Zahariev 35d2dfcabf Deploy 0.94 to xplat
Summary:
Update Flow version in xplat (https://our.intern.facebook.com/intern/wiki/Flow/Flow_Release_Process/#update-xplat-js)

allow-large-files
bypass-lint

Reviewed By: nmote

Differential Revision: D14317820

fbshipit-source-id: 07ec22c0745321db036f4e10a502009a4b640652
2019-03-06 14:57:30 -08:00
Alexey Lang a9b3ca7fa7 Use global or scoped performance loggers everywhere
Summary:
I'm changing all callsites to use either global or scoped perf logger explicitly in one diff.
`GlobalPerformanceLogger` is basically a singleton
`scopedPerformanceLogger` is scoped to the React tree by using a React Context

Reviewed By: sahrens

Differential Revision: D14186694

fbshipit-source-id: 062c76eea8fce9d9b531f0eddf153bb79d52f68d
2019-03-06 09:51:56 -08:00
REDMOND\acoates 5c0c3d4084 Initial commit of internal changes. 2019-03-01 10:09:07 -08:00
Alexey Lang 60640485e1 Introduce PerformanceLoggerContext and use it with renderApplication
Reviewed By: sahrens

Differential Revision: D14167646

fbshipit-source-id: 3f8dd27ba1c8866471e2af493c4cc0bc84706042
2019-02-28 03:39:40 -08:00
Alexey Lang 1aabbf5dce Allow to create local performance loggers
Reviewed By: bestander

Differential Revision: D14159631

fbshipit-source-id: 62830f67060e575841cbc864dde30c7bee7e7c4c
2019-02-28 03:39:40 -08:00
Evan Bacon 104b1f9367 Add HMRLoadingView module for web target (#23389)
Summary:
* Added a default value for HMRLoadingView this will prevent errors from being thrown when `HMRClient` attempts to include it in a `web` context.

* [Web] [Added] - HMRLoadingView
Pull Request resolved: https://github.com/facebook/react-native/pull/23389

Differential Revision: D14045475

Pulled By: cpojer

fbshipit-source-id: df5c3cf3536af3b37eaf82342b6346bc25054319
2019-02-20 18:22:44 -08:00
Evan Bacon daa79b0f97 Add Platform module for web target (#23387)
Summary:
Added a Platform file for module for instances where internal modules need Platform.
ex: 78be6efda9/Libraries/Utilities/Dimensions.js (L14)

* Added `Libraries/Utilities/Platform.web.js`
[CATEGORY] [TYPE] - Message
Pull Request resolved: https://github.com/facebook/react-native/pull/23387

Differential Revision: D14041834

Pulled By: cpojer

fbshipit-source-id: 9be7ad647d6a644956efa622b936fcecee7c1a1f
2019-02-12 03:32:29 -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
Mike Grabowski 9d19ab0c0c Bring missing changes to 0.58-stable branch
This reverts commit b864e7e63e.
2019-01-28 14:56:57 +01:00
Brian Shin 5c0b9071e7 Remove PlatformOS from RN
Summary: The existence of this file was confusing many in open source (5ee27ff755) and is no longer needed internally. Delete this file to remove the fork.

Reviewed By: fkgozali

Differential Revision: D13625760

fbshipit-source-id: 1be1943471b67e914377c24d445568532e378385
2019-01-10 12:52:02 -08:00
glevi@fb.com 24f8d4d3db Deploy v0.89
Reviewed By: jbrown215

Differential Revision: D13457087

fbshipit-source-id: 9f01371ae3515990c5595f1eb2361174050066b8
2018-12-14 13:57:50 -08:00
Christoph Nakazawa deb2a94568 Add Flow types for `Platform.select` [5/5]
Summary: This change adds type information for `Platform.select` to make sure things are properly typed. This is the last diff in a stack that actually enables the newly fixed/added annotations and it will only land once all the type errors (320+) are fixed.

Reviewed By: sahrens

Differential Revision: D13318805

fbshipit-source-id: af0475d1a2f1e5ace4d513be48827e3659bd7f62
2018-12-06 02:54:19 -08:00
Christoph Nakazawa 4148976a83 Use `invariant` instead of `fbjs/lib/invariant`
Summary: This is one more step to remove `fbjs` from `react-native-github`. This changes both the internal and external code to use `invariant` from zertosh instead of the copy in fbjs.

Reviewed By: yungsters

Differential Revision: D13195941

fbshipit-source-id: 73564ca1715110e7da9c7ef56dc57374d61377e0
2018-12-03 00:07:02 -08:00
Panagiotis Vekris ef2084c6bd 0.87.0 in xplat/js
Summary: allow-large-files

Reviewed By: samwgoldman

Differential Revision: D13230018

fbshipit-source-id: f07e2371a3b7382de0592cc7c7b20e7f4faa6889
2018-11-28 17:32:50 -08:00
Rubén Norte 2ae559a2a4 eslint: Disable jasmine env and only enable jest env for test files
Summary:
Modified the ESLint configuration to only enable the Jest environment for files we consider now tests, which are files with the `-test.js` suffix under `__tests__`. Also enabled some globals for test helpers (any file under `__tests__`).

This will allow us to catch misspelled tests, while allowing test helpers to use most Jest APIs.

Also disabled the Jasmine environment so people stop using Jasmine APIs and we can rollout Circus soon.

Reviewed By: aaronabramov

Differential Revision: D13199591

fbshipit-source-id: 12a32cf5835630b9987452b0c33d3f8085001689
2018-11-27 03:51:02 -08:00
Mike Grabowski b864e7e63e Revert "Merge branch 'master' into 0.58-stable"
This reverts commit 696bd89013, reversing
changes made to a525941ab6.
2018-11-22 17:53:44 +01:00
Spencer Ahrens 6f34bc4016 Back out "reapply TextInput es6 conversion with fixes, attemps to fix"
Summary:
Back it out again. This time really not sure why this is breaking, but it seems to be production only. The error seems to be "RCTSinglelineTextInputView" was not found in the UIManager" but the relavent logic is not changed in this diff, just moved around, so unclear why it would trigger a failure.

Reverting to be safe. When we re-apply the diff, we'll need to test a full OTA to prod to verify the fix.

Reviewed By: blairvanderhoof

Differential Revision: D13108463

fbshipit-source-id: 5f877a0c1a08dc114ce45921d6d92bf619575977
2018-11-16 14:50:23 -08:00
Spencer Ahrens 9ea1295179 reapply TextInput es6 conversion with fixes, attemps to fix
Summary: D10515754 reapplied by backing out D12989604 and then fixed by manually forwarding the instance methods to the host function instead of using `forwardRef`. This also removes the need for the $flowFixMe.

Reviewed By: TheSavior

Differential Revision: D13048482

fbshipit-source-id: ff2447aff123e0960eddaef645f7dc976a426e14
2018-11-15 20:51:52 -08:00
Spencer Ahrens a00940693e New TextInput-test that would have prevented S168585
Summary: Adds a basic test that would have prevented S168585. We should expand coverage of this and other components as well.

Reviewed By: TheSavior

Differential Revision: D13038064

fbshipit-source-id: 14cf4742efd53d7bca2a3f8d1c5c34ebc6227674
2018-11-15 20:51:52 -08:00
Kevin Gozali 339d9d3afb Guard Platform.isTesting under __DEV__
Summary: Testing is a __DEV__ time only, so let's optimize for prod bundles.

Reviewed By: ejanzer

Differential Revision: D13050583

fbshipit-source-id: a96e35e4d5f3bd09c235c11d4ece3e4d07882de7
2018-11-13 20:11:48 -08:00
Alexandre Kirszenberg c787866d64 Clearer HMR error messages
Summary:
GraphNotFoundError: When the user moves the app to the background on Android, restarts the Metro server and reopens the app, since the client hasn't requested either a delta or a bundle, the graph cache of the server is empty and thus we can't compute an update for the client (what if changes happened when the metro server was down?).

RevisionNotFoundError: I didn't manage to reproduce that one. It could happen if two clients live side-by-side, requesting the exact same bundle. In the future, if we want to handle that case, we'll need to manage a list of clients listening to a single graph so that we don't try to update the same graph multiple times for a single file change.

Disconnection: Same as GraphNotFoundError, but happens when the user moves the app to the background on iOS.

Reviewed By: mjesun

Differential Revision: D12960939

fbshipit-source-id: 5ac1dc7fd12bad5e0ee8dfa5a21c112773454ee5
2018-11-12 08:49:22 -08:00
Naman Goel 7dd2b0b5ea Types for BackHandler
Summary: Improve types for BackHandler

Reviewed By: benjaffe

Differential Revision: D9838175

fbshipit-source-id: 839a5a695b468974aadb7bc0da1a23ef844fdd7f
2018-11-06 12:37:31 -08:00
nabettu 0a39cda39a Remove var in Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js (#22126)
Summary:
Replaces the keywords var with let or const in Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js

- [x] Check npm run flow
- [x] Check npm run flow-check-ios
- [x] Check npm run flow-check-android

[GENERAL] [ENHANCEMENT] [Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js] - remove var
Pull Request resolved: https://github.com/facebook/react-native/pull/22126

Differential Revision: D12929758

Pulled By: TheSavior

fbshipit-source-id: bee9dfb463d197458cb218f39274af5a4d16ce1f
2018-11-05 16:15:54 -08:00
flowkraD f9050e0908 Flow strict DrawerLayout (#22152)
Summary:
Issue in focus: #22100

The only occurrence of `Object` was replaced with the appropriate flow type
A Lint error was encountered in `deepFreezeAndThrowOnMutationInDev-test.js` when running `npm run lint` and was fixed by running `yarn prettier`
Pull Request resolved: https://github.com/facebook/react-native/pull/22152

Differential Revision: D12930872

Pulled By: RSNara

fbshipit-source-id: f9706ed2e49d9ccedfa331594c886d2d3b615db5
2018-11-05 15:05:25 -08:00
mottox2 b01bf06dba Remove var in Libraries/Utilities/buildStyleInterpolator.js (#22112)
Summary:
Replaces the keywords var with const in Libraries/Utilities/buildStyleInterpolator.js
Pull Request resolved: https://github.com/facebook/react-native/pull/22112

Differential Revision: D12919286

Pulled By: TheSavior

fbshipit-source-id: bc39a1efc2c372365d95cd305cc6d915f030b209
2018-11-04 11:03:09 -08:00
ggtmtmgg 368518eff1 Remove var in Libraries/Utilities/MatrixMath.js (#22111)
Summary:
Replaces the keywords var with let in Libraries/Utilities/MatrixMath.js

- [x] Check npm run flow
- [x] Check npm run flow-check-ios
- [x] Check npm run flow-check-android

[GENERAL] [ENHANCEMENT] [Libraries/Utilities/MatrixMath.js] - remove `var`
Pull Request resolved: https://github.com/facebook/react-native/pull/22111

Differential Revision: D12919285

Pulled By: TheSavior

fbshipit-source-id: dca65d2da311b5c50ab6ce7338af1cc941fb7a33
2018-11-04 10:59:41 -08:00
watanabeyu e835c6dc50 Replace var to const in Libraries/Utilities/deepFreezeAndThrowOnMutationInDev-test.js (#22110)
Summary:
Replaces the keywords var to const in Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js

- [x]  Check npm run flow
- [x]  Check npm run flow-check-ios
- [x]  Check npm run flow-check-android

[GENERAL] [ENHANCEMENT] [Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js] - replace var
Pull Request resolved: https://github.com/facebook/react-native/pull/22110

Differential Revision: D12919284

Pulled By: TheSavior

fbshipit-source-id: 4a3a3f4c49665c538ed5f38f3cc2142d40ac4d55
2018-11-04 10:52:09 -08:00
Ignacio Olaciregui ae8ec39397 Fix linting issues (#22062)
Summary:
Fixes lots of ESLint warnings. Many of them where in PR #20877 by janicduplessis which requested to split the linting fixes from configuration and package changes.

I solved only the issues that I was most certain about but I would love to get hands on all of them with a little bit of input.
Pull Request resolved: https://github.com/facebook/react-native/pull/22062

Differential Revision: D12889447

Pulled By: TheSavior

fbshipit-source-id: 35f7a08104a5b859c860afdde4af2b32c0685c50
2018-11-01 14:29:16 -07:00
Avik Chaudhuri 11552a7a7a @allow-large-files flow 0.84 xplat deploy
Reviewed By: samwgoldman

Differential Revision: D10851695

fbshipit-source-id: 951c628844bbbc7331d4e75f62485db88e5ba7c4
2018-10-25 18:16:30 -07:00
Ryan Dy 774cd73663 Remove BackAndroid, which has had a deprecation warning (#21866)
Summary:
Remove BackAndroid, which has had a deprecation warning and only forwarded to BackHandler since March 2018.

Test Plan
---------
React-native init bundle and RNTester bundle works.

Release Notes:
--------------
[ ANDROID  ] [ BREAKING ] [ BackAndroid ] - Deprecate BackAndroid since BackHandler should be used in its place.
Pull Request resolved: https://github.com/facebook/react-native/pull/21866

Differential Revision: D10472419

Pulled By: TheSavior

fbshipit-source-id: 3d76e1ce4c74bb783fee7fd8232bb366f2e7ea12
2018-10-19 16:02:48 -07:00
empyrical d6c8f189e7 Introduce 'setAndForwardRef' helper function (#21823)
Summary:
This PR introduces a new helper function called `setAndForwardRef`. It is intended to help with moving components that depend on `NativeMethodsMixin` off of `createReactClass`.

It allows for classes that depend on having a ref to a native component to be able to also forward the native component ref to user code.

Usage is like this:

```js
class MyView extends React.Component {
  _nativeRef = null;
  _setNativeRef = setAndForwardRef({
    getForwardedRef: () => this.props.forwardedRef,
    setLocalRef: ref => {
      this._nativeRef = ref;
    },
  });
  render() {
    return <View ref={this._setNativeRef} />;
  }
}
const MyViewWithRef = React.forwardRef((props, ref) => (
  <MyView {...props} forwardedRef={ref} />
));
module.exports = MyViewWithRef;
```
Pull Request resolved: https://github.com/facebook/react-native/pull/21823

Differential Revision: D10436673

Pulled By: TheSavior

fbshipit-source-id: 32e167bb3ea3234f08d5715168b0e61e4e035a7c
2018-10-17 22:00:21 -07:00
Ramanpreet Nara 62e0d508d6 Move createStrictShapeTypeChecker to deprecated
Summary:
Related to #21342

Move createStrictShapeTypeChecker to DeprecatedCreateStrictShapeTypeChecker.

Reviewed By: hramos

Differential Revision: D10341526

fbshipit-source-id: 30e7f22ae574af620ead9c1a0766f00611b282b6
2018-10-12 15:17:02 -07:00
Emily Janzer d279b7c74d Add point at beginning of InitializeCore
Summary: Also add an optional timestamp param to PerformanceLogger.markPoint() so you can backdate a point

Reviewed By: alexeylang

Differential Revision: D10149337

fbshipit-source-id: 6cc5f95b34b3293589e7cb41b99cee17bf128163
2018-10-05 18:33:59 -07:00
Andrew Chen (Eng) aac7c4d5d2 Refactor UIManager view manager accesses
Summary: Replaced each view manager access with a getViewManager() function call. This will later be used to lazily load view manager classes by allowing java to avoid sending the entire list of view managers to JS.

Reviewed By: QueryConnectionException

Differential Revision: D9695788

fbshipit-source-id: 949858aa2f0b0b00b68e260461ba8f1d085cf07f
2018-09-27 16:03:22 -07:00
Timothy Kukulski 471e8c168a Add @flow to BackHandler
Summary:
Add flow to BackHandler
Fixed callsites

Reviewed By: TheSavior

Differential Revision: D8994015

fbshipit-source-id: 2b910f14b4462020a37a33a8bcff67cef07500a3
2018-09-27 15:47:42 -07:00
Alexey Lang 77e6c5e7cf Support logging points from JS
Summary: We want to be able to log individual points from JS.

Reviewed By: ejanzer

Differential Revision: D10050400

fbshipit-source-id: eadd81a8cf70082998950c19a98c3de979eb148a
2018-09-27 12:27:17 -07:00
Emily Janzer ab97b9f602 Fix dev-only redbox in polyfillfunctions
Summary: Fixes a redbox about setting both the accessor and the value for an object. It looks like it's actually coming from PolyfillFunctions, where we set the value as well as spreading in the object descriptor for modules in DEV.

Reviewed By: yungsters

Differential Revision: D9792991

fbshipit-source-id: a2fa5d1820c5eddfd8244722771e76de62f89976
2018-09-12 16:32:50 -07:00
Eli White 7b57b8c222
Remove view configs from JS
Summary: Apparently different apps have different implementations of view managers that support different props. This is a problem that we will need to address. Unfortunately, this means we can't have a static config defined in JS. We will need to find another approach to this problem.

Reviewed By: sahrens

Differential Revision: D9500178

fbshipit-source-id: b591559164fcf29f5fd43e13a0f2da15011491c6
2018-09-11 16:11:16 -07:00
Eli White 967d47830b
Require that JS defined Component Attributes match Native ones in dev
Summary: As we move these configs to JS from native, until we have codegen that ensures everything stays up to date, this adds a dev mode check to ensure they are consistent.

Reviewed By: yungsters

Differential Revision: D9475011

fbshipit-source-id: 9d6f7b6c649229cae569d840eda3d5f7b7aa7cb2
2018-09-11 16:09:59 -07:00
Héctor Ramos 1151c096da Update copyright headers to yearless format
Summary: This change drops the year from the copyright headers and the LICENSE file.

Reviewed By: yungsters

Differential Revision: D9727774

fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
2018-09-11 15:33:07 -07:00
Mehdi Mulani adaeba296e Fix buildStyleInterpolator
Summary: This relied on NaN being turned into null (through JSON.stringify), which would then be handled by Yoga gracefully. But in some cases we do not call JSON.stringify and thus pass NaN directly to Yoga causing a problem.

Reviewed By: fkgozali

Differential Revision: D9764488

fbshipit-source-id: 021c9ffafba8f9bcef2476756a12df33c367bcb1
2018-09-11 11:31:53 -07:00
Christoph Jerolimov c3e42b5531 Fix that BackHandler was not called on Android (#19077)
Summary:
This fixes issues #18954 and #15497

The transformation from Set to (an reversed) Array does not work on Android devices when the remote debugging was started with `react-native run-android`.

<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

Add the following code to your App.js and run the app with `react-native run-android` in an Android device:

```
  componentDidMount() {
    BackHandler.addEventListener('hardwareBackPress', () => {
      console.warn('Callback called. Do not close app. Do nothing at all.');
      return true; // Do not close the app.
    });
  }
```

After adding this, the app should NOT close when you press the back button. Without this fix, the app closes (which is the default behaviour).

See also the comments from Victoriayangx in #18954 and #15497.

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->

[ANDROID] [BUGFIX] [BackHandler] - Fix that BackHandler was not called on Android

<!--
  **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

    CATEGORY
  [----------]      TYPE
  [ CLI      ] [-------------]    LOCATION
  [ DOCS     ] [ BREAKING    ] [-------------]
  [ GENERAL  ] [ BUGFIX      ] [ {Component} ]
  [ INTERNAL ] [ ENHANCEMENT ] [ {Filename}  ]
  [ IOS      ] [ FEATURE     ] [ {Directory} ]   |-----------|
  [ ANDROID  ] [ MINOR       ] [ {Framework} ] - | {Message} |
  [----------] [-------------] [-------------]   |-----------|

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
Pull Request resolved: https://github.com/facebook/react-native/pull/19077

Reviewed By: yns88

Differential Revision: D9692298

Pulled By: hramos

fbshipit-source-id: 4526b07a4924055ebc9c42e02615c27aa5c97fbb
2018-09-07 10:26:20 -07:00
Eli White d2c27f5bff Remove view configs from JS
Summary: Apparently different apps have different implementations of view managers that support different props. This is a problem that we will need to address. Unfortunately, this means we can't have a static config defined in JS. We will need to find another approach to this problem.

Reviewed By: sahrens

Differential Revision: D9500178

fbshipit-source-id: b591559164fcf29f5fd43e13a0f2da15011491c6
2018-08-24 14:04:09 -07:00
Eli White 035597566f Explain why and how to keep JS<->Naitve view configs in sync
Reviewed By: sahrens

Differential Revision: D9485764

fbshipit-source-id: 673748b0ded666b8d17ed221e1208cffefb6c859
2018-08-24 14:04:09 -07:00
Eli White 1329d18c6a Require that JS defined Component Attributes match Native ones in dev
Summary: As we move these configs to JS from native, until we have codegen that ensures everything stays up to date, this adds a dev mode check to ensure they are consistent.

Reviewed By: yungsters

Differential Revision: D9475011

fbshipit-source-id: 9d6f7b6c649229cae569d840eda3d5f7b7aa7cb2
2018-08-23 13:01:41 -07:00
janczer 24c0dc3013 Add to PixelRation documentation information about iPhone SE and iPho… (#20695)
Summary:
Release Notes:
--------------

[DOCS] [BUGFIX][PixelRatio.js] - Add information about iPhone SE and iPhone X
Pull Request resolved: https://github.com/facebook/react-native/pull/20695

Differential Revision: D9408433

Pulled By: hramos

fbshipit-source-id: 917390e30801ce353fd999b375c788bd38568a05
2018-08-20 14:48:40 -07:00
Wayne Cheng 43ded753b1 Adding flow strict local to remaining possible files in xplat/JS
Summary:
ag -L --ignore __snapshots__ 'flow strict|noflow|generated|The controller you requested could not be found.' | ag '\.js$' | xargs ag -l 'flow' | sort > ~/temp
  cat ~/temp | xargs ag -L 'flow strict' | xargs sed -i '' 's/flow$/flow strict-local/'
  until flow check; do flow check --json | jq -r '.errors[].message[0].path' | sort | uniq | xargs hg revert; done

allow_many_files
The controller you requested could not be found.
The controller you requested could not be found.

Reviewed By: TheSavior

Differential Revision: D9004573

fbshipit-source-id: 936bd5741706b781be06bf08b6ad805a69407dfd
2018-08-13 21:38:57 +01:00
Jordan Brown 2c0d7b461e Replace '@flow strict(-local)' with '@flow' in .android.js files
Summary:
Flow doesn't check .android.js files yet anyway.

I'm going to be adding suppressions in a followup diff. It would be nice to not have >1k suppressions saying that we can't do certain things in `flow strict` when we don't even typecheck with regular `flow` just yet

I ran these commands to produce this diff:
`find . -name '*.android.js' -exec sed -i 's/flow strict-local/flow/g' {} +`
`find . -name '*.android.js' -exec sed -i 's/flow strict/flow/g' {} +`

Followed https://unix.stackexchange.com/questions/112023/how-can-i-replace-a-string-in-a-files to do it.

The controller you requested could not be found.

Reviewed By: TheSavior

Differential Revision: D9143783

fbshipit-source-id: e9af4fe695ebdba4db4083de1697cc248d48eb0d
2018-08-13 21:38:57 +01:00
Wayne Cheng f536a0c268 Adding flow strict local to remaining possible files in xplat/JS
Summary:
ag -L --ignore __snapshots__ 'flow strict|noflow|generated|The controller you requested could not be found.' | ag '\.js$' | xargs ag -l 'flow' | sort > ~/temp
  cat ~/temp | xargs ag -L 'flow strict' | xargs sed -i '' 's/flow$/flow strict-local/'
  until flow check; do flow check --json | jq -r '.errors[].message[0].path' | sort | uniq | xargs hg revert; done

allow_many_files
The controller you requested could not be found.
The controller you requested could not be found.

Reviewed By: TheSavior

Differential Revision: D9004573

fbshipit-source-id: 936bd5741706b781be06bf08b6ad805a69407dfd
2018-08-09 08:54:44 -07:00
Jordan Brown b64b9dbece Replace '@flow strict(-local)' with '@flow' in .android.js files
Summary:
Flow doesn't check .android.js files yet anyway.

I'm going to be adding suppressions in a followup diff. It would be nice to not have >1k suppressions saying that we can't do certain things in `flow strict` when we don't even typecheck with regular `flow` just yet

I ran these commands to produce this diff:
`find . -name '*.android.js' -exec sed -i 's/flow strict-local/flow/g' {} +`
`find . -name '*.android.js' -exec sed -i 's/flow strict/flow/g' {} +`

Followed https://unix.stackexchange.com/questions/112023/how-can-i-replace-a-string-in-a-files to do it.

The controller you requested could not be found.

Reviewed By: TheSavior

Differential Revision: D9143783

fbshipit-source-id: e9af4fe695ebdba4db4083de1697cc248d48eb0d
2018-08-08 10:48:19 -07:00
Trish Saylor f17047e230 Add flow strict-local annotation to the dismissKeyboard module
Summary: The `dismissKeyboard` module is widely used but did not have flow typing on it, preventing other js modules that use it from annotating themselves as flow strict-local. This diff adds a flow annotation to the `dismissKeyboard` module of the strictest type supported for this module, which is flow strict-local.

Reviewed By: gkz

Differential Revision: D9143671

fbshipit-source-id: af2367e6c59276402dcbcb9cf0f64b44ff42f531
2018-08-03 11:47:19 -07:00
Wayne Cheng 86f8e9e760 Adding flow strict to as many xplat files as possible
Summary:
ag -L --ignore __snapshots__ 'flow strict$|noflow|generated|The controller you requested could not be found.' | ag '\.js$' | xargs ag -l 'flow' | sort > ~/temp
  cat ~/temp | xargs ag -L 'flow strict' | xargs sed -i '' 's/flow$/flow strict/'
  cat ~/temp | xargs ag -L 'flow strict$' | xargs sed -i '' 's/flow strict-local$/flow strict/'
  until flow; do flow check --json | jq -r '.errors[].message[0].path' | sort | uniq | xargs hg revert; done

allow_many_files
The controller you requested could not be found.
The controller you requested could not be found.

Reviewed By: yungsters

Differential Revision: D9003523

fbshipit-source-id: d0c9fbfe3c32e65d57819fa040d06cd6ebbd59cc
2018-07-27 12:31:42 -07:00
Gabe Levi eac34e3021 Flow v0.76.0
Summary: No new errors in this version. Just removed a bunch of unused suppressions

Reviewed By: TheSavior

Differential Revision: D8754160

fbshipit-source-id: 2f02240b6d65edecba5d9ed603c7703462547a7f
2018-07-09 08:17:51 -07:00
Eli White eea4842972 Flow strictify possible files in RN core
Summary:
This was done by running the command on: https://our.intern.facebook.com/intern/wiki/Flow_Strict/

```
ag -L --ignore __snapshots__ 'flow strict$|noflow|generated|partially-generated' | ag '\.js$' | xargs ag -l 'flow' | sort > ~/temp
cat ~/temp | xargs ag -L 'flow strict' | xargs sed -i 's/flow$/flow strict/'
cat ~/temp | xargs ag -L 'flow strict$' | xargs sed -i 's/flow strict-local$/flow strict/'
until flow; do flow --json | jq -r '.errors[].message[0].path' | sort | uniq | xargs hg revert; done
```

Reviewed By: sahrens

Differential Revision: D8530207

fbshipit-source-id: c28c7ac5ed3e9b80f3d126d5f30463be8a8a744d
2018-06-20 00:47:21 -07:00
Eli White 160bf731e5 Switch to Platform.isTV to pass Android Flow
Reviewed By: sahrens

Differential Revision: D8345911

fbshipit-source-id: 9af7a25127e7c35844a6c59b267a77cf8adba535
2018-06-10 13:45:57 -07:00
Keith Brown 02d1bcc047 Modified deepFreezeAndThrowOnMutationInDev to use Object.prototype.ha… (#19598)
Summary:
This PR fixes a bug in `deepFreezeAndThrowOnMutationInDev` which did not take into account that objects passed to it may have been created with `Object.create(null)` and thus may not have a prototype. Such objects don't have the methods `hasOwnProperty`, `__defineGetter__`, or `__defineSetter__` on the instance.

I ran into an unrecoverable error in React Native when passing this type of object across the bridge because `deepFreezeAndThrowOnMutationInDev` attempts to call `object.hasOwnProperty(key)`, `object.__defineGetter__` and `object__defineSetter__` on objects passed to it. But my object instance does not have these prototype methods.

Changes:
* Defined `Object.prototype.hasOwnProperty` as a `const` (pattern used elsewhere in React Native)
* Modified calls to `object.hasOwnProperty(key)` to use `hasOwnProperty.call(object, key)` (Per ESLint rule [here](https://eslint.org/docs/rules/no-prototype-builtins))
* Modified calls to deprecated methods `object.__defineGetter__` and `object.__defineSetter__` to instead use `Object.defineProperty` to define get and set methods on the object. (Per guidance on [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__))
* Added a new test to `deepFreezeAndThrowOnMutationInDev-test` to verify the fix.

I tried to create a reproducible example to post to Snack by passing prototype-less objects to a `Text` component, in various ways, but they appear to be converted to plain objects before crossing the bridge and therefore they do not throw an error.

However, I was able to create a new test to reproduce the issue. I added the following test to `deepFreezeAndThrowOnMutationInDev-test`:

```JavaScript
it('should not throw on object without prototype', () => {
    __DEV__ = true;
    var o = Object.create(null);
    o.key = 'Value';
    expect(() => deepFreezeAndThrowOnMutationInDev(o)).not.toThrow();
  });
```

The changes in this PR include this new test.

ESLint test produced no change in Error count (3) or Warnings (671)

N/A
Other areas with _possibly_ the same issue:
c6b96c0df7/Libraries/vendor/core/mergeInto.js (L50)
8dc3ba0444/Libraries/ReactNative/requireNativeComponent.js (L134)

 [GENERAL] [BUGFIX] [Libraries/Utilities/deepFreezeAndThrowOnMutationInDev] -Fix for compatibility with objects without a prototype.
Closes https://github.com/facebook/react-native/pull/19598

Differential Revision: D8310845

Pulled By: TheSavior

fbshipit-source-id: 020c414a1062a637e97f9ee99bf8e5ba2d1fcf4f
2018-06-07 02:44:27 -07:00
Peter van der Zee 29fb2a8e90 Bump Prettier to 1.13.4 on xplat
Summary:
Bump Prettier to use version 1.13.4
All code changes are caused by running Prettier and should only affect files that have an `format` header.
All other changes caused by yarn.

Reviewed By: ryanmce

Differential Revision: D8251255

fbshipit-source-id: 0b4445c35f1269d72730f2000002a27c1bc35914
2018-06-06 05:32:06 -07:00
Eli White 2314c83258 Clamp typechecks -> Flow
Reviewed By: yungsters

Differential Revision: D8219220

fbshipit-source-id: e849d9dae573459e4b09e317cc6dc37bec9ce4e8
2018-06-01 10:25:30 -07:00
Alexey Lang ce7dd53dab Use timestamps from QPL by default
Differential Revision: D8207166

fbshipit-source-id: 1e43d6874ee400cb2e26a11cbcfb12ee32d28d3c
2018-05-31 02:39:21 -07:00
Eli White d01ab66b47 Prettier React Native Libraries
Reviewed By: sahrens

Differential Revision: D7961488

fbshipit-source-id: 05f9b8b0b91ae77f9040a5321ccc18f7c3c1ce9a
2018-05-10 19:10:38 -07:00
Eli White 8f5ebe5952 Convert react-native-github/Libraries to let/const
Reviewed By: sahrens

Differential Revision: D7956042

fbshipit-source-id: 221851aa311f3cdd6326497352b366048db0a1bb
2018-05-10 16:16:35 -07:00
Tim Yung a1f2076aae RN: Delete `mergeFast` from `Text`
Reviewed By: sahrens, TheSavior

Differential Revision: D7899406

fbshipit-source-id: 35fb14c5af3d01404896342a47af9fa280226c7f
2018-05-09 01:16:11 -07:00
Logan Daniels f5fcebabeb PerformanceLogger: log extras to console in DEV mode
Differential Revision: D7862011

fbshipit-source-id: 591caf37d6c91ccb07f13005c0f6c57dcaaa22c5
2018-05-03 16:43:34 -07:00
Spencer Ahrens fffae99640 deepDiffer: add maxDepth arg
Reviewed By: blairvanderhoof

Differential Revision: D7839729

fbshipit-source-id: fe9a06d2aaed9dfbfb3e52779ba4b1b98007b9ce
2018-05-01 22:01:52 -07:00
Spencer Ahrens 0f6762ba50 improve console logging
Summary:
* Always log when PRINT_TO_CONSOLE true - o reason to also check DEV.
* Log when `clearExceptTimespans` is called.
* Type `PRINT_TO_CONSOLE: false` to prevent accidental commits setting it true.

Reviewed By: alexeylang

Differential Revision: D7816623

fbshipit-source-id: 47cf7e158133045e20b345139efb1a79e5e6553b
2018-04-30 11:52:57 -07:00
Rubén Norte d5e9e55fa3 Remove @providesModule from all modules
Summary:
This PR removes the need for having the `providesModule` tags in all the modules in the repository.

It configures Flow, Jest and Metro to get the module names from the filenames (`Libraries/Animated/src/nodes/AnimatedInterpolation.js` => `AnimatedInterpolation`)

* Checked the Flow configuration by running flow on the project root (no errors):

```
yarn flow
```

* Checked the Jest configuration by running the tests with a clean cache:

```
yarn jest --clearCache && yarn test
```

* Checked the Metro configuration by starting the server with a clean cache and requesting some bundles:

```
yarn run start --reset-cache
curl 'localhost:8081/IntegrationTests/AccessibilityManagerTest.bundle?platform=android'
curl 'localhost:8081/Libraries/Alert/Alert.bundle?platform=ios'
```

[INTERNAL] [FEATURE] [All] - Removed providesModule from all modules and configured tools.
Closes https://github.com/facebook/react-native/pull/18995

Reviewed By: mjesun

Differential Revision: D7729509

Pulled By: rubennorte

fbshipit-source-id: 892f760a05ce1fddb088ff0cd2e97e521fb8e825
2018-04-25 07:37:10 -07:00
Andrew Chen (Eng) ff9b3c6517 Display JS component stack in native view exceptions
Reviewed By: mdvacca

Differential Revision: D7578033

fbshipit-source-id: 4dc393cddf8487db58cc3a9fefbff220983ba9da
2018-04-17 17:47:38 -07:00
Vince Oppedisano 9c8c597000 Don't truncate in the middle of an emoji
Reviewed By: adiphos, mantong01

Differential Revision: D7198155

fbshipit-source-id: 360955de7ed686170a23b9883058e3137e17b277
2018-03-12 12:33:54 -07:00
Tim Yung 01fffa245d RN: Remove DebugEnvironment from OSS
Reviewed By: TheSavior

Differential Revision: D7209266

fbshipit-source-id: 9f9ce66121ff375e5a5d965d58f4137616407853
2018-03-10 19:07:48 -08:00
Alexey Lang 8803ab2f11 Fix race condition when there're two flags next to each other
Reviewed By: yungsters

Differential Revision: D7194598

fbshipit-source-id: a76328d63f649403de15503596a179c7baaf7dc3
2018-03-09 04:27:56 -08:00
Héctor Ramos f2ad77f90a Update additional license headers
Reviewed By: sophiebits

Differential Revision: D7196607

fbshipit-source-id: 9e6452f583b2b5616f5bb38f26f2ae33c14bb820
2018-03-08 12:10:14 -08:00
Krzysztof Ciombor b7bb2e5745 Add support for Android TV devices
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

* To be on par with Apple TV support, this makes it possible to run React Native apps on Android TV devices (See also: https://react-native.canny.io/feature-requests/p/android-tv-support)
* These changes also make it possible to navigate through the app using D-PAD buttons that are present on some mobile devices
* Since these changes affect, among others, `ReactRootView.java` and `Touchable.js` code and are closely related to Apple TV implementation, it makes sense for them to be included in the core

 - React native apps can be launched on Android TV devices and properly render their content
 - Navigation is possible using left, right, top, bottom arrows from the remote (or D-PAD)
 - Touchable components can handle D-PAD center button press events and correctly fire their `onPress` handlers
 - Touchable components will receive `onPressIn` and `onPressOut` events and can react to focus/blur changes appropriately (just like on Apple TV)
 - `Platform` constants allow to check if the react-native app is running on TV (`Platform.isTV`)
 - `ScrollView`s behave correctly (same as native implementation) when switching to view outside bounds – that is, the container would scroll such that the newly focused element is fully visible
 - Native "clicking" sounds are played when moving between focusable elements
 - Play/Pause click event is send to `TVEventHandler`
 - Rewind and FastForward events are send to `TVEventHandler`
 - Back button behaves as a normal Android back button
 - Diagonal buttons work correctly on Android TV, e.g. if there is no button directly to the right from the focused one, but there is one to the right but a bit higher/lower it will grab focus
 - Dev menu can be accessed by long pressing fast forward button

A demo showing RNTester app running on Android TV device (Amazon Fire TV Stick) can be found here:
[![RNAndroidTVDemo](http://img.youtube.com/vi/EzIQErHhY20/0.jpg)](http://www.youtube.com/watch?v=EzIQErHhY20)

- `TextInput` will not work on Android TV devices. There's an issue with native `ReactEditText` implementation that prevents it from receiving focus. This makes it impossible to navigate to `TextInput`.
This will be fixed next, but will be included in a separate Pull Request
- ~Overlay permissions cannot be granted on Android TV devices running Android version >= 6.0
This is because the overlay permission can only be granted by firing an Intent to open settings page (`ACTION_MANAGE_OVERLAY_PERMISSION`). Since this page does not exist on TV devices the permission cannot be requested. This will make the app crash when trying to open dev menu (⌘+M) or displaying a redbox error.
Note: This does not affect devices running Android version < 6.0 (for example Amazon Fire TV Stick)~
This is now fixed by: https://github.com/facebook/react-native/pull/16596

* Launch the RNTester app on Android TV device.
  * Ensure it launches without a crash
  * Ensure basic navigation is possible
  * Ensure Touchable components can receive select events
* Ensure the changes do not break current Android and iOS mobile devices functionality.
* Ensure the changes do not break current Apple TV functionality.

[RNAndroidTVDemo video](http://img.youtube.com/vi/EzIQErHhY20/0.jpg)

* Added `ReactAndroidTVViewManager` that handles TV `KeyEvent`s and dispatches events to JS - This is the core that enables basic navigation functionality on Android TV devices
* Following the above change we copy `TVEventHandler.ios.js` into `TVEventHandler.android.js` to enable JS to pick up those native navigation events and dispatch them further to subscribed views. (Note: We do not have a native `TVNavigationEventEmitter` implementation on Android, thus this file is slightly modified, e.g. it does pass `null` to `NativeEventEmitter` constructor)
* Added `uiMode` to `AndroidInfoModule`. (**Note**: This required changing `extends BaseJavaModule` to `extends ReactContextBaseJavaModule` to be able to use `getSystemService` which requires `Context` instance!
* Added `isTV` constants to both `Platform.ios.js` (keeping the deprecated `isTVOS` as well) and `Platform.android.js`
* Changed condition check on `Touchable.js` to use the newly added `isTV` flag to properly handle TV navigation events on Android as well
* Added `LEANBACK_LAUNCHER` to `RNTester` `intent-filter` so that it is possible to launch it on Android TV devices.
* See also a PR to `react-native-website` repo with updated docs for Android TV: https://github.com/facebook/react-native-website/pull/59

 - [ ] Fix `TextInput` components handling by allowing them to be focused and making a proper navigation between them (and/or other components) possible. One thing to note here that the default behavior to immediately open software keyboard when focused on `TextInput` field will need to be adjusted on Android TV as well)
 - [x] Fix overlay permissions issue by changing the way redbox/dev menu are displayed (see: https://github.com/facebook/react-native/pull/16596)
 - [ ] Adjust placement of TV-related files (e.g. the `TVEventHandler.js` file is placed inside `AppleTV` directory which is not accurate, since it does handle Android TV events as well)

Previous discussion: https://github.com/SoftwareMansion/react-native/pull/1
<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAl  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->

[ANDROID] [FEATURE] [TV] - Added support for Android TV devices
Closes https://github.com/facebook/react-native/pull/16500

Differential Revision: D6536847

Pulled By: hramos

fbshipit-source-id: 17bbb11e8583b97f195ced5fd9762f8902fb8a3d
2018-03-06 10:47:02 -08:00
David Vacca 87690570c8 Remove log in JSDevSupportModule
Reviewed By: fkgozali

Differential Revision: D7138115

fbshipit-source-id: f9cdda250b60a305195e01a11d0907f658d0a9d1
2018-03-05 10:55:50 -08:00
Alex McKelvey f7343576fc Truncate filter label if it's too long to fit
Differential Revision: D7144192

fbshipit-source-id: 4001930b194421682fa9bdc9b097434910f339b6
2018-03-02 22:06:23 -08:00
Sophie Alpert 1490ab12ef Update license headers for MIT license
Summary:
Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs.

find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$
replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree.

Reviewed By: TheSavior, yungsters

Differential Revision: D7007050

fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
2018-02-16 18:31:53 -08:00
Alex Dvornikov f7f5dc6649 Extract polyfillGlobal from InitializeCore
Reviewed By: jeanlauliac

Differential Revision: D6987657

fbshipit-source-id: 8762732de671418520376a98bdd724bbb24e4e36
2018-02-15 04:23:43 -08:00
Spencer Ahrens d220118dbd Freeze UTFSequence
Summary:
Don't want anyone accidentally mutating it.

Also make deepFreezeAndThrowOnMutationInDev easier to use with nice flow typing.

Reviewed By: yungsters

Differential Revision: D6974089

fbshipit-source-id: 0f90e7939cb726893fa353a4f2a6bbba701205bc
2018-02-13 14:36:37 -08:00
Dmitry Zakharov 0c49c1f332 Native Modules -> Native Extensions
Reviewed By: danzimm

Differential Revision: D6887988

fbshipit-source-id: 475c05f60a2e1ddcfaa9263ab363bff8a528236a
2018-02-07 08:07:13 -08:00
Dmitry Zakharov 429fcc8cab Migrate DeviceInfoModule from RN Module to Native Function.
Reviewed By: danzimm

Differential Revision: D6750934

fbshipit-source-id: f453801737e41632c6b84ff894e7f0eb66b575dc
2018-01-29 11:18:42 -08:00
Rafael Oleza 9a19867798 Make the React Native HMR client extend from the generic metro HMR client
Reviewed By: BYK

Differential Revision: D6752278

fbshipit-source-id: 5c93cba3e9f3cee2119cb90a711909e0b4a5b835
2018-01-22 10:20:19 -08:00
Jean Lauliac 5e11b8870a xplat/js: asyncRequire: redirect async modules to control modules
Reviewed By: davidaurelio

Differential Revision: D6750305

fbshipit-source-id: 4cf3f1b6e0adbe88a9e7afb6a1784d1528e131b2
2018-01-22 03:17:38 -08:00
Mathias Bynens 431670f908 Remove internal `utf8` utility
Summary:
As requested by davidaurelio in https://github.com/mathiasbynens/utf8.js/issues/17#issuecomment-312500535, this makes it possible for developers to use the `utf8` package from npm in combination with React Native.

Ref. https://github.com/mathiasbynens/utf8.js/issues/17
Closes https://github.com/facebook/react-native/pull/17146

Differential Revision: D6765030

Pulled By: hramos

fbshipit-source-id: dda9b3255618470aea2e32c5ba3cf1325e2ec997
2018-01-19 16:18:32 -08:00
David Vacca 4d3519cc6a Adding JS hierarchy information when a StackOverflowException is thrown in Dev mode
Reviewed By: achen1

Differential Revision: D6716309

fbshipit-source-id: 23458cd126d13fec3aa9c09420f7cdd230ec8dd0
2018-01-19 13:02:41 -08:00
James Ide 2b80cdf1bb Fix HMR syntax error messages (`message` instead of `description`)
Summary:
The code to display HMR errors on the client was reading the `description` field from Metro payloads. Metro does not include `description` in the body of its error payloads -- only in its `body.errors[]` items. This commit changes RN's HMR code to show `body.message` (set consistently with https://github.com/facebook/metro/pull/124) instead of the non-existent `body.description`.

Open a test RN app, enable HMR, and then introduce a syntax error in an app source file. See that the redbox provides information about the syntax error instead of just saying "TransformError undefined".

- https://github.com/facebook/metro/pull/124

[GENERAL][ENHANCEMENT][HMR] - Fix display of syntax error messages when HMR is enabled
Closes https://github.com/facebook/react-native/pull/17619

Differential Revision: D6726516

Pulled By: mjesun

fbshipit-source-id: b1d1008d6f1aa8f88ff8a2aa1374724a305c773b
2018-01-16 03:42:44 -08:00
Eli White 11a495cb32 Fixing eslint-comments warnings
Reviewed By: yungsters

Differential Revision: D6678252

fbshipit-source-id: ee93b7ee52520b750ca11fcc625cccf3cd82d075
2018-01-08 17:04:29 -08:00
Eli White 183c316f4c Strengthen React Native eslint rules
Reviewed By: sahrens

Differential Revision: D6670469

fbshipit-source-id: f4f86fd0921eab3697c10caaba00934ba8adc2f6
2018-01-08 14:17:55 -08:00
Jean Lauliac f871d25eb4 metro-buck: check validity of segments
Reviewed By: davidaurelio

Differential Revision: D6496312

fbshipit-source-id: 586dc8d9f64d13cfddaf6bfe768e8f7b3442561a
2017-12-14 09:49:37 -08:00
Rafael Oleza fbf0aed3ac Implement changes needed to HMRClient to handle wrapped modules from metro
Reviewed By: cpojer

Differential Revision: D6550532

fbshipit-source-id: 606f536cc22df15b248b6a435587e9d2cc7cda57
2017-12-13 04:27:51 -08:00
Brian Shin 5ee27ff755 Fork Platform with a modified API
Reviewed By: sahrens

Differential Revision: D6501208

fbshipit-source-id: c4dbe9d5491f2d42e1a84a61758025e5b2dfa0fe
2017-12-08 14:17:19 -08:00
Jean Lauliac a7b231a327 metro: introduce asyncRequire function
Reviewed By: davidaurelio

Differential Revision: D6498107

fbshipit-source-id: a9c4ab634e60f19b7058205eddcd248f57f63500
2017-12-07 10:53:20 -08:00
Jean Lauliac 1988ba1d79 react-native: BundleSegments: remove async/await
Reviewed By: fromcelticpark

Differential Revision: D6508646

fbshipit-source-id: 9e5c05bde5420cb030912eb187f6333af4b580f9
2017-12-07 07:16:27 -08:00
Rafael Oleza 231c7a0304 Add end to end Delta support to Android devices
Reviewed By: davidaurelio

Differential Revision: D6338677

fbshipit-source-id: 8fa8f618bf8d6cb2291ce4405093cad23bd47fc3
2017-11-17 07:47:38 -08:00
Alex Dvornikov 963c61d4d5 Rename BundleFetcher to SegmentFetcher
Reviewed By: jeanlauliac

Differential Revision: D6271908

fbshipit-source-id: ed1259148ac5ca44789166e22d519a7a21f4cfd9
2017-11-08 07:46:26 -08:00
Adriano Melo 45ed142596 Docs: Improve BackHandler documentation (addEventListener and removeEventListener)
Summary:
This commit adds documentation to two methods of BackHandler API, addEventListener and removeEventListener. Despite being a simple change, it helps to keep the documentation consistent.

I have tested the `./website` locally, the changes look similar to some other components such as `NetInfo`.

[DOCS][ENHANCEMENT][BackHandler] - Improve BackHandler documentation (addEventListener and removeEventListener)
Closes https://github.com/facebook/react-native/pull/16618

Differential Revision: D6260935

Pulled By: hramos

fbshipit-source-id: ab04a9fca89ddaa1925844b5754caf1c355a9329
2017-11-07 10:53:59 -08:00
Jean Lauliac b9f21dc2be react-native: BundleSegments
Reviewed By: davidaurelio

Differential Revision: D6231309

fbshipit-source-id: 565cbadedc5fd8ab25025b5846c098f24fb15a82
2017-11-06 03:46:35 -08:00
Jia Li 59a5dbc0b0 Revert D6210177: react-native: BundleSegments
Differential Revision: D6210177

fbshipit-source-id: 8cb4ee37cd03698e9f3980a9819269086a9d6eab
2017-11-02 12:01:05 -07:00
Jean Lauliac 74371bc50d react-native: BundleSegments
Reviewed By: davidaurelio

Differential Revision: D6210177

fbshipit-source-id: c39e4118389a9739e9e70ba34feb5d335a7f2546
2017-11-02 10:01:25 -07:00
Miguel Jimenez Esun 834b9d4e6e Adding @email tags to most of the tests
Reviewed By: rafeca

Differential Revision: D6185623

fbshipit-source-id: 30df83288fe85516d8d5a1617a4fb8fea826ed6f
2017-11-02 06:25:03 -07:00
Daniel Friesen 165b38ab7a Remove usage of the ... operator in BackHandler
Summary:
This usage of `...` currently causes BackHandler to silently become non-functional when a `Symbol` polyfill is used.

Why?
- The `[...obj]` operator implicitly calls the object's iterator to fill the array
- react-native's internal `Set` polyfill has a load order issue that breaks it whenever a project uses a `Symbol` polyfill
- This means that when `BackHandler` tries to `[...set]` a `Set` of subscriptions the result is always an empty array instead of an array of subscriptions

Additionally it's worth noting that the current code is also wastefully inefficient as in order to reverse iterate over subscriptions it:
- Clones the `Set` (which fills it by implicitly running the set's iterator)
- Uses `[...set]` to convert the cloned set into an array (which also implicitly runs the iterator on the clone)
- Finally reverses the order of the array

----

This code fixes this problem by replacing the use of multiple Set instance iterators with a simple `.forEach` loop that unshifts directly into the final array.

I've tested this by opening the repo's RNTester app on Android and tvOS ensuring that the back handler works before changes, the application crashes when I introduce an error (to verify my code changes are being applied to the app), the back handler works and after changes.

Fixes #11968
Closes https://github.com/facebook/react-native/pull/15182

Differential Revision: D6114696

Pulled By: hramos

fbshipit-source-id: 2eae127558124a394bb3572a6381a5985ebf9d64
2017-10-20 18:02:14 -07:00
Janic Duplessis 0cd69e8a02 Run eslint --fix
Summary:
CI is currently failing because of a lint issue, this fixes it and a bunch of other warnings that are auto-fixable.

**Test plan**
Quick manual test, cosmetic changes only.
Closes https://github.com/facebook/react-native/pull/16229

Differential Revision: D6009748

Pulled By: TheSavior

fbshipit-source-id: cabd44fed99dd90bd0b35626492719c139c89f34
2017-10-09 17:46:44 -07:00
Daniel Andersson 915ac20c76 Avoid eval in buildStyleInterpolator
Reviewed By: vjeux

Differential Revision: D5950405

fbshipit-source-id: ee794317f820e8fbb87752b88539171115a8e00e
2017-10-02 17:05:34 -07:00
Daniel Andersson 3e31038301 Extend unit test for buildStyleInterpolator
Reviewed By: vjeux

Differential Revision: D5950672

fbshipit-source-id: 921ed6ae6a2b307b050c721cedd4b51e880695ae
2017-10-02 17:05:28 -07:00
Matt Bruce d3e1a21399 Change all calls to no-console from no-console-disallow
Reviewed By: TheSavior

Differential Revision: D5944700

fbshipit-source-id: cdd78d1b32fa98d8a792a39ccc3cb37241ab4366
2017-09-29 16:38:06 -07:00
Gregory 3849765ac1 fix params order in comments clamp.js
Summary:
/**
 * param {number} value
 * param {number} min
 * param {number} max
 * return {number}
 */

should be:
/**
 * param {number} min
 * param {number} value
 * param {number} max
 * return {number}
 */

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

(Write your motivation here.)

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)
Closes https://github.com/facebook/react-native/pull/16077

Differential Revision: D5938021

Pulled By: shergin

fbshipit-source-id: 3a6e4ff5ab39a657bc0d9271ae2a2600998b2ddf
2017-09-29 00:01:10 -07:00
Marshall Roch 91b6b4efb9 @allow-large-files Flow v0.54.0
Reviewed By: leebyron

Differential Revision: D5773490

fbshipit-source-id: 2c54bb6326f23edbe9a969f3010f79da8189923e
2017-09-06 03:33:43 -07:00
Hector Ramos 5be8c4af26 Cleanup stray markdown files, update contributing guidelines
Summary:
Several changes here. The `Text.md` and `PixelRatio.md` files were appended to the autodocs during site generation. This seemed excessive for just two files, so I've just merged the content into the autodocs themselves. It should help us simplify the website generation process in the future.

I've also merged IssueGuidelines.md and PullRequestGuidelines.md into the Contribution/Maintainers guidelines to improve their visibility.

Finally, I renamed Help to Community in the nav bar.

Ran the website locally, and verified every page rendered as expected: the Community page, Contributing page, Maintainers page.
Closes https://github.com/facebook/react-native/pull/15374

Differential Revision: D5567400

Pulled By: hramos

fbshipit-source-id: e06056edb12c9a17319fe1af46b2ef3a2e1b5854
2017-08-04 16:18:01 -07:00
Pieter De Baets e697ed75d1 Report native warnings to YellowBox
Reviewed By: fkgozali

Differential Revision: D5553601

fbshipit-source-id: b80f019b11d02865a17a25cbff61edf65173cd84
2017-08-04 07:56:14 -07:00
Spencer Ahrens eec58237ce gets Relay/Classic/Compat building
Reviewed By: fkgozali

Differential Revision: D5482765

fbshipit-source-id: 0a7c2b8d99256352f09b6510ec8ca1631425e232
2017-07-24 21:39:00 -07:00
James Burnett 51c0e81557 remove disableAutomock from jest tests (new default) @bypass-lint
Reviewed By: cpojer

Differential Revision: D5237192

fbshipit-source-id: dccca52a91259d7fea27931f92bca94184a82d4a
2017-06-13 15:04:09 -07:00
Tim Yung 82edc131b0 RN: Fix deepFreezeAndThrowOnMutationInDev-test for Node v8.1.0
Reviewed By: raluca-elena

Differential Revision: D5222219

fbshipit-source-id: e34903a506b8e6e0c81e1c21fd9e8e015b25b2d7
2017-06-09 16:04:18 -07:00
James Burnett 3360999431 disable automock by default in as many places as possible @bypass-lint
Reviewed By: cpojer

Differential Revision: D5190858

fbshipit-source-id: d3125cf81427dbbe3362ef1f958413394a6dc51d
2017-06-08 07:45:54 -07:00
Alex Dvornikov 485bb70691 Allow lazy modules registration with the BatchedBridge
Reviewed By: javache

Differential Revision: D5181849

fbshipit-source-id: f63562c360488a9818605b25c1338214daac7411
2017-06-06 07:07:19 -07:00
Spencer Ahrens 2a3de8f192 Cleanup PerformanceLogger a bit
Summary: `prettier`, lint, etc.

Reviewed By: javache

Differential Revision: D5156709

fbshipit-source-id: a9e63602c10e6e413446660b32ff972f5591c6d1
2017-06-01 10:03:27 -07:00
Gabe Levi 3ddc7d47d5 Fix react-native function call arity errors
Reviewed By: zertosh

Differential Revision: D5081816

fbshipit-source-id: 5978770c30a69fb287d03aa7511999ce30f856a1
2017-05-18 16:55:55 -07:00
Janic Duplessis f3dbddcf2b BREAKING - Remove React forwarding and wrong import warnings
Summary:
Importing `react` modules from `react-native` has been deprecated since 0.25 so I think it's safe to remove it now since everyone has migrated their code and it is now well know and documented that you import from different packages. This finishes the spring cleanup of `react-native-implementation.js` :)

**Test plan**
Tested that UIExplorer still works.
Closes https://github.com/facebook/react-native/pull/13354

Reviewed By: bvaughn

Differential Revision: D4928785

Pulled By: javache

fbshipit-source-id: 38c623c309b06b2cb5e73074833342d2745ab198
2017-04-26 10:02:32 -07:00
Alex Kotliarskyi ea7c5ab04b Add mock for BackHandler
Reviewed By: fkgozali

Differential Revision: D4861901

fbshipit-source-id: b1b74e63731328d2235bf86794aa481a8275ed8c
2017-04-11 12:25:38 -07:00
Spencer Ahrens f72d9dd08b Add option to track when we're showing blankness during fast scrolling
Summary:
If tracking is enabled and the sampling check passes on a scroll or layout event,
we compare the scroll offset to the layout of the rendered items. If the items don't cover
the visible area of the list, we fire an `onFillRateExceeded` call with relevant stats for
logging the event through an analytics pipeline.

The measurement methodology is a little jank because everything is async, but it seems directionally
useful for getting ballpark numbers, catching regressions, and tracking improvements.

Benchmark testing shows a ~2014 MotoX starts hitting the fill rate limit at about 2500 px / sec,
which is pretty fast scrolling.

This also reworks our frame rate stuff so we can use a shared `SceneTracking` thing and track blankness
globally.

Reviewed By: bvaughn

Differential Revision: D4806867

fbshipit-source-id: 119bf177463c8c3aa51fa13d1a9d03b1a96042aa
2017-04-07 01:00:39 -07:00
Pieter De Baets 950637672a Add flow typing to PerformanceLogger
Reviewed By: AaaChiuuu

Differential Revision: D4749896

fbshipit-source-id: 8a3f12e5d7b209c48c95f8564d8e3bcbd19f90c8
2017-03-22 05:38:05 -07:00
Pieter De Baets 005fbe6aa4 Fix PerformanceLogger clearing unfinished events
Reviewed By: alexeylang

Differential Revision: D4749516

fbshipit-source-id: 348f1cf51c01b39a410be8b39598e8e98cd52d55
2017-03-22 05:38:04 -07:00
David Aurelio 80e1dbf692 require `fbjs/lib/invariant`, not `invariant`
Summary: `invariant` is only available in open source because we install it as a transitive dependency into node_modules

Reviewed By: jeanlauliac

Differential Revision: D4745582

fbshipit-source-id: 27c49b576254c8d1d667dea7097d16cdd1205daf
2017-03-21 05:37:03 -07:00
Aaron Chiu ebb55c6bcc log difference in QPL vs PerformanceLogger
Reviewed By: alexeylang

Differential Revision: D4736500

fbshipit-source-id: e5f8590ae7482dbfbbe64403b0162fb496572ac6
2017-03-20 13:07:06 -07:00
Ashwin Bharambe 95c1926193 Introduce `DeviceInfo` as a new native module
Summary:
The `UIManager` already has a lot of responsibilities and is deeply
tied with React Native's view architecture. This diff separates out a
`DeviceInfo` native module to provide information about screen dimensions and
font scale, etc.

Reviewed By: fkgozali

Differential Revision: D4713834

fbshipit-source-id: f2ee93acf876a4221c29a8c731f5abeffbb97974
2017-03-17 17:01:57 -07:00
Eric Vicenti a8474c25fd Fix license headers
Reviewed By: hramos

Differential Revision: D4670890

fbshipit-source-id: e8429aa88a1d4f3cc80034dd087739410c0761f2
2017-03-08 00:52:17 -08:00
Kevin Gozali 1a8d216458 added RCTLog.logToConsole() to force log regardless of debugger connection
Summary: This adds an alternative logging method that can be called from native side. `logIfNoLoggingHook()` will pass the message to console only if there's Chrome debugger attached. This new method sends the message to console regardless to notify the developers better.

Reviewed By: yungsters

Differential Revision: D4669663

fbshipit-source-id: 3940816dadd08d450f066b7223f6d26a38a70921
2017-03-07 19:45:49 -08:00
Douglas Lowder b7e9374c64 Move BackAndroid -> BackHandler, add Apple TV support for back nav
Summary:
Enable back navigation on Apple TV (with the remote's menu button) in code making use of BackAndroid.  The module is renamed to BackHandler.  BackAndroid is still exported to ReactNative for now, until external projects switch to using the new name for the module.  The navigation in https://github.com/react-community/react-navigation makes use of this module.

**Test plan**: Manual testing with an example app (https://github.com/dlowder-salesforce/react-nav-example).
Closes https://github.com/facebook/react-native/pull/12571

Differential Revision: D4665152

Pulled By: ericvicenti

fbshipit-source-id: 925400ce216379267e014457be6f5eedbe4453ec
2017-03-06 21:51:40 -08:00
Pieter De Baets dba133a291 Merge AndroidConstants and IOSConstants into PlatformConstants
Reviewed By: AaaChiuuu

Differential Revision: D4597790

fbshipit-source-id: 0a54598d6e9cadb75efff4ac17c13899d6785f9b
2017-02-22 15:01:11 -08:00
Aaron Chiu 02daffbe9d print out Performance markers to console
Differential Revision: D4585709

fbshipit-source-id: fe1f1f6b146854aa426e6186baf73ac2cf1784c8
2017-02-21 22:15:42 -08:00
Aaron Chiu e81258a15b add Systrace to all PerformanceLogger.js markers
Reviewed By: alexeylang

Differential Revision: D4567843

fbshipit-source-id: 00cac36d2b73f827723546a04edd6b89267c26bb
2017-02-17 12:01:06 -08:00
Adam Comella 186f308aec BREAKING: Android: Correct value of Dimensions.get('screen').fontScale
Summary:
The PR description has been updated to reflect the new approach.

**Breaking Change Summary**

On Android, the following properties now return a different number:
  - `Dimensions.get('window').fontScale`
  - `Dimensions.get('screen').fontScale`
  - `PixelRatio.getFontScale()`

This is a breaking change to anyone who was using these properties because the meaning of these properties has now changed.

These properties used to return a value representing font scale times density ([`DisplayMetrics.scaledDensity`](https://developer.android.com/reference/android/util/DisplayMetrics.html#scaledDensity)). Now they return a value representing just font scale ([`Configuration.fontScale`](https://developer.android.com/reference/android/content/res/Configuration.html#fontScale)).

**PR Description**

This PR changes a few things:
  - Correctly exposes the font scale to JavaScript as `Dimensions.get('screen').fontScale`. UIManager was exporting `DisplayMetrics.scaledDensity` under the name `fontScale`. How
Closes https://github.com/facebook/react-native/pull/11008

Differential Revision: D4558207

Pulled By: astreet

fbshipit-source-id: 096ce7b28051325dfd45fdb2a14b5e9b7d3bc46f
2017-02-14 08:45:38 -08:00
Sebastian Markbage c3b25c9059 Patch up for future React Sync
Reviewed By: spicyj, bvaughn

Differential Revision: D4523259

fbshipit-source-id: 317a26ce3e9e48553a7f7c856dd6b48038b4b2ea
2017-02-08 14:50:43 -08:00
Alexey Kureev f30ab35e92 Add default option for Platform.select
Summary:
satya164 asked me to take over fixes for [this PR](https://github.com/facebook/react-native/pull/11608), so here we go!
Closes https://github.com/facebook/react-native/pull/12218

Differential Revision: D4515285

Pulled By: davidaurelio

fbshipit-source-id: 8987c518401fc67093dfe93bbbb63b934c20f6f9
2017-02-07 04:30:16 -08:00
Philipp von Weitershausen 16bb6e87ba XHR: support typed arrays for request payloads
Summary:
Support `xhr.send(data)` for typed arrays.

**Test plan:** run UIExplorer example on iOS and Android.
Closes https://github.com/facebook/react-native/pull/11904

Differential Revision: D4425551

fbshipit-source-id: 065ab5873407a406ca4a831068ab138606c3361b
2017-01-20 18:43:27 -08:00
Kevin Gozali 06956e83cd expose IS_TESTING for Platform module
Summary: Introduced IS_TESTING flag on Platform module for android as well. This is useful for testing environment.

Reviewed By: mmmulani

Differential Revision: D4429662

fbshipit-source-id: 33711d7fb5666f0bac8aee444b71261f7f12770f
2017-01-19 14:28:30 -08:00
Max Graey b850af7a39 fix skew transformation
Summary:
Motivation:
fix #11884 issue

I will try in short to explain what was wrong.
Let's look to transformation's matrix for **skewY** for example.
| cos(a) | sin(a) |    0   |   0   |
|:------:|:------:|:------:|:-----:|
|    0   |    1   |    0   |   0   |
|    0   |    0   |   1    |    0  |
|   tx   |   ty   |   tz   |   1   ||

Yes, this visually produce skewing transform but it slightly incorrect. This way affects horizontal scale as well. See [this](https://github.com/facebook/react-native/issues/11884)

|    1   | tan(a) |    0   |   0   |
|:------:|:------:|:------:|:-----:|
|    0   |    1   |    0   |   0   |
|    0   |    0   |   1    |   0   |
|   tx   |   ty   |   tz   |   1   ||

According to [www.w3.org/css-transforms](https://www.w3.org/TR/css-transforms-1/#SkewDefined)

Only one differance React Native use **row major matrix style**, so we change ```m[0][1]``` instead ```m[1][0]```.

sahrens vjeux
Closes https://github.com/facebook/react-native/pull/11992

Differential Revision: D4436470

Pulled By: vjeux

fbshipit-source-id: 1b433f04650bae7e06b5a93f521e49f11c70cce3
2017-01-19 11:28:36 -08:00
Mehdi Mulani 81c33b542d Switch out DISABLE_YELLOW_BOX for IS_TESTING
Summary: Switch to using IS_TESTING on the Platform module. While IS_TESTING has to be explicitly set in the test harness, this makes it more usable and stops people from relying on brittle variables in the (larger) environment.

Reviewed By: fkgozali

Differential Revision: D4423661

fbshipit-source-id: 27a80867778b9374bcba67b69f9c93d32c0a74b0
2017-01-18 12:28:42 -08:00
Max Sherman a6844bdf75 Break infinite loop that happens only in debug environments
Reviewed By: javache

Differential Revision: D4411870

fbshipit-source-id: 6b141e42206734368ed50f37c8e7df8e8fd006c0
2017-01-17 16:58:46 -08:00
Albert Brand d2de604721 Android: fix JSC crash in dev
Summary:
On Android with dev mode on, we're seeing a regular SIGSEGV when pushing a lot of animation declarations over the bridge. We tracked this down to being not specific to animations, but the crash is caused in `deepFreezeAndThrowOnMutationInDev`.

Specifically: the provided object to freeze is modified while looping, replacing the current key access to a getter/setter. After the modification, JSC crashes during retrieval of the next key - but only when there are a lot of events passing over the bridge.

We have a hunch that this is due to a bug in JSC object enumeration but did we not look into it further yet. Any help here is welcome. The JS code seems all right at first sight and shouldn't cause a segmentation crash.

The workaround in this PR is to retrieve the keys first from the object and then looping over that array. In our app and in a reduced app test case this fixes the crash.

If needed I can provide the reduced app test case. It's really tricky to make a test for this as it requires to be run
Closes https://github.com/facebook/react-native/pull/11804

Differential Revision: D4403483

Pulled By: davidaurelio

fbshipit-source-id: a31e5cff734e96bfec56e4a39dc1c6854798e245
2017-01-11 08:58:30 -08:00
Mehdi Mulani 199d64083c Stop throwing yellew boxes when we warn from native
Summary: This caused a bunch of stuff to break, reverting and will fix the problems before committing next time.

Reviewed By: fkgozali

Differential Revision: D4363398

fbshipit-source-id: 55146c9da998f6a3883307c36422a9d440ea7f52
2016-12-27 10:43:33 -08:00
Mehdi Mulani ac11eedfb0 Show yellowbox when we fail to load a local image
Reviewed By: achen1

Differential Revision: D4342295

fbshipit-source-id: 9411ffe9a376e1ed51fcadee718326d1d9443fff
2016-12-19 14:07:08 -08:00
Pieter De Baets c92ad5f6ae Apple TV support 4: support for input (tvOS focus engine)
Reviewed By: shergin

Differential Revision: D4333546

fbshipit-source-id: 8655070e81dbb62a80ab1f00a43ef6c2d9654618
2016-12-19 06:28:40 -08:00
Michał Gregorczyk d72c6fd500 Do not call `toString` on functions in buildStyleInterpolator
Reviewed By: vjeux

Differential Revision: D4292618

fbshipit-source-id: cd7cd1a88aeb2c800f2c2941c79855992613ec84
2016-12-07 11:58:28 -08:00
Jennifer Wang be5868dddb Workaround native module dependency in Jest environment
Reviewed By: josephsavona

Differential Revision: D4225750

fbshipit-source-id: 6ac5a5cc1869232861977ea214970804acd7e39d
2016-11-22 23:58:30 -08:00
Tim Yung 23331df5a4 RN: Cleanup OSS JS & Flow Declarations
Reviewed By: vjeux

Differential Revision: D4210763

fbshipit-source-id: 5abaa547100b8badd13bcf311ceffc5b4098d252
2016-11-20 17:58:29 -08:00
Kevin Han b4283ed844 FIX: Call all android back key handlers before invoking default
Summary:
Fixes issue #9736
Closes https://github.com/facebook/react-native/pull/9757

Differential Revision: D4164796

Pulled By: hramos

fbshipit-source-id: c5d966a9bbaa91f9929ea20a775f96c15aa9f482
2016-11-11 00:28:40 -08:00
Pieter De Baets 384ea330c8 Move Platform constants to RCTPlatform
Reviewed By: majak

Differential Revision: D4081849

fbshipit-source-id: bee08af2f68dcc1af424f382f960ff897ba11945
2016-10-27 04:29:00 -07:00
Pieter De Baets 292cc82d0e Reorganize core JS files
Reviewed By: lexs

Differential Revision: D3987463

fbshipit-source-id: fa8f1d1bea7ed699120b9705ddc1c83767fcf8e4
2016-10-11 10:14:28 -07:00
Satyajit Sahoo fa5ad85252 Remove deprecated APIs and modules
Summary:
We've deprecated these APIs for quite a few releases and we should be able to get rid of them now.

Remove following deprecated modules/components
 - AppStateIOS
 - ActivityIndicatorIOS
 - IntentAndroid
 - SliderIOS
 - SwitchAndroid
 - SwitchIOS
 - LinkingIOS

Update following modules to remove callback support
 - Clipboard
 - NetInfo

cc bestander
Closes https://github.com/facebook/react-native/pull/9891

Reviewed By: bestander

Differential Revision: D3974094

Pulled By: javache

fbshipit-source-id: 9abe32716bd85d0cea9933894f4447d53bdd5ee7
2016-10-11 07:43:52 -07:00
Aaron Chiu 1296cb29eb add flag to enable lazy view managers
Reviewed By: achen1

Differential Revision: D3981171

fbshipit-source-id: 2f6b8370064a5835e2e3636d4c1a7f42cc28ccaf
2016-10-07 05:43:45 -07:00
Pieter De Baets 76c54847bb Extract native module logic from BatchedBridge
Reviewed By: lexs

Differential Revision: D3901630

fbshipit-source-id: c119ffe54a4d1e716e6ae98895e5a3a48b16cf43
2016-09-23 11:14:11 -07:00
Pieter De Baets 31b158c9fe Export native modules without RCT or RK prefix
Reviewed By: mmmulani

Differential Revision: D3901600

fbshipit-source-id: 7d4a027f0f2478e2a9ac9916326b91279bec3cb3
2016-09-23 11:14:11 -07:00
Pieter De Baets ff79224d37 Simplify ModuleConfig array format
Reviewed By: lexs, mhorowitz

Differential Revision: D3901563

fbshipit-source-id: 70aea19db1b01170be57b74ccfa1a306dfa1f362
2016-09-23 11:14:10 -07:00
Pieter De Baets acdd08aef7 Add flow-typing to MessageQueue
Reviewed By: majak

Differential Revision: D3901545

fbshipit-source-id: a9ccc3d11794830e21c778df0ae7100d79f7ee73
2016-09-23 11:14:10 -07:00
Pieter De Baets 145109fc6d Remove additional JSON encoding for native->JS communication
Reviewed By: mhorowitz

Differential Revision: D3857323

fbshipit-source-id: 4386cc107b8a1425ecb7297b0f659f6c47f01a78
2016-09-19 04:44:12 -07:00
Pieter De Baets 95cce07baf Support invoking method that returns result and flushes call queue
Reviewed By: mhorowitz

Differential Revision: D3870879

fbshipit-source-id: bc8f70d9866dfc25468c9072c209cc6842b98575
2016-09-16 06:28:48 -07:00
Pieter De Baets 5f381fd357 Move buildStyleInterpolator-test to open-source, remove unused files
Reviewed By: bestander

Differential Revision: D3820939

fbshipit-source-id: 2ff114326642b522f162c6cce7853c8b3f0c138b
2016-09-09 10:58:59 -07:00
Pieter De Baets 99e0267c25 Cleanup and document native module configuration
Summary: Get rid of the old behaviour of JSON encoding in `nativeRequireModuleConfig` and consistently use the same names for function types "async/promise/sync"

Reviewed By: lexs

Differential Revision: D3819348

fbshipit-source-id: fc798a5abcaf6a3ef9d95bd8654afa7825c83967
2016-09-08 04:13:51 -07:00
Kevin Gozali 150fe7cb9c fixed polyfill for BackAndroid
Summary:
`BackAndroid.addEventListener()` returns a subscription object with a `remove()` function in android. Before this fix, the iOS equivalent doesn't return anything, which means, if there's a component doing something like this, it would redbox:

```
componentWillMount() {
  this._subscription = BackAndroid.addEventListener('hardwareBackPress', () => {...});
}

componentWillUnmount() {
  this._subscription.remove(); // --> redbox in iOS before this fix
}
```

Differential Revision: D3790480

fbshipit-source-id: 1e607171bf2892a6b64977c4fd052c5df0bc4a0d
2016-08-30 10:58:45 -07:00
Adam Comella 5d748b2eec Fix memory leak in MessageQueue
Summary:
The MessageQueue has a _debugInfo object where it stores debug information associated with each callback. The size of this structure is currently unbounded.

It looks like the code attempted to restrict _debugInfo to a fixed number of entries but due to a logic bug, it leaked around 30 entries for every 1 entry it cleaned up.

This change limits the _debugInfo object to around 30 entries.

**Test plan (required)**

This change is currently being used in my team's app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/9611

Differential Revision: D3781875

fbshipit-source-id: 58c645c52c3e295fe571b7ca7e0d882169c301ef
2016-08-26 18:58:35 -07:00
Alexander Blom 61b21bcdd1 Remove legacy bridge config conversion
Reviewed By: javache

Differential Revision: D3741859

fbshipit-source-id: b678b3a2bbed4f7ed386e10db19553c8beef7366
2016-08-22 06:59:03 -07:00
Dan Abramov 1aef7e4629 Update hook event names
Summary:
This brings RN up to date with https://github.com/facebook/react/pull/7472 (scheduled for React 15.3.1).
If you use React 15.3.1 with RN without this patch, Systrace output will lack the reconciler events.

(Since it’s a niche feature it didn’t seem to me that full backward compat is necessary so I just removed old hooks. This won’t cause crashes—it’s just you won’t get events in Systrace if you use new React but old RN.)
Closes https://github.com/facebook/react-native/pull/9383

Differential Revision: D3738463

Pulled By: spicyj

fbshipit-source-id: 791cdbc5558666a101fa403f4e7852f700038fc9
2016-08-18 15:58:48 -07:00
Pieter De Baets e4ac66b0ee Unbreak UIManager.takeSnapshot
Reviewed By: majak

Differential Revision: D3729478

fbshipit-source-id: 35869e4327debae78f36638694d09f30c6478661
2016-08-17 10:28:36 -07:00
Pieter De Baets 4afaf5e538 Fix RCTRootView invalidation using the wrong bridge
Reviewed By: majak

Differential Revision: D3696533

fbshipit-source-id: e7ef4373e975e585f4c34df71966c8b5b30d3e9a
2016-08-10 07:43:33 -07:00
David Aurelio 94666f16c7 Auto-fix lint errors
Reviewed By: bestander

Differential Revision: D3683952

fbshipit-source-id: 9484d0b0e86859e8edaca0da1aa13a667f200905
2016-08-09 06:43:46 -07:00
Rickard Ekman 8e2906ae89 Android: Implement cancelable option for Alerts
Summary:
**Motivation**
In iOS you cannot dismiss alerts by clicking outside of their box, while on Android you can. This can create some inconsistency if you want to have identical behavior on both platforms. This change makes it possible for Android apps to have irremovable/required alert boxes just like in iOS.

This adds an additional parameter to the Alert method. The way to use it is by providing an object with the cancelable property. The cancelable property accepts a boolean value.

This utilizes the Android DialogFragment method [setCancelable](https://developer.android.com/reference/android/app/DialogFragment.html#setCancelable(boolean))

**Usage example**
```js
Alert.alert(
   'Alert Title',
   null,
   [
     {text: 'OK', onPress: () => console.log('OK Pressed!')},
   ],
   {
     cancelable: false
   }
);
```

**Test plan (required)**

I added an additional alert to the UIExplorer project where it can be tested. I also added a part in the Dialog Module test to make sure setting canc
Closes https://github.com/facebook/react-native/pull/8652

Differential Revision: D3690093

fbshipit-source-id: 4cf6cfc56f464b37ce88451acf33413393454721
2016-08-09 06:13:48 -07:00
Pieter De Baets 0222107170 Customize main thread initialization of native modules (2nd try)
Reviewed By: majak

Differential Revision: D3671197

fbshipit-source-id: e8df7669be79303d335f2c881e97310b5fed47f9
2016-08-05 11:28:32 -07:00
Mengjue Wang f0fb228ec7 Provide forceRTL for LTR language to test
Summary:
1. Provide forceRTL function for developer to test RTL layout in LTR language bundle in I18nUtil and expose it in I18nManager.
2. Rename `allowRTL` and `setAllowRTL` functions

Reviewed By: fkgozali

Differential Revision: D3663693

fbshipit-source-id: 3db13a44c069ae73d1728c211306422db5dd8122
2016-08-04 12:28:30 -07:00
Dotan Nahum 77e48f1782 Make MessageQueue to emit "SPY" events in a way that can be extensible
Summary:
This PR adds a capability for MessageQueue to emit "SPY" events in a way that can be extensible, to later allow for a tooling ecosystem to grow, one example is the existing [Snoopy](https://github.com/jondot/rn-snoopy) tool that is, for now, forced to work with monkeypatches, and after this PR will be able to use a "formal" way to trace queue events.

After this change, we can wire a "spy" into a queue that will expose the events in different and interesting ways, see below (done with Snoopy):
  <img src="https://github.com/jondot/rn-snoopy/blob/master/media/snoopy.gif?raw=true" alt="Aggregating and Charting Events with Bar" width="400px"/>
  <img src="https://github.com/jondot/rn-snoopy/blob/master/media/snoopy-filter.gif?raw=true" alt="Aggregating and Charting Events with Bar" width="400px"/>

This removes the hardcoded `SPY_MODE` flag and instead uses a function that can be injected from outside world.

```javascript
MessageQueue.spy((info)=>console.log("event!", info)
```

It also creates
Closes https://github.com/facebook/react-native/pull/9160

Differential Revision: D3669053

Pulled By: javache

fbshipit-source-id: 3e4462aa77fc8514d2ea4f15430f7bec57b583a4
2016-08-04 08:43:31 -07:00
Daniel Schmidt c2cf510ff8 Improve the BackAndroid example to be more clear
Summary:
The example of `BackAndroid` caused a bit of confusion for beginners (see #8822), so I thought we should clarify the functionality a bit. I added a comment indicating that a user would have to implement `this.onMainScreen` and `this.goBack` on their own, this was the original problem.
Closes https://github.com/facebook/react-native/pull/8829

Differential Revision: D3660332

fbshipit-source-id: d84a29586c6a1a439f386e6b88220d7b0a275129
2016-08-02 18:30:38 -07:00
Pieter De Baets b83ccb5749 Reverted commit D3580025
Reviewed By: mhorowitz

Differential Revision: D3580025

fbshipit-source-id: 4422b6b97ef844158e369e022d62d6f0ae641222
2016-08-02 14:13:27 -07:00
Lukas Piatkowski ec0ccf599a #15 Add a button in devtools to start/stop the Sampling Profiler
Differential Revision: D3555704

fbshipit-source-id: 4add16c923fcfd306892efec4630c24ae438d6dd
2016-08-02 11:14:06 -07:00
Pieter De Baets e762d961cd Use new enqueueJSCall method everywhere
Reviewed By: majak

Differential Revision: D3605263

fbshipit-source-id: 215f896d675b937593c8b796ed6ec5261ac74dbf
2016-08-02 11:14:06 -07:00
Pieter De Baets 47d6d289d4 Customize main thread initialization of native modules
Reviewed By: mhorowitz

Differential Revision: D3580025

fbshipit-source-id: 18abc15b894c745f584d91da47035c6db036aafa
2016-08-02 10:27:25 -07:00
Siqi Liu 43f73f675f Enable websocket interception in RN network inspector tool
Summary:
This diff enables network inspection for WebSocket APIs, so by now XMLHttpRequest, Fetch and WebSocket are all supported. Android and iOS are both supported.

This diff monkey-patches the RCTWebSocketModule which WebSocket API builds on, and now it is able to intercept all WebSocket requests when app is running. The intercepted information of a WebSocket includes url, protocols, status, messages (sent and received), close reason, server close event and server error information, etc.

Reviewed By: davidaurelio

Differential Revision: D3641770

fbshipit-source-id: 393df0da74ed95b1fd60e38b0d67ed61b3dd5ff3
2016-08-02 08:28:39 -07:00
Siqi Liu 1e8b83d2e6 Add unique ids to the intercepted XHR objects to make the tracking correctly across inspector restarts.
Summary: In previous `XHRInterceptor`, it sometimes crashes when restarting the network inspector because the id of the XHR objects are not unique all time. Fix this in diff by adding a global id "generator" for all intercepted xhr objects in order to make it safe across inspector restarts.

Reviewed By: davidaurelio

Differential Revision: D3641624

fbshipit-source-id: f9a1589f278023243aa182d3da93ce69c985587c
2016-08-02 08:28:39 -07:00
Charles Dick aba87550cc upload JSC heap capture to bundle server
Reviewed By: bestander

Differential Revision: D3642116

fbshipit-source-id: 9626078bb0f087f55d8270c8e0b082c74bd2df9d
2016-08-02 08:13:57 -07:00
Siqi Liu b5abb87a6f Fix the potential bug for network inspector when receiving xhr objects without an "_index" property
Summary: It sometimes happens that there are already some existing `XMLHttpRequest` objects before we turn on the network inspector. So it is a must to check whether a `XMLHttpRequest` object has a property `_index` to determine if it should be tracked.

Reviewed By: davidaurelio

Differential Revision: D3635184

fbshipit-source-id: a5552d7244c994b0fe782ac35baae39ec7488494
2016-07-28 14:13:46 -07:00
Siqi Liu f20d5ed67f Intercept XMLHttpRequest network operations and gather their information in inspector tool
Summary:
This diff
- creates `XHRInterceptor` to intercept all XMLHttpRequest network operations in React Native by monkey-patching.
- enables `XHRInterceptor` in RN development tool "inspector".

This interception and inspector tool work well on both Android and iOS. And this supports interception on any network API based on XMLHttpRequest, especially the Fetch API.

By now, we can intercept 12 information fields of a XMLHttpRequest including method, url, data sent, status, response type, response size, requestHeaders, responseHeaders, response, responseURL, responseType and timeout.

Follow-up:
- Will add UIs in the inspector on top of this diff, to display all the network operation information. (Not in this diff just to make this shorter)
- Will extend this to gather other valuable information towards one XMLHttpRequest.
- Should support other network request APIs like WebSocket.

Reviewed By: davidaurelio

Differential Revision: D3598873

fbshipit-source-id: 3221050ab2ebd876a718fc326646c344d0944a5f
2016-07-27 12:28:32 -07:00
Paul O’Shannessy 5db5ee9f55 Upgrade to React v15.3.0-rc.2
Summary:
There were several fixes to how calls to propType checkers. This is to
account for the new deprecation warning - React.PropTypes will not be
part of production builds in the future.

Note: There is still a warning about an invalid argument to `React.PropTypes.oneOf` (React is running that validation sooner now). Specifically [both of these](b1e49832ef/Libraries/Components/Touchable/TouchableWithoutFeedback.js (L44-L45)) because `View.AccessibilityTraits` is actually undefined in tests (didn't look into why you conditionally set that).

**Test plan (required)**

`npm test` & fixed all warnings due to proptype secret
Closes https://github.com/facebook/react-native/pull/8758

Reviewed By: zpao

Differential Revision: D3564288

Pulled By: bestander

fbshipit-source-id: 1ff1f90907f41855e364048aa730ccd239c522b4
2016-07-21 09:13:29 -07:00
Serhij Korochanskyj b8576312ca Fix BackAndroid subscriptions calls
Summary:
`BackAndroid` JS event subscriptions should be called in reverse order
(the subscription from the latest `addEventLister` should run first).

Also if listener returns true, don't call other listeners.

**Motivation**: We use `BackAndroid` listeners to prevent closing screens with user's input.
When we have two screens in stack (each screen with listener, which show alerts),
we want to show alert only from the last screen listener, not from all.
Closes https://github.com/facebook/react-native/pull/8929

Differential Revision: D3598978

Pulled By: dmmiller

fbshipit-source-id: a7b0762b36a60755a844e90fffd58887f89c9ffb
2016-07-21 08:58:24 -07:00
Adalbert Gorecki 6d1277065d Show the right error message in the console
Summary:
Just a small update to fix the error message in `Alert.js`.

In my app, I'm using https://github.com/zo0r/react-native-push-notification to show local notifications. When the notification is tapped, I'm trying to show an alert with the notification text, but this results in an error (which is not the problem I'm addressing here). Unfortunately the wrong parameter was passed to the `console.warn`, so you couldn't see what the error message was.

Before:
<img width="416" alt="bildschirmfoto 2016-07-18 um 10 50 35" src="https://cloud.githubusercontent.com/assets/666322/16910168/7b45c7ac-4cd7-11e6-8d3e-3861d2fc648c.png">
<img width="416" alt="bildschirmfoto 2016-07-18 um 10 50 43" src="https://cloud.githubusercontent.com/assets/666322/16910173/854fc0ea-4cd7-11e6-956f-93ee68a09bd6.png">

After fix:
<img width="416" alt="bildschirmfoto 2016-07-18 um 10 50 35" src="https://cloud.githubusercontent.com/assets/666322/16910168/7b45c7ac-4cd7-11e6-8d3e-3861d2fc648c.png">
<img width="416" alt="bildschirmfoto 2016
Closes https://github.com/facebook/react-native/pull/8861

Differential Revision: D3586453

fbshipit-source-id: bf81e42bd4450ef15a301e7367e94355379c442e
2016-07-19 07:28:34 -07:00
Pieter De Baets 7fa677f7c3 Add MessageQueue method for executing function and returning its result
Reviewed By: majak

Differential Revision: D3175793

fbshipit-source-id: e1e66e3dcde8b1fb35973340e12d947a0e955775
2016-07-18 07:13:32 -07:00
yueshuaijie f38d9a1147 Fix description of AlertIOS.prompt()'s parameter defaultValue.
Summary:
The description of `AlertIOS.prompt()` parameter `defaultValue` is wrong, correct it.
Closes https://github.com/facebook/react-native/pull/8793

Differential Revision: D3566939

fbshipit-source-id: c6378d8142c66e9f9b854f216afcf10c489ec750
2016-07-14 19:28:20 -07:00
Mengjue Wang 471ee87445 Wrap native module I18nManager with a new RCTI18nManager.js and fix current use of native module I18nManager
Summary: create new RCTI18nManager.js to warp-up native module I18nManager and fix current use of it.

Reviewed By: ericvicenti

Differential Revision: D3547427

fbshipit-source-id: 53a695c94ca6bba2f566d0725c553e58d60bf451
2016-07-11 20:58:32 -07:00
David Aurelio 2426b3b5ec Prevent tests with invalid UTF-8 from failing when jest reads them from the cache
Summary: The utf-8 test was failing when run from Jest’s cache, because it contained unicode escape sequences for stray high and low surrogates. Somewhere in the process of transpiling, caching on disk, and reading from the cache, those stray surrogates are changed to U+FFFD (REPLACEMENT CHARACTER / �). This diffs changes the method of creating these strings from literals to `String.fromCharCode`, which survives the process as intended.

Reviewed By: bestander

Differential Revision: D3534711

fbshipit-source-id: 365bace77a1f914e6e2fbb3430b3e0ea6cec5e83
2016-07-08 12:35:53 -07:00
David Aurelio bd60d828c5 Remove `node_modules/react` from the list of discoverable haste modules
Summary: This removes `node_modules/react` from the list of directories that are used for haste module resolutions. Modules required from React are now imported with `require('react/lib/…')`.

Reviewed By: astreet

Differential Revision: D3509863

fbshipit-source-id: 32cd34e2b8496f0a6676dbe6bb1eacc18124c01e
2016-07-05 06:44:33 -07:00
Konstantin Raev 1d86be3a6e Turned on old bridge for OSS
Summary:
This should revert back to using old bridge by default until we fix gradle script to build new bridge for OSS correctly
Closes https://github.com/facebook/react-native/pull/8539

Differential Revision: D3514263

Pulled By: bestander

fbshipit-source-id: db9e0232b9bde27206814212dedc487c366e3511
2016-07-03 14:43:20 -07:00
Jan Kassens eb28c90205 Sort keys in createStrictShapeTypeChecker message
Summary:
The keys were in random order which made this warning less useful when there are
many keys.

Reviewed By: spicyj

Differential Revision: D3504322

fbshipit-source-id: c184aa447c985a0149cbfa8c90c6daf9632b6226
2016-07-01 15:43:23 -07:00
Christoph Pojer 89a9ca6688 Update some JS in preparation for some Jest updates.
Summary:
* Next version of Jest doesn't allow non test files in __tests__ folders.
* I'm trying to switch all tests off of jsdom on react-native. This should save 500ms of time when running a single test because jsdom is slow to load and react-native is also not supposed to run in a DOM environment, so let's not pretend we are providing the DOM in tests.
* Make the bridge config configurable so that when we disable automocking and we reset the registry we can redefine the value.

Oh also, stop using lodash in Server.js. First off, lodash 3 doesn't work in Jest's node env because it does some crazy stuff, second because we don't need to load all of lodash for debounce.

Reviewed By: davidaurelio

Differential Revision: D3502886

fbshipit-source-id: 1da1cfba9ed12264d81945b702e7a429d5f84424
2016-06-30 01:58:40 -07:00
Tim Yung de6ab1c6f4 RN: Implement `defineLazyObjectProperty`
Reviewed By: sahrens

Differential Revision: D3500318

fbshipit-source-id: 275c5b9a2b747174fb23b80896e2270eb2131e4b
2016-06-29 16:43:17 -07:00
Chris Hopman df6d18358e Serialize params when making/queuing native call
Reviewed By: mhorowitz

Differential Revision: D3460507

fbshipit-source-id: a0600ffe3da89791af3eb64fc2973eb6aafa7d2b
2016-06-23 14:58:58 -07:00
Leon 57d85f1c3e Fixing Syntax Error "errorMessage" is read-only
Summary:
Changed const to let, to dodge the following issue:

> "errorMessage" is read-only
>   203 |         const errorMessage = `Callback with id ${cbID}: ${module}.${method}() not found`;
>   204 |         if (method) {
> > 205 |           errorMessage = `The callback ${method}() exists in module ${module}, `
>       |           ^
>   206 |           + `but only one callback may be registered to a function in a native module.`;
>   207 |         }
Closes https://github.com/facebook/react-native/pull/8347

Differential Revision: D3475525

Pulled By: javache

fbshipit-source-id: e03b3b3411606e6798dc42c785f847c2eda03b0c
2016-06-23 03:13:28 -07:00
Christine Abernathy 22f59a88a6 Improve autogen for reference docs including jsdoc support
Summary:
As part of improving the API and Component reference docs #8154 this pull request adds the following:

- jsdoc support for API docs. See the AlertIOS changes as an example.
- type definitions support and added to both API and Component docs. This is supported via react-docgen and jsdoc.
- better formatting of method properties (now shown in a table).

FYI, API and Component docs were previously generated in two different ways. Components were using react-docgen and that basically remains as-is. APIs were using custom parsing code and that's been switched to use a jsdoc parser + react-docgen as an option for typedefs (it could also use the jsdoc parser).

Two docs have been updated to showcase how we'd like the new docs to look:

- AlertIOS (API): showing method parameters, examples, typedefs, more details overall.
- Statusbar (Component): showing method parameters, typedefs, more details overall.

**Note**: To convert new API docs to use the new format, add `jsdoc` to the initial file comment. C
Closes https://github.com/facebook/react-native/pull/8196

Differential Revision: D3465037

Pulled By: lacker

fbshipit-source-id: 78415d44bc5be02db802f5b1f7a0b249689abdf7
2016-06-21 14:28:43 -07:00
Alexey Lang b36eaeda5d Replace RCT_DEV with RCT_PROFILE
Reviewed By: javache

Differential Revision: D3462735

fbshipit-source-id: 44513a9540b3111e036c4b14e0fda2d34b43cdf6
2016-06-21 12:15:45 -07:00
Pieter De Baets 979d1c7e71 Make MessageQueue module/method tables DEV-only
Reviewed By: lexs

Differential Revision: D3431065

fbshipit-source-id: fcb90bd53460064f8a0efee346ed3b87886e7b60
2016-06-15 07:58:48 -07:00
Satyajit Sahoo 803cb61346 Show better error message when accessing React APIs on React Native
Summary:
**Motivation:**

Lots of examples on the web still have the old way to import React APIs from React Native. Also when someone upgrades to latest version of React Native without reading the release notes can get confused. This PR adds getters for  `createClass` and `Component` and throws an error with a better error message when they are accessed.

![screenshot_20160614-125622](https://cloud.githubusercontent.com/assets/1174278/16034600/47c70222-3230-11e6-9fe4-1a3493708829.png)

**Test plan:**

Trying to use `ReactNative.createClass` or `ReactNative.Component` will throw an error with this error message.

There's currently a bug in `symbolicateStackTrace` which actually crashes the app after showing the error due to the `stack` being null when updating the stack trace. But that's a separate issue which should be fixed separately. For now, to prevent the crash, we need to add the following before the return statement here - https://github.com/facebook/react-native/blob/master/Libraries/JavaScriptAppEn
Closes https://github.com/facebook/react-native/pull/8099

Differential Revision: D3430468

Pulled By: javache

fbshipit-source-id: c098e51e1f2c276d87eca6da3bd91a457d7840c5
2016-06-14 06:28:26 -07:00
Pieter De Baets 3f1bca7d26 Fix truncate tests
Reviewed By: bestander

Differential Revision: D3424960

fbshipit-source-id: 0f434d80e6e26cfc9f01800c266dd1a3710fe459
2016-06-13 10:13:36 -07:00
Pieter De Baets 2151dfbb24 Open source jest tests for open source components
Reviewed By: bestander

Differential Revision: D3424368

fbshipit-source-id: 116229b64ecc7d8846e803e29fad377a4fb800bb
2016-06-13 08:28:50 -07:00
Pieter De Baets c25e48abfc Allow additional information to be passed to systrace events
Summary: Expose the ability to provide extra information to Systrace events from JS. This is specifically useful for instrumenting generic recursive method that are defined completely through their params.

Reviewed By: tadeuzagallo

Differential Revision: D3423595

fbshipit-source-id: 7f2dedf02bf901401a6b391b85b1a0bb6782349c
2016-06-13 04:28:38 -07:00
Igor Avramovic 7c3364196a Reverted commit D3369528
Differential Revision: D3369528

fbshipit-source-id: 4400411f43bc8396b3692d80b797eceed8899452
2016-06-03 05:43:26 -07:00
Igor Avramovic c55e3649dd Lazy load platform specific code
Differential Revision: D3369528

fbshipit-source-id: 0fbc63fbac5e96468598fb3d0a86c6b20f96f39d
2016-06-02 17:43:25 -07:00
Alex Kotliarskyi 0d1d7ba2b7 Remove dead SourceMap code
Summary:
In several pervious diffs we have moved symbolication of JS stack traces
to the packeger. This lets us save a bunch of memory (~80MB) and CPU on device,
reduces dependency on JS after exception occured.

This diff cleans up a bunch of code that was used to do symbolication on client side.

Reviewed By: javache

Differential Revision: D3348676

fbshipit-source-id: 88baa5c502836c9ca892896e1ee5d83db37486d3
2016-06-01 13:59:16 -07:00
Sean Kinsey a96fcc7ce1 Optimize and flowify mapWithSeparator
Summary:
Update mapWithSeparator so that Flow can reason about the arguments and return
type. For simplicity, it is expected that the type of the separator will be the
same as that of the mapped item.

Reviewed By: vjeux

Differential Revision: D3323557

fbshipit-source-id: 75b59e928d4e8c309b5933499a14744370ee5660
2016-05-26 12:28:55 -07:00
Basil Hosmer ac5636dd59 explicit type args in react-native-github
Reviewed By: vjeux

Differential Revision: D3342856

fbshipit-source-id: ba5a4d5529fc9d1d1efe98cc175d718c5f044a5b
2016-05-24 18:28:26 -07:00
Ben Alpert 8876eaaea0 Set up Systrace during initialization
Summary: When we're profiling, we want to load Systrace immediately and profile all the startup and initial render code. The code here used to load Systrace during startup only if `__DEV__` but would always start profiling once Systrace was otherwise required. That seems pretty hard to reason about, so I'm switching to always requiring Systrace during the startup path and enabling profiling if appropriate. In actual production that'll always be false, of course.

Reviewed By: javache

Differential Revision: D3338216

fbshipit-source-id: f173e82f34e110d83e7ff04f11af9b302a54b859
2016-05-24 12:13:24 -07:00
Pieter De Baets 4880309e72 Prevent Systrace from including React in the preloaded modules section
Reviewed By: tadeuzagallo

Differential Revision: D3304923

fbshipit-source-id: 25dea5b57002578ccb3e38e8946c6b73db008ed0
2016-05-23 04:58:24 -07:00
Alexander Blom 2a67f9b249 Move infoLog to OSS
Reviewed By: sahrens

Differential Revision: D3310270

fbshipit-source-id: 93261e6083a35e6869b384c8c230c861427e4060
2016-05-17 12:43:40 -07:00
Ben Alpert a95405f419 Update to React 15.1.0-alpha.1
Reviewed By: zpao

Differential Revision: D3283057

fbshipit-source-id: c37ea3818597e5c0f37ed3c7502c791c02183ea8
2016-05-10 15:58:24 -07:00
Pieter De Baets 57ceeafd4f Move UI-specific logic from NativeModules to UIManager
Summary: Move all requires of UIManager to UIManager.js, so we can load the view manager configuration lazily when UIManager is required.

Reviewed By: majak

Differential Revision: D3270147

fb-gh-sync-id: 8208ee8d5919102ea5345e7031af47ee78162fe0
fbshipit-source-id: 8208ee8d5919102ea5345e7031af47ee78162fe0
2016-05-09 08:21:19 -07:00
Alexander Blom abca466037 Remove name property from native modules
Reviewed By: javache

Differential Revision: D3275674

fb-gh-sync-id: 7c100c78576b48f3163c37b93499dd54da73b96c
fbshipit-source-id: 7c100c78576b48f3163c37b93499dd54da73b96c
2016-05-09 05:46:23 -07:00
Alexander Blom 097f59112f Make MessageQueue.RemoteModules lazy
Reviewed By: javache

Differential Revision: D3252400

fb-gh-sync-id: 11a31fd2e1e41c6a3ad538b08ef177207780bd88
fbshipit-source-id: 11a31fd2e1e41c6a3ad538b08ef177207780bd88
2016-05-06 04:14:23 -07:00
Alexander Blom 041185edfd Let JS modules use strings instead of ids on Android
Reviewed By: nicklockwood

Differential Revision: D3229626

fb-gh-sync-id: f8b2e8c9fc0d25d67f623cdbbe9930a02a40d1de
fbshipit-source-id: f8b2e8c9fc0d25d67f623cdbbe9930a02a40d1de
2016-05-04 10:29:26 -07:00
Janic Duplessis 169cfb5a52 Remove the need for allowTopLevelThis in transform-es2015-modules-commonjs
Summary:
This make the transform behave closer to the standard for modules.

This removes the few places that a top level this was used to refer to the global space. It also clean up the usage of `GLOBAL` to use `global` instead as this is what is used everywhere else in the code base. We still define `GLOBAL` for compatibility with other modules.

**Test plan**
Clear the packager cache to make sure the transforms run again. (node ./local-cli/cli.js start --reset-cache).
Run the Movies example (UIExplorer is broken atm) and make sure there are no errors.
Closes https://github.com/facebook/react-native/pull/6255

Differential Revision: D3037227

Pulled By: mkonicek

fb-gh-sync-id: bcf1350ae7a6e92c77d3a87fc9d6e42eb93cb9b9
fbshipit-source-id: bcf1350ae7a6e92c77d3a87fc9d6e42eb93cb9b9
2016-04-29 16:15:34 -07:00
Sebastian Markbage 373537b281 Deprecate transformMatrix and decomposedMatrix
Summary:
transformMatrix only worked on iOS and there is an equivalent API that (mostly)
works cross platform.

decomposedMatrix could technically be passed on Android but it wasn't document and explicitly flagged as not working.

My goal is to deprecate both uses and then the only supported API is the `transform: [{ matrix: ... }]` form.

The only difference is that on Android the matrix gets decomposed.

Currently there is some special cased magic that renames transform -> transformMatrix or decomposedMatrix depending on platform.

https://github.com/facebook/react/blob/master/src/renderers/native/ReactNative/ReactNativeAttributePayload.js#L50

Therefore I'm adding an alias for both native platforms called just "transform".

Next I'll swap over the JS to always target the name "transform". The only difference is how the value is marshalled over the bridge in processTransform.

To do this, I have to clean up a few callers. Mostly that's just swapping to the new API.

For buildInterpolator this is a bit trickier but this fixes it for all our use cases (which is only the Navigator in AdsManager).

Reviewed By: vjeux

Differential Revision: D3239960

fb-gh-sync-id: 838edb6644c6cdd0716834f712042f226ff3136f
fbshipit-source-id: 838edb6644c6cdd0716834f712042f226ff3136f
2016-04-29 14:19:25 -07:00
Charles Dick 24b2990467 Capture heap from the dev menu
Reviewed By: foghina

Differential Revision: D3229856

fb-gh-sync-id: c6321cfb309c93572a51bba625d63246a75f0254
fbshipit-source-id: c6321cfb309c93572a51bba625d63246a75f0254
2016-04-29 07:35:22 -07:00
Dave Miller 3a5457cd7c Add support for setChildren
Summary: This adds support for UIManager.setChildren on Android like D2757388 added for iOS.

Reviewed By: andreicoman11

Differential Revision: D3235369

fb-gh-sync-id: b538556ec4abdb606f9be26d1b74734046bca0cd
fbshipit-source-id: b538556ec4abdb606f9be26d1b74734046bca0cd
2016-04-29 04:03:24 -07:00
Christoph Pojer d363b1f2e2 Update Jest APIs on fbsource
Reviewed By: javache

Differential Revision: D3229435

fb-gh-sync-id: b0e252d69e1f399a946fca6e98ef62ff44c2ef9c
fbshipit-source-id: b0e252d69e1f399a946fca6e98ef62ff44c2ef9c
2016-04-27 19:16:32 -07:00
Andy Street 50d8d46733 Add ability to expose sync hooks from Java to JS
Summary:
This only works for the new cxx bridge (hopefully open sourcing soon!).

This diff allows Java native modules to expose synchronous hooks to JS via the ReactSyncHook annotation. The methods will appear in JS on the native module object (e.g. you would do `require('UIManager').mySyncHook('foo');`) which allows us to enforce that required native modules are installed at build time. In order to support remote debugging, both the args and return type must be JSON serializable (so that we can go back across to the device to resolve synchronous hooks).

Follow ups will be integration tests, adding support for return types besides void, and adding support for remote debugging.

Reviewed By: mhorowitz

Differential Revision: D3218794

fb-gh-sync-id: 7e3366a8254276f5a55eb806287419287ca9182b
fbshipit-source-id: 7e3366a8254276f5a55eb806287419287ca9182b
2016-04-27 07:51:28 -07:00
Mike Grabowski edf8888fb9 Platform.select method
Summary:
Kudos to frantic for this amazing idea! Works really well (yet so simple!)

Basically we had a discussion with vjeux and frantic and others in the PR #7033 how to handle platform-specific stylesheets in a similar to F8 app way.

There were quite a few nice ideas there, however that one seems to be the smallest yet the most powerful.

Basically there's a `Platform.select` method that given an object, will select a `obj[Platform.OS]` value.

It works with styles:
`Platform.select({ ios: {}, android: {} })`

with messages:
`<Text>{Platform.select({ ios: 'Check the App Store', android: 'Check Google Play' })}</Text>`

and also works well with components (similar to Wallmart idea of <PlatformSwitch />) - relevant example included in diff.
Closes https://github.com/facebook/react-native/pull/7220

Differential Revision: D3221709

Pulled By: vjeux

fb-gh-sync-id: 0a50071f2dcf2273198bc6e2c36e19bca97d7be9
fbshipit-source-id: 0a50071f2dcf2273198bc6e2c36e19bca97d7be9
2016-04-25 16:32:20 -07:00
Sebastian Markbage 47a470a97c Move React Core Integration to a Dependency
Summary:Adding the react native renderer dependency and various fixes to support React 15.

Don't use dispatchID for touchableHandleResponderGrant

This callback argument was removed because "IDs" no longer exist. Instead, we'll
use the tag from the event target.

The corresponding PR on React Core is: https://github.com/facebook/react/pull/6338

Reviewed By: spicyj

Differential Revision: D3159788

fb-gh-sync-id: 60e5cd2aa0af69d83fcdac3dfde0a85a748cb7b9
fbshipit-source-id: 60e5cd2aa0af69d83fcdac3dfde0a85a748cb7b9
2016-04-21 09:28:23 -07:00
David Aurelio fcc89e9d92 Add support for missing XHR response types
Summary:Fixes #6679

This adds support for the missing response types to XMLHttpRequest.
Don?t ship this yet. This is completely untested. yolo and stuff.
Closes https://github.com/facebook/react-native/pull/6870

Reviewed By: bestander

Differential Revision: D3153628

Pulled By: davidaurelio

fb-gh-sync-id: 76feae3377bc24b931548a9ac1af07943b1048ac
fbshipit-source-id: 76feae3377bc24b931548a9ac1af07943b1048ac
2016-04-11 05:54:28 -07:00