Summary:Hi,
I am using https://github.com/aksonov/react-native-router-flux / https://github.com/exponentjs/ex-navigator and I needed a way to update my redux store with the current route.
I'm using the navigation context to do this:
```javascript
if (navigationContext) {
const handler = () => {
updateCurrentRouteState(navigationContext.currentRoute);
};
navigationContext.addListener('willfocus', handler);
navigationContext.addListener('didfocus', handler);
}
```
However, when the whole stack is replaced, no event is emitted. This PR aims to fix that.
Closes https://github.com/facebook/react-native/pull/5596
Differential Revision: D3080004
Pulled By: ericvicenti
fb-gh-sync-id: 0ef4ecebec7076275b6433c80aae6102cf28c039
shipit-source-id: 0ef4ecebec7076275b6433c80aae6102cf28c039
Summary:Changing app state back to 'background' for UIApplicationWillEnterForegroundNotification.
On iOS we use the 'background' app state to determine whether a notification was tapped to foreground the app vs. received while app was already active. The PR https://github.com/facebook/react-native/pull/6379 changed RCTAppState so that it returned 'active' when app was being foregrounded from a notification; this changes it back to 'background' so that we can distinguish between the two cases again
Reviewed By: hedgerwang
Differential Revision: D3078746
fb-gh-sync-id: 8b5e9118a7e14f15871bfb68e9f85d20108b1faf
shipit-source-id: 8b5e9118a7e14f15871bfb68e9f85d20108b1faf
Summary:Run `Toast.makeText` other than UI Thread will cause bug #5599 : toast doesn't disappear after app exited.
use `UiThreadUtil.runOnUiThread` to fix this.
Closes https://github.com/facebook/react-native/pull/6443
Differential Revision: D3047261
fb-gh-sync-id: 0096879f2a4b4d76bda996a32089f068ae68e3f3
shipit-source-id: 0096879f2a4b4d76bda996a32089f068ae68e3f3
Summary:We recently refactor the packager to transform the module names into numeric IDs but we forgot to update the HMR call site. As a consequence, HMR doesn't work the first time a file is saved but the second one.
This is affecting master as of 3/20. If we don't land this before v0.23 is cut we'll have to cherry pick it. This rev does *not* need to be picked on v0.22.
Reviewed By: bestander
Differential Revision: D3075192
fb-gh-sync-id: 410e4bf8f937c0cdb8f2b462dd36f928a24e8aa8
shipit-source-id: 410e4bf8f937c0cdb8f2b462dd36f928a24e8aa8
Summary: When I first did Modal on Android, I incorrectly set the styleWidth and styleHeight on the ModalHostShadowNode. This corresponded to RCTModalHostView in Modal.js. This node is actually really just a dummy node in the tree. The proper node to set the width and height on is the inner <View/> that has top and left position set on it. This updates the code to set the width and height on that inner node.
Reviewed By: mkonicek
Differential Revision: D3077415
fb-gh-sync-id: e9aee0a21333ed0b5bdde11f453381b0a13470c9
shipit-source-id: e9aee0a21333ed0b5bdde11f453381b0a13470c9
Summary:This adds support for source maps that can be used for “random access modules” / “unbundles”
- source maps contain an extra custom field: `x_facebook_offsets`
- this field maps module IDs to line offsets
- the source map is built as if all files were concatenated
Decoding/symbolication works as follows:
- when decoding a stack trace, and a stack frame comes from a filename that contains only numbers and ends with `.js`, look up the additionally needed line offset in the offset map and add it to the original line of the stack frame.
- consume the source map as usual
Reviewed By: martinbigio
Differential Revision: D3072426
fb-gh-sync-id: 827e6dc13b1959f02903baafa7f9e4fc2e0d4bb9
shipit-source-id: 827e6dc13b1959f02903baafa7f9e4fc2e0d4bb9
Summary:Same as d87d127 but for gradle. It will help to prevent installing global `react-native-cli` (more simple CI server configuration for ex.)
Tested on Linux and Windows.
Closes https://github.com/facebook/react-native/pull/6272
Differential Revision: D3076101
Pulled By: foghina
fb-gh-sync-id: 89c3870536b1ce3fdbb909909b887f3ce68b2951
shipit-source-id: 89c3870536b1ce3fdbb909909b887f3ce68b2951
Summary:This change adds the `flow/` folder to the generated `.flowconfig` in new/upgraded projects. The absence of this folder was causing flow bugs to appear in projects consuming react-native that weren't visible in react-native itself. By including the same definition in consuming projects these errors disappear. Fixes https://github.com/facebook/react-native/issues/6428.
**Test plan (required)**
Tested `react-native upgrade` with this change and ensured that the generated `.flowconfig` works and didn't throw flow errors.
Closes https://github.com/facebook/react-native/pull/6430
Differential Revision: D3071701
fb-gh-sync-id: f28f4d8f7e63669386766b6f226144adeda32c85
shipit-source-id: f28f4d8f7e63669386766b6f226144adeda32c85
Summary:It didn't work for a few reason. First, the drawer view NEEDS to have a background color or no shadow will ever render. Second, we need to use the `setDrawerElevation` method instead of `setElevation` for DrawerLayout. Finally we need to actually pass the style value (maybe we could just pass elevation but I don't really think it can cause any issues) down to the native component as it is not the case at the moment.
I also added a default style to elevation of 16 which is the standard for material design according to https://www.google.com/design/spec/patterns/navigation-drawer.html#navigation-drawer-specs. I could also default it to 0 so it keeps the same appearance as before but I think it looks better this way.
Closes#6022
**Test plan**
Tested using the DrawerLayout in the UIExplorer app.
Before, elevation 0
<img width="420" alt="screen shot 2016-02-23 at 1 55 42 am" src="https://cloud.githubusercontent.com/assets/2677334/13244000/008afdb2-d9d1-11e5-95b8-9c345ea0ea8d.png">
After, elevation
Closes https://github.com/facebook/react-native/pull/6100
Reviewed By: bestander
Differential Revision: D3012242
Pulled By: lexs
fb-gh-sync-id: 4967d7ec920f0229d823032ba95c8a3cace329c6
shipit-source-id: 4967d7ec920f0229d823032ba95c8a3cace329c6
Summary:Since #5422 react-native works with strict mode modules but the transform was not updated since Facebook has some non strict mode compatible internal modules. Now that #5214 has landed and it is easy to change the babel config I think we should enable it by default to make es2015 modules spec compliant.
Someone at Facebook will have to make the internal changes necessary to disable strict mode modules for their projects that use non strict mode compatible modules by including a .babelrc file with
``` json
{
"presets": [
"react-native"
],
"plugins": [
["transform-es2015-modules-commonjs", { "strict": false, "allowTopLevelThis": true }]
]
}
```
before merging this.
We might also want to mention this in the breaking change section for the next release.
Closes https://github.com/facebook/react-native/pull/5796
Differential Revision: D3075802
fb-gh-sync-id: e807b67401107e1e944db38453e254025ce0a6c7
shipit-source-id: e807b67401107e1e944db38453e254025ce0a6c7
Summary:It was hard to understand which parts of the shadowview API are designed to be called only on the root view, and which were applicable to any view.
This diff extracts rootview-specific logic out into a new RCTRootShadowView class.
Reviewed By: majak
Differential Revision: D3063905
fb-gh-sync-id: ef890cddfd7625fbd4bf5454314b441acdb03ac8
shipit-source-id: ef890cddfd7625fbd4bf5454314b441acdb03ac8
Summary:The local-cli didn't pickup the `rn-cli.config.js` file on Windows because the root of a path is not 1 character long since it is 'C:/' and broke the path operations. This just substrings the root length instead of hard coding 1.
Also fix a lint warning in the file about path concatenation but using string interpolation.
Fixes #5686
**Test plan (required)**
Tested that the `findParentDirectory` function returns the path of `rn-cli.config.js` if present or null if not on both windows and mac.
Closes https://github.com/facebook/react-native/pull/6553
Differential Revision: D3075196
Pulled By: mkonicek
fb-gh-sync-id: a19ab4030ec22d85bef40d7d91de53bc1da072ca
shipit-source-id: a19ab4030ec22d85bef40d7d91de53bc1da072ca
Summary:Updating the comments to clarify that the selectedIndex prop is not just for pre-selecting an index, but that it can also be used to programmatically change the value of the selected index.
Closes https://github.com/facebook/react-native/pull/6519
Differential Revision: D3075199
Pulled By: mkonicek
fb-gh-sync-id: 8ce336ad491bb2fed13df15ebddb1b24535c50ff
shipit-source-id: 8ce336ad491bb2fed13df15ebddb1b24535c50ff
Summary:The docs for touchEvents was really unclear and assumed that you know what `pointer-events` does in CSS. This is confusing especially for native developers, see [this issue](http://stackoverflow.com/questions/36068392/set-userinteractionenabled-false-in-react-native/36096413) on stack overflow.
I added a short description to the prop and all the possible enum values and made it so the comment that explain why it is a prop and not a style doesn't appear on the website as it is not really relevant there.
**Test plan (required)**
Tested by running the website locally.
Closes https://github.com/facebook/react-native/pull/6534
Differential Revision: D3075198
Pulled By: mkonicek
fb-gh-sync-id: 57c8444fc83a31599dc872c361b142531cdd4885
shipit-source-id: 57c8444fc83a31599dc872c361b142531cdd4885
Summary:Sourcemaps on HMR where a couple of line off. The problem is that since the `__accept` call doesn't go through the sourcemaps pipeline we need to make sure that call is a single-line one.
This was originally written in a single line but I incorrectly updated it on 436db67126. Would be great having test coverage for this.
Reviewed By: davidaurelio
Differential Revision: D3075164
fb-gh-sync-id: c77ea99f26bdd675f241c5d20a620eb4ddfbf701
shipit-source-id: c77ea99f26bdd675f241c5d20a620eb4ddfbf701
Summary:Including author's name makes the replies more personalized.
Closes https://github.com/facebook/react-native/pull/6545
Differential Revision: D3074715
Pulled By: mkonicek
fb-gh-sync-id: ac21ddc2c2864585c3a16ad0be7619ba432831b3
shipit-source-id: ac21ddc2c2864585c3a16ad0be7619ba432831b3
Summary:Helps for suckers like me, who copy and paste example code ;)
Closes https://github.com/facebook/react-native/pull/5133
Differential Revision: D3074849
Pulled By: mkonicek
fb-gh-sync-id: 8311dc26b173e341433866f66db374464c3c9f63
shipit-source-id: 8311dc26b173e341433866f66db374464c3c9f63
Summary:The docs indicated that a higher number was more accurate, however based on the implementation:
```
/**
* TODO: this logic looks wrong, and it may be because it is. Currently, if _scrollEventThrottle
* is set to zero (the default), the "didScroll" event is only sent once per scroll, instead of repeatedly
* while scrolling as expected. However, if you "fix" that bug, ScrollView will generate repeated
* warnings, and behave strangely (ListView works fine however), so don't fix it unless you fix that too!
*/
if (_allowNextScrollNoMatterWhat ||
(_scrollEventThrottle > 0 && _scrollEventThrottle < (now - _lastScrollDispatchTime)))
```
https://github.com/facebook/react-native/blob/master/React/Views/RCTScrollView.m#L564
It appears that only 0 is a special case here, and perhaps a known issue ;)
Closes https://github.com/facebook/react-native/pull/3729
Differential Revision: D3074801
Pulled By: mkonicek
fb-gh-sync-id: f63b00755f7565165cc628085efa5ed96badcfe1
shipit-source-id: f63b00755f7565165cc628085efa5ed96badcfe1
Summary:Adds a `center` option to `Image`'s `resizeMode` prop, which doesn't enlarge images.
This is how it looks in UIExplorer:
{F60386921}
Reviewed By: dmmiller
Differential Revision: D3064284
fb-gh-sync-id: 79cd2da8f44c5b3da2e42d3bebf3131335f53c28
shipit-source-id: 79cd2da8f44c5b3da2e42d3bebf3131335f53c28
Summary:Explain the **motivation** for making this change. What existing problem does the pull request solve?
> When vjeux [asked me how the documentation changes looked](https://github.com/facebook/react-native/pull/6423#issuecomment-195608638), it wasn't obvious to me how to build and view them locally. So, I thought it might be a good idea to add instructions to the contributing document.
I was able to run the website locally when working on PR #6423 but am no longer able to now. I have since updated my local repo with a `git pull`. I've deleted the node_modules directories in both the root and website folders, rebuilding both. Still, I get the following error when I run `npm start` within the website directory (problem with the ES2015 compiling?)...
```bash
**/react-native/website/server/convert.js:134
.filter(key => key.startsWith('RN_'))
^^
SyntaxError: Unexpected token =>
at exports.runInThisContext (vm.js:73:16)
at Module._compile (
Closes https://github.com/facebook/react-native/pull/6510
Differential Revision: D3070560
Pulled By: vjeux
fb-gh-sync-id: 6d200bb545d0ce357500cd666dd400ec82fafa92
shipit-source-id: 6d200bb545d0ce357500cd666dd400ec82fafa92
Summary:Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:
(You can skip this if you're fixing a typo or adding an app to the Showcase.)
Updating Show Case
Closes https://github.com/facebook/react-native/pull/6526
Differential Revision: D3070014
fb-gh-sync-id: b3357fac9d810a095e8da5180dd2b387253fa1c9
shipit-source-id: b3357fac9d810a095e8da5180dd2b387253fa1c9