Commit Graph

10640 Commits

Author SHA1 Message Date
David Aurelio 58337c9032 BREAKING: Pass parameters to `transformer.transform` as object
Reviewed By: jeanlauliac

Differential Revision: D5037155

fbshipit-source-id: fbd18bd62254d7e1522f659ea62055e66748a951
2017-05-11 08:35:07 -07:00
Georgiy Kassabli 70b7488f97 Adding node type and moving rounding dependency to rely on that type
Reviewed By: emilsjolander

Differential Revision: D5025107

fbshipit-source-id: a8d66e2f9c5d02ab080784cc474be583a09b92e2
2017-05-11 08:17:58 -07:00
Sebastian McKenzie c15a6b6202 Use absolute locations for plugins and presets in packager babel config
Reviewed By: davidaurelio

Differential Revision: D5044244

fbshipit-source-id: ab1af28d0158c22d0426a7a3b3f1bb0a63abac4e
2017-05-11 06:51:52 -07:00
Pieter De Baets 01460873da Move jschelpers to fb_xplat_cxx_library
Reviewed By: bestander

Differential Revision: D5035858

fbshipit-source-id: 110fc5140ee4930634ef2ac3453d0a84124516f9
2017-05-11 06:35:36 -07:00
Jean Lauliac c286da0195 packager: ResolutionRequest: keep track of tentative resolution paths
Summary: That's a bit of an experimental changeset, I wanted to experiment how we can track with more precision the resolution and this is what I come with. That allows us to know what has been tested if we canot find a match. It also uses a simpler control flow with early `return`s all across. Finally, this reflect the strategy I want to apply for the rest of the resolution. (Right now the error is still not great, as it may be deeply nested, as in the case of packages resolution.)

Reviewed By: davidaurelio

Differential Revision: D5044040

fbshipit-source-id: 2e256174506f80d90ee83175057666d530785788
2017-05-11 06:35:36 -07:00
Jean Lauliac e379b84545 packager: Module: tweak isHaste return type
Reviewed By: cpojer

Differential Revision: D5036181

fbshipit-source-id: 6042beb44bc67e64dd57c8dd6043f8dd690e9382
2017-05-11 05:04:05 -07:00
Pieter De Baets 19e6557d2e Cleanup cxxreact BUCK file
Reviewed By: mzlee

Differential Revision: D5020563

fbshipit-source-id: 286a2d1c44623b5b9fd923ef8684d263500791b3
2017-05-11 05:04:02 -07:00
Kathy Gray 8b53a2b29b Merging cxxbridge and bridge packages
Reviewed By: javache

Differential Revision: D5027875

fbshipit-source-id: 47e081069d4219bdb29f63ce8a78c1f31a590da7
2017-05-11 03:50:52 -07:00
ZauberNerd 31a0b8788f Add jest mock for 'PushNotificationManager'
Summary:
`PushNotificationIOS` is a library that makes use of the
`PushNotificationManager` native module.
This commit adds a jest mock for its native module so that code that
uses `PushNotificationIOS` can be tested using jest.

In order to enable behaviour in unit tests it is possible to replace or
overwrite the mock implementation, see the [jest guide on
mocks](https://facebook.github.io/jest/docs/mock-functions.html).
By doing something similar to:
```javascript
import { NativeModules } from 'react-native';
const { PushNotificationManager } = NativeModules;
// mock 'checkPermissions' to return a different value than the default:
PushNotificationManager.checkPermissions.mockImplementationOnce((callback) => {
    // execute callback in next tick to enable async behaviour
    process.nextTick(() => callback({
        alert: false,
        badge: false,
        sound: false
    }));
});
// execute unit tests for code that makes use of 'PushNotificationIOS'
```
Closes https://github.com/facebook/react-native/pull/13410

Differential Revision: D5043904

Pulled By: cpojer

fbshipit-source-id: 11e73cd215ba6854d06f4ac7a5aea0ab4be26584
2017-05-11 03:50:52 -07:00
Jean Lauliac 3e46c051d3 packager: ResolutionRequest: @format
Summary: Add `prettier` before I continue some refactorings.

Reviewed By: davidaurelio

Differential Revision: D5036276

fbshipit-source-id: 590e1b23864f28c51d337204df3281dd8bd311cd
2017-05-11 03:50:52 -07:00
Pavlos Vinieratos 867a6dbd27 MacOS -> macOS
Summary:
Thanks for submitting a PR! Please read these instructions carefully:

- [X] Explain the **motivation** for making this change.
- [X] Provide a **test plan** demonstrating that the code is solid.
- [X] Match the **code formatting** of the rest of the codebase.
- [X] Target the `master` branch, NOT a "stable" branch.

it has been just annoying me for a long time.
its `Mac` but its `macOS`.
https://www.apple.com/macos/sierra/

no testing needed

o be merged.

For more info, see the ["Pull Requests"][5] section of our "Contributing" guidelines.

[1]: https://medium.com/martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9
[2]: https://code.facebook.com/cla
[3]: https://travis-ci.org/facebook/react-native
[4]: http://circleci.com/gh/facebook/react-native
[5]: https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests
Closes https://github.com/facebook/react-native/pull/13896

Differential Revision: D5036473

Pulled By: javache

fbshipit-source-id: e8f0813d67648da27af932a72e84e744c5ae84da
2017-05-10 08:31:36 -07:00
Jean Lauliac 8f6d040c23 packager: trying out @format
Summary: Internally when adding `format` we have a lint rule that automatically reformat using `prettier` and the project rule. I'm concerned how we can ensure this stays consistent when merging PRs though. It's not a big issue because the volume of PRs is low, but we'll have to figure it out later on.

Reviewed By: davidaurelio

Differential Revision: D5035830

fbshipit-source-id: 6f2bc9eb8212938ff785a34d2684efd1a9813e1a
2017-05-10 06:03:06 -07:00
Michael Lee 48c27b9a6c Fix gradle build due to renamed boost directory
Reviewed By: yungsters

Differential Revision: D5033507

fbshipit-source-id: 1ab1126e0beb0a72f5a090a7cfeee0d5d99b0d16
2017-05-10 06:03:06 -07:00
Jean Lauliac 9b06205f82 packager: remove unused declareOpts module
Summary: That module is not used anymore, remove it and its dependency `joi`.

Reviewed By: cpojer

Differential Revision: D5028909

fbshipit-source-id: 90b9b156fbfe642cce93a530faf8ce91c5b848f5
2017-05-10 05:31:31 -07:00
David Aurelio f1a220b3cf Fixes issues with uglify.js usage
Summary: Adds flow type defs for uglify, and fixes the two issues found

Reviewed By: jeanlauliac

Differential Revision: D5029190

fbshipit-source-id: eb5947b051844938da241e002b727edc1384e3a6
2017-05-10 05:16:06 -07:00
cailenmusselman f088bca580 ProgressBarAndroid checks indeterminate prop type manually
Summary:
Causes a YellowBox warning: "You are manually calling a React.PropTypes validation function for 'indeterminate' prop on 'ProgressBarAndroid'."

Initially reported here: https://github.com/facebook/react-native/issues/9692 but closed by the creator because he switched to using ActivityIndicator.

Fixed as per the guidelines here: https://facebook.github.io/react/warnings/dont-call-proptypes.html

```
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * flow
 */

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  View,
  ProgressBarAndroid
} from 'react-native';

export default class AwesomeProject extends Component {
  render() {
    return (
      <View style={styles.container}>
	<ProgressBarAndroid indeterminate={true} styleAttr="Horizontal"/>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1
  }
});

AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);

```
Closes https://github.com/facebook/react-native/pull/11791

Differential Revision: D4998602

Pulled By: davidaurelio

fbshipit-source-id: e210684e2f2497238e4d3d0adf2754075be81e98
2017-05-10 05:16:06 -07:00
Jean Lauliac eb19904cec packager: ResolutionRequest: check dir existence only on error
Reviewed By: davidaurelio

Differential Revision: D5028476

fbshipit-source-id: 848d7f6a7b6ab046a5e489a56dc224f3296cea02
2017-05-10 05:16:06 -07:00
Jean Lauliac c0babb2731 packager: make TransformCache a stateful class
Summary: This removes the single-use "garbage collection" class and make a single `TransformCache` instead. The reason for doing this is that I'd like to experiment with using a local dir based on the root path instead of the `tmpdir()` folder, because on some platform using the temp dir is subject to permissions problem, sometimes it is empty, and on all platform it is vulnerable to concurrency issues.

Reviewed By: davidaurelio

Differential Revision: D5027591

fbshipit-source-id: e1176e0e88111116256f7b2b173a0b36837a887d
2017-05-10 04:45:44 -07:00
Jean Lauliac 0216e87616 packager: ResolutionRequest: skip dirExists in loadAsDir
Summary: I'm continuing my changes to avoid `lstat`-ing the folders when we don't really need to. That changeset in particular proposes to remove the check in `_loadAsDir`. The rationale is that right after that we try for the presence of the `package.json`. If that file exists, the folder necessarily exist so we can switch these two `if` blocks for sure without changing the logic. Finally, at the end we look for the "index" file. By removing the folder check, packager would now report "file `foo/index` does not exist" rather than "directory `foo` does not exist" if the folder does not exist. I think it's not much worse, especially as both of these are unhelpful for what I believe to be a large number of cases already anyway. Indeed, the whole algo is based on a series of try/catch, and only the very last try will see its error surfaced. But, most often, it'd be useful for earlier tries to be surfaced to the user. I do want to improve that; meanwhile, however, I sense it's not a big deal to remove that folder check for all these reasons. If you don't agree, I do have another proposition: we could catch errors generated by the last `_loadAsFile` call, and rethrow them as directory errors instead (if `dirExists` return `true`). That way, the call to `dirExists` would only happen in case of errors (but that could still happen quite a lot as a result).

Reviewed By: davidaurelio

Differential Revision: D5028341

fbshipit-source-id: 2d4c99c0f352b71599482aa529728559466b76fd
2017-05-10 04:45:44 -07:00
Jean Lauliac 76f74a55c2 packager: ResolutionRequest: simplify asset resolution
Summary: I think we don't really need to check the directory beforehand, the function to find asset will just return an empty array. As for the error message, I tried adding a require of an asset file somewhere, but due to the way the ResolutionRequest algo work, it generates a final error message that unrealted ("Directory ... does not exist", instead of the "asset does not exist"). I plan to revamp the way errors are handled such as the error message clearly identifies what file paths have been inspected.

Reviewed By: davidaurelio

Differential Revision: D5028118

fbshipit-source-id: 496472001c0a3d4192bfef4a0c8a0dc8a9a0fa82
2017-05-10 04:45:44 -07:00
Pieter De Baets 567015fa04 Mark ByteBuffer methods as const
Reviewed By: emilsjolander

Differential Revision: D5020648

fbshipit-source-id: 6e60b80cb3d4718bab25dd6ca9627aee862117db
2017-05-10 04:32:54 -07:00
Pieter De Baets 885856c6a1 More attempts to fix Travis CI runs
Summary:
* Add RCTBridge+Private to exported headers for unit tests
* Fix tvOS build
Closes https://github.com/facebook/react-native/pull/13840

Reviewed By: ericvicenti

Differential Revision: D5027887

Pulled By: javache

fbshipit-source-id: 7a17ee2f84eb1cb87e71373444ef25559959c24a
2017-05-10 04:32:54 -07:00
Ben Nham 65f22a5190 log script name with bundle loading perf event
Reviewed By: javache

Differential Revision: D5010638

fbshipit-source-id: 2e139201a8374245fa1dedc4f11a716dcf700fd7
2017-05-10 04:09:19 -07:00
Lukas Piatkowski 5dcfb2c6ad Add SamplingProfilerMethod to CSDevelopmentGlobalStateManager
Reviewed By: cwdick

Differential Revision: D5010523

fbshipit-source-id: ad602dfae039e0cbb7c62d42d75a93d1aa2d3aa4
2017-05-10 04:09:19 -07:00
Lukas Piatkowski 621148d724 Extract bundle download logic from DevServerHelper to BundleDownloader
Reviewed By: cwdick

Differential Revision: D4729058

fbshipit-source-id: 6ffbe4dbd916ac7ac6afffba2cf070aab9cb87b9
2017-05-10 04:09:19 -07:00
Lukas Piatkowski 9468c5a733 Added method handler for Sampling Profiler that uses only JSCcontext and JSC API
Reviewed By: cwdick

Differential Revision: D4689688

fbshipit-source-id: d1f9df0b3dcb21420cf813888c19f2d9a9aa5646
2017-05-10 04:09:19 -07:00
Jean Lauliac cb3b744d08 packager: remove unused imurmurhash
Summary: This is not used by live code anymore.

Reviewed By: cpojer

Differential Revision: D5029114

fbshipit-source-id: 9ab9f6075407623debfe23bc121cc48ae8903917
2017-05-10 03:48:32 -07:00
Jean Lauliac c948ae8168 packager: rename node-haste/index to DependencyGraph
Summary: I've been confused for a long time by this, and I think it's better late than never. I propose we rename that file to make it more explicit where that class lives, and so that it's consistent with the test file, name `DependencyGraph-test.js`

Reviewed By: davidaurelio

Differential Revision: D5020556

fbshipit-source-id: d54a501c3995f3fea16a5bfc6ca72993f73c4873
2017-05-10 03:48:32 -07:00
Fred Liu a324dfbd51 Allow Android videos to be shown in the CameraRoll selector
Summary:
Currently, Android camera roll videos cannot be retrieved in RN since

1) `CameraRollManager.java` doesn't do anything with the `assetType` param
2) Unspecifying MIME types doesn't show videos

This diff allows videos to be shown in the `CameraRoll.getPhotos(..)` call by reading `assetType`. Future diffs will come where the thumbnail and other info will be returned as well.

Reviewed By: furdei

Differential Revision: D5019202

fbshipit-source-id: a920273761b31f1a59ba6b8bc49c05852506829c
2017-05-10 03:31:24 -07:00
Spencer Ahrens d40a7ea7f9 TouchableHighlight needes to set _isMounted false when it unmounts.
Summary:
D5016368 to suppress the warning had a typo which meant `_isMounted` would never get set
`false` and thus some functions could be called on unmounted refs.

Reviewed By: yungsters

Differential Revision: D5034076

fbshipit-source-id: 6334db6ee2f9e19c1bb4da2572987dc10773e28d
2017-05-09 21:05:52 -07:00
Max Sherman 7dd2cd30af Fix Promise resolve callback error
Reviewed By: theoy

Differential Revision: D5032525

fbshipit-source-id: 19680cef70f11cccf2abf03d1c1b7e72ac32e43e
2017-05-09 16:47:34 -07:00
Max Sherman de4d35536d Bump packager's inspector message timeout to 30s
Reviewed By: pakoito

Differential Revision: D5024083

fbshipit-source-id: b80054aa995bbd1008479bdb4da001ffa4ac897d
2017-05-09 14:36:12 -07:00
David Aurelio 8533c0d816 Custom build options: Move transform options into own property
Summary: Moves custom transform options into their own property when returning custom properties. This helps both transitioning to a `select` function as well as implementing RAM bundle support for the new buck integration

Reviewed By: jeanlauliac

Differential Revision: D5028075

fbshipit-source-id: 25fe3072023cc063deef537a12012d4bb3173579
2017-05-09 13:45:46 -07:00
Alexey Lang ffbb2a0ec1 Clean up unused metrics
Reviewed By: AaaChiuuu

Differential Revision: D5020126

fbshipit-source-id: decaa9dd4b2ba5c25eed24a29836a3e7bdba0233
2017-05-09 13:30:26 -07:00
Dan Abramov 074c3cef14 Work around a false positive warning
Summary:
This works around a false positive `isMounted()` deprecation warning when using latest React DevTools and selecting components in the hierarchy.

Before:

![screen shot 2017-05-09 at 7 03 39 pm 1](https://cloud.githubusercontent.com/assets/810438/25865249/3a5cc9e2-34ea-11e7-9930-6d0d8436b390.png)

After:

![screen shot 2017-05-09 at 7 02 54 pm](https://cloud.githubusercontent.com/assets/810438/25865274/4d2d573a-34ea-11e7-8bdd-807e32c54594.png)
Closes https://github.com/facebook/react-native/pull/13873

Reviewed By: bvaughn

Differential Revision: D5029550

Pulled By: gaearon

fbshipit-source-id: cbe941368e8204a335de17ad3d444580aef9d833
2017-05-09 12:38:07 -07:00
Dan Abramov 82fd02a1e2 Add info about inspecting instances to the docs
Summary:
Looks like this:

![](https://d2ppvlu71ri8gs.cloudfront.net/items/1N0X3d3Y2m3E3a1Z3W37/Screen%20Recording%202017-05-09%20at%2003.41%20PM.gif?v=cbf2a26b)
Closes https://github.com/facebook/react-native/pull/13866

Differential Revision: D5028363

Pulled By: gaearon

fbshipit-source-id: a07aecd31446d0361d299c2f7519a280ac2b8815
2017-05-09 12:01:49 -07:00
Dan Abramov 73973e8c56 Update React DevTools integration
Reviewed By: spicyj, bvaughn

Differential Revision: D5028349

fbshipit-source-id: 26cd879de7c530888bf4eab10b7823f24d1d53ec
2017-05-09 11:33:27 -07:00
Vjeran Crnjak 7b7d6bb158 React.podspec fix for RCTAnimation header issue
Summary:
Fixes issue described #13198

Simpler, compared to #13217

Build no longer fails on not being able to find `RCTAnimation/RCTValueAnimatedNode.h`.
Closes https://github.com/facebook/react-native/pull/13785

Differential Revision: D5017734

Pulled By: javache

fbshipit-source-id: e398f74e0fbb1a8f5a43d0a80a4cd3a3587c81b3
2017-05-09 11:17:41 -07:00
David Aurelio 73fc439bc0 Stronger typing for transformers
Reviewed By: jeanlauliac

Differential Revision: D5006679

fbshipit-source-id: 795c60db363fb53bc74697e4befe50995e9b97a7
2017-05-09 08:02:36 -07:00
Hoa Dinh 3dfed2e865 Explicitely export some symbols since they can be referenced from outside that library.
Differential Revision: D5024612

fbshipit-source-id: 6d75ebce9422c879bfc0acdb1159be72756a2f15
2017-05-08 19:48:47 -07:00
Valentin Shergin 712b1dd20a RCTUIManagerObserverCoordinator: new way to subscribe for granular notifications from UI Manager
Reviewed By: majak

Differential Revision: D4868591

fbshipit-source-id: 24a09ffa3e69dec5ce1f0a8715c7e4701d781996
2017-05-08 12:52:09 -07:00
Valentin Shergin 2a984326b0 Introducing `RCTAssertUIManagerQueue()`
Reviewed By: javache

Differential Revision: D4868564

fbshipit-source-id: b9b9f6cf8f31495bb0e82fb60b2402dde460ddb8
2017-05-08 12:52:09 -07:00
Jiajie Zhu bd004568d3 fix warnings in create view
Reviewed By: fred2028

Differential Revision: D5016368

fbshipit-source-id: 60fae5769f66bf94de6fa2fe75a509862270c401
2017-05-08 11:31:21 -07:00
Eric Vicenti 8e6bde30eb Rename UIExplorer in docs
Reviewed By: ericnakagawa

Differential Revision: D5020136

fbshipit-source-id: 2aa35612c35dd4b78760215d91b6d06005033238
2017-05-08 11:31:21 -07:00
Valentin Shergin cf975bbd2e Fixed default placeholder text color for multiline <TextInput>
Reviewed By: javache

Differential Revision: D5018823

fbshipit-source-id: 6ad4a1e8d03b6429a436e0cfdd9a127cd5dc1c2b
2017-05-08 11:31:21 -07:00
Jean Lauliac fbe6d9321e packager: worker-farm: isolate stdout/stderr
Reviewed By: davidaurelio

Differential Revision: D5011034

fbshipit-source-id: 81d3d49156775f9781427d3c103d768ccc30fe20
2017-05-08 11:31:20 -07:00
Dan Abramov 5f04678ee8 Fix Debugging doc
Summary:
My changes in https://github.com/facebook/react-native/pull/13707 assumed RN website works the same way as React website, but this assumption was wrong, so I added invalid markup.

This fixes it, and also moves the images into the website folder so we don't depend on random CDNs.
Closes https://github.com/facebook/react-native/pull/13844

Differential Revision: D5019956

Pulled By: gaearon

fbshipit-source-id: bec40d70997231a73d3ef67c82386bc1bb202d7b
2017-05-08 11:31:20 -07:00
Jean Lauliac 7d6fec0a39 packager: optimize assets' JS
Reviewed By: davidaurelio

Differential Revision: D5010186

fbshipit-source-id: 3c26d8b8792df1dbc24e5200f28f63e017cb0173
2017-05-08 11:31:20 -07:00
Jean Lauliac 2a5959ae6e packager: buck assets: wrap in __d
Reviewed By: davidaurelio

Differential Revision: D5003464

fbshipit-source-id: 59800dded389d133394b60530eb97642d67a5c89
2017-05-08 11:31:20 -07:00
Jean Lauliac e69b81313f packager: ModuleGraph: include all possible asset types
Summary: Afaik. the list of asset types is hardcoded for the Buck worker so far, and I'm not sure how that would be customizable. For now, let's include all the default asset extensions.

Reviewed By: davidaurelio

Differential Revision: D5002607

fbshipit-source-id: 41069e817d2b73156bca684bc2f73077132928a7
2017-05-08 11:31:20 -07:00