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
Summary:
When call `[RCTDevMenu invalidate]`, it will cancel updateTask. But in fact, after the `[updateTask cancel]`, the updateTask's completionHandler will call `checkForUpdates` again, so it will create a new updateTask.
Closes https://github.com/facebook/react-native/pull/6165
Differential Revision: D3669576
Pulled By: javache
fbshipit-source-id: 443924b7f4be1716797fc5690e90d962cf31b923
Summary:
The animation shown in the UIExplorer example for NavigationExperimental's NavigationHeader is not working correctly. Due to an incomplete use of the `renderTitleComponent()` callback, interpolation is not working correctly in this example.
Even if the animation error is subtle, since the examples are followed by developers quite closely, the bug may multiply if not corrected in the sample code.
This is a really *tiny* modification that fixes that particular animation.
Closes https://github.com/facebook/react-native/pull/9067
Differential Revision: D3669140
Pulled By: javache
fbshipit-source-id: 6dab36a9132da2f704e9a074ae26e744c3420cde
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:
> **Unless you are a React Native release maintainer and cherry-picking an *existing* commit into a current release, ensure your pull request is targeting the `master` React Native branch.**
(You can skip this if you're fixing a typo or adding an app to the Showcase.)
Explain the **motivation** for making this change. What existing problem does the pull request solve?
Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.
**Test plan (required)**
Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.
Make sure tests pass on both Travis and Circle CI.
**Code formatting**
Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/face
Closes https://github.com/facebook/react-native/pull/8999
Differential Revision: D3664512
Pulled By: javache
fbshipit-source-id: 030fe4752e53efcde21baadfc2502413b7fc9c8c
Summary:
We've been getting a lot of documentation PRs opened against `0.29-stable`, `0.30-stable`, and so on, instead of `master`. This is because our doc site is also based on RN release cuts, so clicking on the "Edit on GitHub" links on a document will take you to the markdown source for that release branch instead of the latest doc on `master`.
See #9095 for an example of such a PR.
In this PR we edit the link to say View on GitHub. Though it may not prevent PRs from being opened against a release branch, removing the "Edit" CTA may help in this regard.
Closes https://github.com/facebook/react-native/pull/9149
Differential Revision: D3664368
Pulled By: vjeux
fbshipit-source-id: 395c0813f736bfbe1be4b4fb1182f9060169365d
Summary:
Because it is react, the url could be changed on redirection or some other ways.
The iOS version's WebView has controled that on [here](https://github.com/facebook/react-native/blob/master/React/Views/RCTWebView.m#L106).
But the Android's one is not.
Check the url is same with privous url. If it is true, cancel loading.
This logic is same with iOS's.
the ```method``` hasn't compared.
Test urls as we can.
The Google Map(https://map.google.com) was one of the site which has occur error before this commit.
related issue : #9121
Closes https://github.com/facebook/react-native/pull/9126
Differential Revision: D3663685
Pulled By: javache
fbshipit-source-id: f38c9012ee077677543dafcea83c0778a4471bfa
Summary:
JoelMarcey requested that I make this PR based on [my comment](7ac931ee9b (commitcomment-18270206)).
I have signed the CLA.
However I was unable to verify that the site builds with this change. It looks okay in my markdown editor, but when following the contributor docs and running `npm install && npm start`, I get the following error when hitting node in my browser:
```
error in renderAPI for ../node_modules/react/lib/NativeMethodsMixin.js
Error: ENOENT: no such file or directory, open '../node_modules/react/lib/NativeMethodsMixin.js'
at Error (native)
at Object.fs.openSync (fs.js:634:18)
at Object.fs.readFileSync (fs.js:502:33)
at renderAPI (/Users/eliot/Dev/react/react-native/website/server/extractDocs.js:439:28)
at concat.apis.map (/Users/eliot/Dev/react/react-native/website/server/extractDocs.js:601:14)
at Array.map (native)
at module.exports (/Users/eliot/Dev/react/react-native/websit
Closes https://github.com/facebook/react-native/pull/9107
Differential Revision: D3664102
Pulled By: JoelMarcey
fbshipit-source-id: 845917351ba9d3d2f5351a8f926757718c806025
Summary:
The docs heavily implied that this method returned a notification object or null directly, like popInitialNotification used to do. In fact, it returns a promise. This change clarifies this.
Note that:
- This is purely a comment change, so no testing required.
- I've adhered to the 80 character line limit, and can't think of any other style rules you might have that could apply here.
Closes https://github.com/facebook/react-native/pull/9052
Differential Revision: D3662807
Pulled By: javache
fbshipit-source-id: 7a2573e03d7704b2d62a3499d350506ae73e8d77
Summary:
I believe it is beneficial to explicitly state that this is possible.
Closes https://github.com/facebook/react-native/pull/8543
Differential Revision: D3663264
Pulled By: hramos
fbshipit-source-id: cb95e31d8c1d2d38929dac3e3bfda26aa6054a11
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?
Example code for "Using Navigators" under "THE BASICS" does not work. renderScene needs to return the components, not just instantiate them.
**Test plan (required)**
I copy-paste and ran the code but did not get anything rendered. I added a return statement before the component which made it work.
Arrow functions need a return statement when supplying a { block of code }.
Closes https://github.com/facebook/react-native/pull/9161
Differential Revision: D3663200
Pulled By: hramos
fbshipit-source-id: a8732dd1098de7c8ea915f459adb3403a8168f19
Summary:
The issue here is that sometimes `this.options()` is not `[options]` but contains different stuff, esp. if your command accepts arguments.
This commit reverts its original behaviour and passes custom `examples` property that we use instead.
Tested, can be shipped right away.
Differential Revision: D3662179
fbshipit-source-id: 4b2af3487464d46e2007388230e675ce3575f797
Summary:
The examples: 2048 and TicTacToe will display errors when click the run on Xcode. I imported RCTNetwork and RCTImage for 2048 and RCTNetwork for TicTacToe and it works on the simulator.
Closes https://github.com/facebook/react-native/pull/9123
Differential Revision: D3662099
Pulled By: javache
fbshipit-source-id: 2e2d88336ea83eae58088f4cc1d5003ba2a2f71b
Summary:
Sometimes is handy to check if a React node is a descendant of another node or not. For instance, I want to check if the focused `TextInput` is descendant of an specific `ScrollView`:
```js
const currentlyFocusedField = TextInput.State.currentlyFocusedField()
UIManager.viewIsAncestorOf(
currentlyFocusedField,
this.getInnerViewNode(),
(isAncestor) => {
if (isAncestor) {
console.log('The focused field is a descendant of this ScrollView!')
}
}
)
```
This function uses the same strategy as the `measureLayout` method to check if one node is an ancestor of other node. As the `measureLayout` method, this is performed outside the main thread.
By now I've only implemented the iOS version and its tests, but if this function is going to be merged I'll implement the Android version too. I have objc experience but no Java or Android, so I prefer to validate this functionality before jumping into developing the Android part.
Closes https://github.com/facebook/react-native/pull/7876
Differential Revision: D3662045
Pulled By: javache
fbshipit-source-id: b9668e8ea94fd01db76651f16243926cf9c2566f
Summary:
When compiling 0.31-rc1 was having issues with xcode running the package script and failing (ie not running and returning the --help info) Was due to this - simply changing the flag to --reset-cache instead of --reset-cache true worked miracles.
**Test plan (required)**
Ran packager without and runs but doesn't build the package, runs with small change and works now. Can copy paste output if you want but it's pretty super verbose for this small change.
Closes https://github.com/facebook/react-native/pull/9177
Differential Revision: D3661831
fbshipit-source-id: 3cebc543806b8fe3e413f83c59c9fb74e5e078f4
Summary:
Prior to the RNPM integration, command names would match the second argument passed to the react-native-cli. Now the command names contain some usage information (such as non-flag CLI arguments). This commit splits the name of the commands and checks that against the second command line argument.
Closes https://github.com/facebook/react-native/pull/9171
Differential Revision: D3661799
fbshipit-source-id: dc2aa9cd9e69dde3c5b877aeb77a17c4f6427075
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
Summary:
**This is the first part of `React.createClass` -> ES2015 classes migration.
1. Rewritten UI Explorer ActivityIndicator example to ES2015 classes
2. Removed TimerMixin from example.
Motivation:
- ES2015 classes do not support mixins so due to the classes / pure functions as "best practices" it would be better to avoid mixins in examples.
- TimerMixin is covered later and is out of scope of current example.
Closes https://github.com/facebook/react-native/pull/8342
Differential Revision: D3659349
fbshipit-source-id: e1c6f1a3091d60c589303fe6da55b8d132adedc3
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:
> **Unless you are a React Native release maintainer and cherry-picking an *existing* commit into a current release, ensure your pull request is targeting the `master` React Native branch.**
(You can skip this if you're fixing a typo or adding an app to the Showcase.)
Explain the **motivation** for making this change. What existing problem does the pull request solve?
Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.
**Test plan (required)**
Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.
Make sure tests pass on both Travis and Circle CI.
**Code formatting**
Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/face
Closes https://github.com/facebook/react-native/pull/9175
Differential Revision: D3658765
Pulled By: hramos
fbshipit-source-id: bc8a37fdd6393a2107b33c9fd1b8620cb5a7c07c
Summary:
This diff addresses the issues raised by kmagiera in https://github.com/facebook/react-native/pull/7884. Transforms should be applied in the order they are defined, just like in `processTransform.js`. A scale applied before a translation, for instance, should give a different result than a translation applied before a scale.
We leverage CATransform3D to do the heavy lifting. A concatenated transform is passed all the way to `RCTViewPropertyMapper`. It is compared with the transform currently applied to the view, and if different, applied. The same approach is used for opacity.
I think it makes the most sense to do this diffing in `RCTViewPropertyMapper`, as opposed to creating and cleaning up an `_updatedPropsDictionary` each frame in `RCTTransformAnimatedNode` and `RCTStyleAnimatedNode`. The node should keep its full value; applying a minimal set of altered props is an optimization. The higher up this optimization is implemented, the more assumptions it makes. e.g. that there will only ever be a sing
Closes https://github.com/facebook/react-native/pull/9050
Differential Revision: D3658139
fbshipit-source-id: ad6286762ef734084cbdf83c9bd9241190302d34
Summary:
The logic in `setRtl` is wrong. You would expect that `{rtl: true}` would set the layout direction to RTL, instead it currently does the opposite.
This commit fixes the issue.
Closes https://github.com/facebook/react-native/pull/9132
Differential Revision: D3657134
fbshipit-source-id: f946698b548988541de7da5565d2ab122746ecf0
Summary:
cc Kureev
Disabling symlink resolver temporarily because it breaks launchPackager.command.
Waiting for a PR with a fix to enable both
Closes https://github.com/facebook/react-native/pull/9166
Differential Revision: D3655846
Pulled By: matryoshcow
fbshipit-source-id: da0bfc64f5fd9d747db2b97d669fcb98250faf39