Commit Graph

269 Commits

Author SHA1 Message Date
Hedger Wang fb5d0ff587 D3321403 [NavigationExperimental][CleanUp]: Rename `scene.navigationState` to `scene.route`.
Summary:
[public / experimental API breaking change]

The data type of  `scene.navigationState` is `NavigationRoute`. Rename  `scene.navigationState` to
`scene.route` to avoid confusion such as treating `scene.navigationState` as the actual global navigation
state (type: NavigationState).

Reviewed By: ericvicenti

Differential Revision: D3331076

fbshipit-source-id: 3ed989cc8492d398cbeb1b12186459deb261d1fb
2016-05-20 18:13:30 -07:00
Hedger Wang 807726bcb4 Rename `NavigationState` to `NavigationRoute`, rename `NavigationParentState` to `NavigationState`.
Summary:
This is the first step to clarify and simplify the type definations about navigation state.
For now,  `NavigationParentState` is actually used as the real navigation state and `NavigationState` is used
as a route in navigation, which has been confusion among the APIs.

To be clear, our APIs has no intention and interest in dealing with nested or hierarchical navigation states,
and we should avoid have the name like `ParentState` or `children`.

To fully migrate the types, theer will be a lot of code changes and this is just the first step to rename.

= What's Next?

1. rename `navigationState.children` to `navigationState.routes` (breaking change!)
2. remove `navigationState.key` from its type defination.

Reviewed By: ericvicenti

Differential Revision: D3321403

fbshipit-source-id: 3e39b60f736c1135bc85d8bf2b89027d665e28d4
2016-05-20 14:28:35 -07:00
dmueller39 0aea74ebea Fixed incorrect rows reported in onChangeVisibleRows
Summary:
There is a bug in onChangeVisibleRows when the renderSeparator is not null. The _updateVisibleRows function does not account for the presence of separator frames in the  _childFrames array.

When renderSeparator is not null, increment the totalIndex an additional
time for each row that isn't the last in its section, or the last in the entire
list.

This continues a slightly brittle precedent of having a set of parallel conditions in render and _updateVisibleRows. (i.e. renderSectionHeader is used in both functions, in render as a condition to create a sectionHeader, and in _updateVisibleRows as a condition to increment the totalIndex.

Before change:
![yeeqnmvmif](https://cloud.githubusercontent.com/assets/9422359/14515342/38543952-01c7-11e6-984c-7c1a3fc3d820.gif)

After change:
![gzbrljclzm](https://cloud.githubusercontent.com/assets/9422359/14515340/3296e294-01c7-11e6-8ae9-1ad313600956.gif)

Built using https://gist.github.com/dmueller39/f95028f6fe8bd251944bb604e51f18b2
Closes https://github.com/facebook/react-native/pull/6965

Differential Revision: D3328001

Pulled By: vjeux

fbshipit-source-id: 977e54382ee07be7a432a54febafcae6acaae905
2016-05-20 08:13:23 -07:00
Joe Noon 0e997c6eab fixes a bug where NavigationPropTypes.SceneRenderer was a plain object
Summary:
... used as both a shape and plain object.

this splits them out so both parts can be used as needed.

NavigationPropTypes.SceneRenderer is a PropTypes shape
NavigationPropTypes.SceneRendererProps is the plain object that makes up the shape.
Closes https://github.com/facebook/react-native/pull/7518

Differential Revision: D3317322

Pulled By: ericvicenti

fbshipit-source-id: e8a31e05130e6647b63f68dbef31bc874550948c
2016-05-18 13:13:29 -07:00
Yu Huang 34907c3810 Fix List View _updateVisibleRows firing for all row component at view loading time issue
Summary:
Sometimes list view row components(even the ones unseen) have a frame but its x and y is 0 or uninitialized at view loading time, which will lead to _updateVisibleRows firing for all the row components incorrectly at loading time.
This is to make the code more defensive.

Reviewed By: sahrens

Differential Revision: D3308515

fbshipit-source-id: 0e30fdf10345629bfd9de3fe0ad641bb1903fe00
2016-05-16 18:28:21 -07:00
Naman Goel 1673e00e2b correct flow types
Summary:
The function should have optional arguments, but not nullable types.
Closes https://github.com/facebook/react-native/pull/7580

Differential Revision: D3304994

Pulled By: davidaurelio

fbshipit-source-id: 9918817429126ea16dd3076b61a3493c3a3a8388
2016-05-16 07:58:26 -07:00
Hedger Wang 8975bb8e70 `didFocus` event should fired after transition finishes.
Summary:
For now, we emit `didFocus` event before fully resetting the transition and
hiding the stale scenes, so handler for `didFocus` event does not get the right
scenes in place. We should emit the didFocus event after resetting the transition and
hiding the stale scenes.

Reviewed By: ericvicenti

Differential Revision: D3299002

fbshipit-source-id: 6a79528097aabc4f61d4dba322820c228c889a84
2016-05-13 12:58:24 -07:00
Eric Vicenti 14eb427a80 Kill NavigationExperimental Containers
Summary:
The containers in NavigationExperimental are not appropraite because the state should be held by the app's architecture, be it redux, flux, or simple component state.

This diff moves the examples over to simple component state, but there are several other examples of how to use NavigationAnimatedView and the navigation reducers with redux:

- https://github.com/jlyman/RN-NavigationExperimental-Redux-Example
- Switching the f8 app with redux to navigation experimental: https://github.com/fbsamples/f8app/pull/14

Reviewed By: hedgerwang

Differential Revision: D3219911

fb-gh-sync-id: eb0b323e2c165c32027fbd00dc6197ad441d6552
fbshipit-source-id: eb0b323e2c165c32027fbd00dc6197ad441d6552
2016-05-05 16:52:19 -07:00
Sebastian Gronewold 07767e86a3 Navigator - velocity override
Summary:
This code change allows changing the transition velocity of the navigator
when switching views.

Whats the use case? If you have different types of
animations your animations might also need different transition velocities.
Closes https://github.com/facebook/react-native/pull/5439

Differential Revision: D3264719

Pulled By: ericvicenti

fb-gh-sync-id: 1bc0a1191ed3bd51b624acd161c3ee77fd748d72
fbshipit-source-id: 1bc0a1191ed3bd51b624acd161c3ee77fd748d72
2016-05-05 15:06:47 -07:00
Hedger Wang b1cd1cba32 Fix propType check for NavigationCard.
Summary:
the prop type check for NavigationCard -> SceneView -> sceneRendererProps is wrong.
Fix it.

Reviewed By: ericvicenti

Differential Revision: D3265049

fb-gh-sync-id: 16e89c932f0f962db4b6a647d62d255ba98f6156
fbshipit-source-id: 16e89c932f0f962db4b6a647d62d255ba98f6156
2016-05-05 11:39:29 -07:00
Hedger Wang ef44781f3d Kill NavigationLegacyNavigator.
Summary:
NavigationLegacyNavigator was originally created to help people to migrate to the new
navigation library without API changes. Therefore we'd have to port all the old APIs that
don't necessarily seem align well with the new navigation library.

Consider the production usage of NavigationLegacyNavigator does not exist, it's better
to kill it and we'd just rename the `Navigator` to `NavigatorDeprecated` later instead.

Reviewed By: ericvicenti

Differential Revision: D3263704

fb-gh-sync-id: a851fda1516d694cb7d119f5a1344f8fc676f7fd
fbshipit-source-id: a851fda1516d694cb7d119f5a1344f8fc676f7fd
2016-05-05 10:56:41 -07:00
Chris Geirman a26afd2d73 clarify highlightRow usage with UIExplorer example
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

> From the existing documentation, it's not clear how one would make use of the highlightRow attribute of ListView.renderRow. Special thanks to halilb for his assistance.

Example: When "Adding a function to do X", explain why it is necessary to have a way to do X.

**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.

> Here's a screenshot of the UIExplorer with a row highlighted (using the FB Blue Color)
> <img width="466" alt="2016-03-16_1944" src="https://cloud.githubusercontent.com/assets/1640318/13835020/49b5b38c-ebb1-11e5-98fa-17201fd3db92.png">

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/facebook/react-native/blob/master/CONTRIBUTIN
Closes https://github.com/facebook/react-native/pull/6495

Differential Revision: D3264092

Pulled By: nicklockwood

fb-gh-sync-id: 9608e8a66387f527b872928a3595ca4d17736b82
fbshipit-source-id: 9608e8a66387f527b872928a3595ca4d17736b82
2016-05-05 03:43:47 -07:00
Eric Vicenti bb39a2e9da Reduce extra rendering in NavigationCard
Summary: This adds a new SceneView with a shouldComponentUpdate policy of only re-rendering when the scene's state changes. This allows avoidance of extra re-renders. Results in a much smoother back-swipe gesture because we no longer re-render scenes as we transition from gesture to animation.

Reviewed By: hedgerwang

Differential Revision: D3219545

fb-gh-sync-id: 7c04e0e4ebb40d1e57ef7af11e2e54adf4f52aa0
fbshipit-source-id: 7c04e0e4ebb40d1e57ef7af11e2e54adf4f52aa0
2016-05-03 13:31:18 -07:00
Hedger Wang 8ac03077c9 better way to manage pointerEvents for NavigationCard.
Reviewed By: fkgozali

Differential Revision: D3250602

fb-gh-sync-id: 6b20d283f8854d0e137800c37595fc014a78e338
fbshipit-source-id: 6b20d283f8854d0e137800c37595fc014a78e338
2016-05-02 19:17:24 -07:00
Jason Prado 79c5322233 Reverted commit D3205106
Summary:
THis addresses the issue as reported at
https://github.com/facebook/react-native/issues/6732

Use a higher order component `NavigationPointerEventsContainer` to manager the
prop `pointerEvents` for `NavigationCard`.

The idea is that the scene's content should not be interactive while the scene is
transitioning.

Reviewed By: ericvicenti

Differential Revision: D3205106

fb-gh-sync-id: db7172941155f34447495199d2c029f5c7e75f30
fbshipit-source-id: db7172941155f34447495199d2c029f5c7e75f30
2016-05-02 14:22:30 -07:00
Hedger Wang 5966ccbcad better way to manage pointerEvents for NavigationCard.
Summary:
THis addresses the issue as reported at
https://github.com/facebook/react-native/issues/6732

Use a higher order component `NavigationPointerEventsContainer` to manager the
prop `pointerEvents` for `NavigationCard`.

The idea is that the scene's content should not be interactive while the scene is
transitioning.

Reviewed By: ericvicenti

Differential Revision: D3205106

fb-gh-sync-id: c0fd22e8c8b83a5952351c5a3a302b2fca5ba5de
fbshipit-source-id: c0fd22e8c8b83a5952351c5a3a302b2fca5ba5de
2016-05-02 12:57:23 -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
Konstantin Raev 2eef115161 Revert "Add subviewStyle prop to NavigationHeader"
Summary:
This reverts commit 1dc82a9e5f.

Breaks OSS tests
Closes https://github.com/facebook/react-native/pull/7232

Differential Revision: D3223972

Pulled By: bestander

fb-gh-sync-id: fea7ec4a1c13d328a7bbda9fcd3f201a7007081e
fbshipit-source-id: fea7ec4a1c13d328a7bbda9fcd3f201a7007081e
2016-04-26 06:10:24 -07:00
Hedger Wang 24f44558f6 Fix initial scenes rendering for NavigationPagerStyleInterpolator
Summary:
The initial layout used to render scenes does not contain the actual
width and height measured and causes the issue as described at
https://github.com/ericvicenti/navigation-rfc/issues/61

The fix is to update the layout and re-render scenes once layout
is modified. Also scenes renderer should also consider the case that
when the layout is not measured yet.

Reviewed By: ericvicenti

Differential Revision: D3203245

fb-gh-sync-id: 4de89b9b43bc993d7c970c831458bd31c094073e
fbshipit-source-id: 4de89b9b43bc993d7c970c831458bd31c094073e
2016-04-25 15:37:38 -07:00
Christian Meunier 1dc82a9e5f Add subviewStyle prop to NavigationHeader
Summary:
Implements: #7204

Pinging ericvicenti for review.
Closes https://github.com/facebook/react-native/pull/7214

Differential Revision: D3219306

Pulled By: ericvicenti

fb-gh-sync-id: becd1dada2557b7fb2c345bac2098094fa6d2144
fbshipit-source-id: becd1dada2557b7fb2c345bac2098094fa6d2144
2016-04-25 10:12:25 -07:00
Mike Grabowski 7102fd079a Document ListView.DataSource #410
Summary:Fixes #410
Closes https://github.com/facebook/react-native/pull/7193

Differential Revision: D3217718

fb-gh-sync-id: c05c9e3d67863c064f8e1102090614c6ba7e3127
fbshipit-source-id: c05c9e3d67863c064f8e1102090614c6ba7e3127
2016-04-24 08:13:21 -07:00
glevi@fb.com 91d4a093ea Fix or suppress errors in react-native
Reviewed By: jeffmo

Differential Revision: D3209973

fb-gh-sync-id: bdc9b4afc0b187b1b16fa6bfb1c34adb4089ab81
fbshipit-source-id: bdc9b4afc0b187b1b16fa6bfb1c34adb4089ab81
2016-04-21 19:47:24 -07:00
Hedger Wang 81c62c5f41 Fix initial scenes rendering.
Summary:The initial layout used to render scenes does not contain the actual
width and height measured and causes the issue as described at
https://github.com/ericvicenti/navigation-rfc/issues/61

The fix is to update the layout and re-render scenes once layout
is modified. Also scenes renderer should also consider the case that
when the layout is not measured yet.

Reviewed By: ericvicenti

Differential Revision: D3162143

fb-gh-sync-id: 197574329d3849cad2a21e07e1bd5e800f74c3ea
fbshipit-source-id: 197574329d3849cad2a21e07e1bd5e800f74c3ea
2016-04-19 15:57:20 -07:00
Tomasz Netczuk 9a82c03e1f Navigator.SceneConfigs.PushFromRight similar to native iOS animation.
Summary:The animation looks ok now.

However, the original iOS navigator adds transparent overlay and shadow. Any idea how to implement it? I'd like to add it.
Closes https://github.com/facebook/react-native/pull/5061

Differential Revision: D3129246

Pulled By: ericvicenti

fb-gh-sync-id: ee86261a49ea4b8f6854abf69bef3ebfd6878852
fbshipit-source-id: ee86261a49ea4b8f6854abf69bef3ebfd6878852
2016-04-15 18:23:29 -07:00
James Ide eaba2abc0b Use function refs and support composed refs
Summary:Fixes an issue where if you implement `renderScrollComponent` and have a `ref` callback on the returned element, the ref used to be clobbered by the ref that ListView adds to the element.

This is accomplished by converting the ref from a legacy string-based ref to a callback-based ref, and then using `cloneReferencedElement`, which is a simple utility to compose callback refs.
Closes https://github.com/facebook/react-native/pull/6441

Differential Revision: D3064250

Pulled By: mkonicek

fb-gh-sync-id: 2d55d04e2144a1cc08900a57a1fc0dab07c87eea
fbshipit-source-id: 2d55d04e2144a1cc08900a57a1fc0dab07c87eea
2016-04-14 06:41:22 -07:00
Luke Dubert ca2fb70fa9 Fix: swiping in navigator too quickly causes the gesture to be lost
Summary:**Issue:**

In the Navigator if a user attempts to navigate backwards (or forwards) through the route stack by swiping and they perform the gesture too quickly, the gesture is lost and nothing happens.

**Cause:**

In the `_matchGestureAction` function, the variable `moveStartedInRegion` is created and evaluates the gesture to determine if it was initiated in a valid region, (a.k.a. within the `edgeHitWidth`). The issue arises because `moveStartedInRegion` uses `currentLoc` (which is created from `gestureState.moveX`/`Y`) and when the gesture is performed using a flick of the finger, the first value of the `currentLoc` is outside of the `edgeHitWidth`.

**Solution:**

The solution is to track the coordinates of the initial grant (`gestureState.x0`/`y0`), and use that value instead of the `currentLoc` when evaluating `moveStartedInRegion`. The `currentLoc` is still needed however, for when the gestureState does not have a an initial x and y value, because the pan responder has not been granted.
Closes https://github.com/facebook/react-native/pull/6249

Differential Revision: D3168726

Pulled By: ericvicenti

fb-gh-sync-id: f2ac462e59bdc38536b99cac6a4877c99fa4e869
fbshipit-source-id: f2ac462e59bdc38536b99cac6a4877c99fa4e869
2016-04-12 11:08:23 -07:00
Martin Rädlinger 8a7eceeb4f make NavigationHeader and NavigationHeaderTitle pointerEvents configurable
Summary:I basically want to build a transparent NavigationHeader, so I need to be able to set the pointerEvents of the NavigationHeader.
Closes https://github.com/facebook/react-native/pull/6881

Differential Revision: D3168620

Pulled By: ericvicenti

fb-gh-sync-id: 679f3f5858142f468be329771ea281c31e1f0d40
fbshipit-source-id: 679f3f5858142f468be329771ea281c31e1f0d40
2016-04-12 10:55:30 -07:00
Janic Duplessis 49fdd99633 Display component methods on the website and tweak the documentation
Summary:The website now displays public methods on components. This was implemented mostly in react-docgen via #66. This adds a <Method> component that is used by the component and API doc pages to display documentation for a method.

It also adds some missing documentation and tweak some existing one to integrate with this feature. I also prefixed some component methods with an '_' so they don't show up in the doc.

**Test plan (required)**

Tested every component page locally to make sure the methods doc was displayed properly.
Tested an API page to make sure it still worked properly.
Closes https://github.com/facebook/react-native/pull/6890

Differential Revision: D3159911

Pulled By: vjeux

fb-gh-sync-id: 1e6a4640cda6794496d9844c1af6a1451c017dcc
fbshipit-source-id: 1e6a4640cda6794496d9844c1af6a1451c017dcc
2016-04-09 11:13:28 -07:00
Sebastian Markbage a80dd9a92a Fix up this pattern var React = require('react-native');
Summary:First I searched for special cases that destructor PropTypes:

```
(?s)React\s*=\s*require\('react\-native'\).*(Children|PropTypes)[^\{\}]*\}\s*=\s*React;
```

I split them up manually.

Then I replaced the React = require('react-native') + destructuring pattern...

```
(?s)(const|var)\s+React\s*=\s*require\('react\-native'\)(.*[^\{\}]*\}\s*=\s*)React;
```

...with...

```
$1 React = require('react');
$1 ReactNative = require('react-native')$2ReactNative;
```

I used lint to figure out if I left some unnecessary imports.

Finally I grepped for just

```
React\s*=\s*require\('react\-native'\)
```

to catch any remaining patterns.

Also, `} = React.NativeModules` -> `} = ReactNative.NativeModules`.

Reviewed By: spicyj

Differential Revision: D3158991

fb-gh-sync-id: f97e8e921e193d6ea1a49d8d1bf3f09be7bed5c3
fbshipit-source-id: f97e8e921e193d6ea1a49d8d1bf3f09be7bed5c3
2016-04-08 20:37:22 -07:00
Sebastian Markbage 613ca14612 React.findNodeHandle -> ReactNative.findNodeHandle
Summary:Since the React 0.14 split of modules, the findNodeHandle feature is part of the
renderer and not the generic React API.

This just greps for React.findNodeHandle and replace them with ReactNative.findNodeHandle. I fixed up the imports manually.

I also found two callers each of ReactNative.createClass and React.render with the exception of downstream and examples will fix them separately.

I'll need to find more things like `var { PropTypes } = ReactNative;` separately. I think this is a good start though.

Reviewed By: vjeux

Differential Revision: D3149356

fb-gh-sync-id: 50ed60bc67270b16f561d4c641f2f19e85724d3b
fbshipit-source-id: 50ed60bc67270b16f561d4c641f2f19e85724d3b
2016-04-07 19:44:31 -07:00
Hedger Wang eecdf7d356 disable interaction during transition.
Summary:When navigating from one view to another you can still interact with
the current view. This means that a user can tap a button multiple times and trigger multiple transitions.

The view that is being transitioned off the screen should not be allowed to
receive any user interaction while it is being transitioned.

Reviewed By: javache

Differential Revision: D3143202

fb-gh-sync-id: cc033bbdf0cb9e717f62d2fcf751155406da846c
fbshipit-source-id: cc033bbdf0cb9e717f62d2fcf751155406da846c
2016-04-06 16:15:28 -07:00
Morgan Pretty 86d5c5249b Fixed an issue where the title in NavigationExperimentalHeader would block touches for the left component
Summary:There was an issue where the title component could overlap the left component and it would block the left component from receiving touches.

I only stumbled across this because we have a default title component which stretches most of the width and it was covering the edge of the left component. I think left/right components are more likely to be actionable than the title component so they should take priority in the touch order (ie. be rendered last).
Closes https://github.com/facebook/react-native/pull/6618

Differential Revision: D3144191

fb-gh-sync-id: 9ccd31714b2401d02eaaf4b5b24ed6afb60041c7
fbshipit-source-id: 9ccd31714b2401d02eaaf4b5b24ed6afb60041c7
2016-04-06 03:10:31 -07:00
Eric Vicenti 5162eb3254 Only accept card gestures within a certain range, 30px
Summary: The iOS native card stack only responds if the gesture starts on the left 30 px on the screen.

Reviewed By: hedgerwang

Differential Revision: D3137201

fb-gh-sync-id: 40e28d5696870b98731e92d6e42d00638b9bb15f
fbshipit-source-id: 40e28d5696870b98731e92d6e42d00638b9bb15f
2016-04-06 02:52:24 -07:00
Kyle Corbitt bafc506f7c Ignore Navigator touch events for background buttons
Summary:Currently, if the Navigator with the default `NavigatorNavigationBar` has two scenes on its `routeStack` and the bottom one defines a `RightButton` but the top one doesn't, a touch to the location of the underlying  `RightButton` will trigger its action.

This fix checks if the button's opacity is set to 0 (indicating it has been transitioned off the scene and shouldn't be interacted with) and ignores touch events if so.
Closes https://github.com/facebook/react-native/pull/5624

Differential Revision: D3139553

fb-gh-sync-id: 6d6da1459e289499b6d8769120a3b6114548c090
fbshipit-source-id: 6d6da1459e289499b6d8769120a3b6114548c090
2016-04-05 11:33:27 -07:00
Bruno Barbieri 9eb75b4dfb - added available SceneConfigs to Navigator docs
Summary:At the beginning of the navigator docs it says " See Navigator.SceneConfigs for default animations and more info on scene config options."

but then this is the only information available:

<img width="658" alt="screen shot 2016-03-23 at 2 40 49 am" src="https://cloud.githubusercontent.com/assets/1247834/13977670/733cdaa6-f0a1-11e5-92e6-fc98725f65e0.png">

And the only way of knowing about the available options is to look at the source code. I think a lot of people will appreciate this...

If you think this is too much, maybe adding a link to the source code would help.
Closes https://github.com/facebook/react-native/pull/6599

Differential Revision: D3088592

fb-gh-sync-id: f11025b76441e9394ce42ed6c796fa1ace3e8c27
fbshipit-source-id: f11025b76441e9394ce42ed6c796fa1ace3e8c27
2016-04-01 09:03:25 -07:00
Nicolas Charpentier b098d0e839 Fix typos in NavigationExperimental
Summary: Closes https://github.com/facebook/react-native/pull/6749

Differential Revision: D3122485

fb-gh-sync-id: 86f10407a398f9dc73177f3d85076729e4d8d574
fbshipit-source-id: 86f10407a398f9dc73177f3d85076729e4d8d574
2016-03-31 13:54:24 -07:00
Hedger Wang a28e59bd97 move `propTypes`, `defaultProps`, and `childContextTypes` into class.
Summary: This will make the code more readable.

Reviewed By: ericvicenti

Differential Revision: D3096663

fb-gh-sync-id: 540d2107ea3cd4c60aabdf7a6503c8c22bc4a985
fbshipit-source-id: 540d2107ea3cd4c60aabdf7a6503c8c22bc4a985
2016-03-28 16:48:27 -07:00
Weijia Wang d0f6a1a13e Imporve docs for the prop "navigationBar" in Navigator
Summary:The doc of props "navigationBar" in Navigator is not  detailed enough. I make an improvement to it.
Closes https://github.com/facebook/react-native/pull/6615

Differential Revision: D3102065

fb-gh-sync-id: da96e3c422e053d0a8203bbd160ea10ed590878a
fbshipit-source-id: da96e3c422e053d0a8203bbd160ea10ed590878a
2016-03-26 07:01:23 -07:00
Hedger Wang 62e80a600e Refactor <NavigationHeader /> API.
Summary:- All the public sub component renderers should implement the interface
  NavigationSceneRenderer, which will help to reuse renderer or
  replace renders for different composition.

- Perf improvement. <NavigationHeader /> is rendering way more
  sub component than necessary, we shall fix that.

- No UI or behavior change.

Reviewed By: ericvicenti

Differential Revision: D3091442

fb-gh-sync-id: fba5f7ce74597fa6036b5b216c02b06052801983
shipit-source-id: fba5f7ce74597fa6036b5b216c02b06052801983
2016-03-24 15:49:28 -07:00
Dom Christie 07697d15cc Improve consistency of NavigationCardStack animations.
Summary:Currently there?s an inconsistency between the animations used in `NavigationAnimatedView` (`spring`) and those in `NavigationCardStack` (`timing`), which is noticeable when switching between the two implementations.

By removing the `_applyAnimation` method, the `NavigationAnimatedView` will simply use its [default `applyAnimation`](6c22a2174e/Libraries/NavigationExperimental/NavigationAnimatedView.js (L56-L67)), making the animation styles the same.

**Before** (with `Animated.timing`)
Video: http://quick.as/Yexku8DdJ

**After** (with the default `NavigationAnimatedView` animations)
Video: http://quick.as/qrqbsnj8n
Closes https://github.com/facebook/react-native/pull/6636

Differential Revision: D3094638

Pulled By: ericvicenti

fb-gh-sync-id: 6e1c7c54b4ef102c4003719381d334d2c6f7a531
shipit-source-id: 6e1c7c54b4ef102c4003719381d334d2c6f7a531
2016-03-24 14:50:25 -07:00
Hedger Wang 4f8668b110 Support animation and gesture for Pager.
Summary: We need to support animation and gesture for Pager.

Reviewed By: ericvicenti

Differential Revision: D3066596

fb-gh-sync-id: 1c1a3d34b4298b4b0dd158f817057ae22dea72f4
shipit-source-id: 1c1a3d34b4298b4b0dd158f817057ae22dea72f4
2016-03-23 12:51:00 -07:00
Satyajit Sahoo 720c76f94d Rework the NavigationHeader
Summary:Add ability to specify custom left, right components, and title component. Style the `NavigationBar` according to the Platform.

Refer https://github.com/ericvicenti/navigation-rfc/pull/21

cc ericvicenti
Closes https://github.com/facebook/react-native/pull/5971

Differential Revision: D3080601

Pulled By: ericvicenti

fb-gh-sync-id: 7b921cd36b4c2ec1edf6f52629f1f9890d272dfd
shipit-source-id: 7b921cd36b4c2ec1edf6f52629f1f9890d272dfd
2016-03-21 22:07:26 -07:00
Adrien Brault 7fdabd8f14 Navigator: emit didFocus after routeStack reset
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
2016-03-21 19:18:53 -07:00
Hedger Wang 206f846507 Move scenes reducer logic into a separate module.
Reviewed By: ericvicenti

Differential Revision: D3068237

fb-gh-sync-id: 0146f38be6024c080ed4e00ac6b7c1e2f3d8e56f
shipit-source-id: 0146f38be6024c080ed4e00ac6b7c1e2f3d8e56f
2016-03-21 11:14:22 -07:00
Dilan Edirisinghe 8d7b419ed7 Add missing conditional to ListView.
Reviewed By: jingc

Differential Revision: D3062338

fb-gh-sync-id: 52f9477604f488b7bc4829046f166c8e30aef868
shipit-source-id: 52f9477604f488b7bc4829046f166c8e30aef868
2016-03-17 12:11:25 -07:00
Hedger Wang 3dbf9b9844 Port `onWillFocus` and `onDidFocus` from `Navigator` to `NavigationLegacyNavigatorRouteStack`.
Summary: Port the legendary props `onWillFocus` and `onDidFocus` from `Navigator` to `NavigationLegacyNavigatorRouteStack`.

Reviewed By: fkgozali

Differential Revision: D3063530

fb-gh-sync-id: 89583b8c80ee6ed0ef844a56b942a2d74b98717f
shipit-source-id: 89583b8c80ee6ed0ef844a56b942a2d74b98717f
2016-03-17 11:27:24 -07:00
Hedger Wang 55477ffd67 Make NavigationLegacyNavigator more testable.
Summary:- Move the logics that manage the routes stack into `NavigationLegacyNavigatorRouteStack`
- Add more unit tests for NavigationLegacyNavigatorRouteStack.
- Keep NavigationLegacyNavigator as a pure view as possible as we could.

Reviewed By: fkgozali

Differential Revision: D3060459

fb-gh-sync-id: 2c6802115c3f6ca5e396903f0d314ff54129524c
shipit-source-id: 2c6802115c3f6ca5e396903f0d314ff54129524c
2016-03-16 17:20:25 -07:00
Hedger Wang 28649b8cf0 Simplify <NavigationCard />.
Summary:Per offline discussion with ericvicenti,  we'd like to reudce the complexity by
keeping <NavigationCard /> nothing more than just a simple `<Animated.View />`,
which helps us to avoid over generalize the styles, gestures of what the Navigation card
needs to be.

The proposalis to use the same props (NavigationSceneRendererProps) that is used to render
the scene to generate the style and pan handlers needed for the navigation card.

No behavior changes, just implementation details clean up work.

Reviewed By: ericvicenti

Differential Revision: D3037225

fb-gh-sync-id: f6e718a282d25a319f5d8efd3e2ffebc66b2c8cb
shipit-source-id: f6e718a282d25a319f5d8efd3e2ffebc66b2c8cb
2016-03-15 15:59:26 -07:00
Petr Glotov e07fe0cc60 render empty section headers
Summary:Changed behavior so that empty section headers are rendered, fixes this [issue](https://github.com/facebook/react-native/issues/5639).
Closes https://github.com/facebook/react-native/pull/5713

Differential Revision: D3053765

Pulled By: sahrens

fb-gh-sync-id: 59a78a4b19288b2acc04a7b166de8c2ad16eacd7
shipit-source-id: 59a78a4b19288b2acc04a7b166de8c2ad16eacd7
2016-03-15 12:14:28 -07:00
Hedger Wang 3833c1b751 Implements `renderHeader` for legacy navigator.
Reviewed By: ericvicenti

Differential Revision: D3029188

fb-gh-sync-id: 6f0b91244bc0d0e5eee0e610764a39adaaffe001
shipit-source-id: 6f0b91244bc0d0e5eee0e610764a39adaaffe001
2016-03-10 17:17:21 -08:00