Commit Graph

284 Commits

Author SHA1 Message Date
Christine Abernathy 4ec53ee8fa Update Navigator component doc
Summary:
Related to #8203 to update the Navigator component reference doc.

**Test plan (required)**

Started up the website and checked:
http://localhost:8079/react-native/docs/navigator.html

![component_navigator_2](https://cloud.githubusercontent.com/assets/691109/16280426/3f2cdc32-3874-11e6-810b-ca34d7bd4972.png)

**Note**

The code is not Flow-ified so depended on jsdoc formatting to get the method parameter types. There's a current issue with handling optional types via react-docgen which parses components. There's an open PR to look into this: https://github.com/reactjs/react-docgen/pull/89. When that's resolved the `replaceAtIndex` method parameter type that's documented for `cb` needs to be updated to make it optional.
Closes https://github.com/facebook/react-native/pull/8318

Differential Revision: D3471185

Pulled By: JoelMarcey

fbshipit-source-id: 99f85ee2ab00dc200cf2812cce5b3ccec743d6a0
2016-06-22 15:28:27 -07:00
Nathan Azaria f03bc9016e Fixed flowtype of ListViewDataSource to accept optional params
Summary:
ParamType of ListViewDataSource currently requires all the parameters to be supplied, although they are nullable.
This diff fixed it and allows the parameters to be not supplied.

Reviewed By: javache

Differential Revision: D3462796

fbshipit-source-id: 68dee260ff0c4020b7fd2bb7031d14c980812694
2016-06-22 12:43:49 -07:00
Fred Liu b3886652ab Fix navigation jump on multi-tap
Summary:
On iOS, if a non-selected breadcrumb is tapped multiple times, the navigator will transition to the tapped breadcrumb, then back to the previously selected breadcrumb. Then, when another breadcrumb is tapped, it would go to the previously multi-tapped breadcrumb.

This seems to be because transitions are queued when they shouldn't be. I've reverted to the way it was before PR 8701, but added a `transitionQueue.length === 0`. This should solve the race condition from 8701, ensuring all transitions in the queue are flushed in sequence, and thus landing on the finally tapped one.

Reviewed By: hedgerwang

Differential Revision: D3469901

fbshipit-source-id: 0143a27d6c875d47d28b77eed4e5a28b1c40c8bb
2016-06-22 11:13:26 -07:00
Jake Murzy 47a728907f Migrate NavigationCardStack
Summary:
As discussed in #8262.
Closes https://github.com/facebook/react-native/pull/8268

Reviewed By: hedgerwang

Differential Revision: D3462059

Pulled By: ericvicenti

fbshipit-source-id: 1f48db3a15668e5a1122b7dcb244bd4352acf9a9
2016-06-21 15:59:04 -07:00
Fred Liu 6982f5aa24 Fix Navigator jumpTo same route issue
Summary: https://github.com/facebook/react-native/pull/8071 introduced a bug where jumping to the same navigator route would show a blank screen since the `index` check is not catching cases where the `transitionQueue` is empty.

Reviewed By: ericvicenti

Differential Revision: D3464697

fbshipit-source-id: 494527d1fb0ac5aea394abd3231dd19c56596549
2016-06-21 13:43:25 -07:00
carlos 12754839a1 if quick call jumpTo the transitionQueue will be quit before handle a…
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.)

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/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/mas
Closes https://github.com/facebook/react-native/pull/8071

Differential Revision: D3453372

Pulled By: ericvicenti

fbshipit-source-id: 3494faee1a83574c3937a6545b246713ec38e0d0
2016-06-17 16:43:23 -07:00
Basil Hosmer b4a4c71a68 update flowification of react-native
Reviewed By: frantic, gabelevi

Differential Revision: D3436342

fbshipit-source-id: 7630eac4601d0768f57dc9fc945595039067eceb
2016-06-16 15:43:20 -07:00
Hedger Wang fb0007d853 Remove prop `onNavigate`.
Summary:
Remove prop `onNavigate` from these views.
- NavigationAnimatedView
- NavigationCardStack
- NavigationCard

Also, the `sceneProps` onject that is passed to the `renderScene` function
no longer contains `onNavigate`.

The contract that `onNavigate` expects has been vague. Different data flow
system may expect complete different params for such function

For instance,

  * onNavigate({type: 'back'});
  * onNavigate({type: 'BACK'});
  * onNavigate('back'});

We have no intention to unify such generic API since it's more likely to be
constrained by the data flow frameworks such as redux or flux.

Also, passing the prop `onNavigate` all the way down to the component that
invokes the navigation action can be really tedious. We'd expect developer
to either pass such callback (onNavigate) via context or just set up some
kind of static actions that any component can call directly.

`onNavigate` was previously added as a part of (redux-like) reducers-friendly
feature but that's no longer the case.

This new prop `onNavigateBack` is used to explicitly handle the case when the back button or back gesture
is performed.

Reviewed By: ericvicenti

Differential Revision: D3410873

fbshipit-source-id: a703cf0debd474cff33d6610e858b9c4bb3ecbf5
2016-06-09 17:58:27 -07:00
dragonwong 8731494990 change leftButton init position
Summary:
In navigationBar, when back to the previous view, the left button of the previous view should fade in like iOS native navBar, instead of move in. It's interesting that the right button acts correct.

React Native:

![clear](https://cloud.githubusercontent.com/assets/2622602/15535443/fa5e77bc-229f-11e6-8632-0dd9f5f2fb26.gif)

iOS Native:

![clear2](https://cloud.githubusercontent.com/assets/2622602/15535452/05999918-22a0-11e6-877c-63590b7bb9ef.gif)
Closes https://github.com/facebook/react-native/pull/7745

Differential Revision: D3392307

Pulled By: nicklockwood

fbshipit-source-id: e5384140049bf7b6f78fc093209ee48814a2ffdc
2016-06-06 07:28:24 -07:00
Kasim Tan f49f28ce15 Fix typo (shoud -> should)
Summary: Closes https://github.com/facebook/react-native/pull/7928

Differential Revision: D3390537

fbshipit-source-id: 97ce2331d0942ffe21078b3aec27daed20cd8af5
2016-06-04 16:43:41 -07:00
Marco Bonaldo 3f92e09787 Fix header elevation of NavigationExperimental
Summary:
Updated according to the documentation:  http://www.google.com/design/spec/what-is-material/elevation-shadows.html#elevation-shadows-elevation-android-
Closes https://github.com/facebook/react-native/pull/7289

Differential Revision: D3390296

Pulled By: ericvicenti

fbshipit-source-id: 4c475a6c4b6cd1c40b4d995ed18d31d9e179a69a
2016-06-04 12:43:22 -07:00
sheparddw d16c6e926c Fix typo in ListViewDataSource documentation.
Summary: Closes https://github.com/facebook/react-native/pull/7860

Differential Revision: D3384941

Pulled By: javache

fbshipit-source-id: 8a9a9c3dbf8f921ee3f6597154347ec102783415
2016-06-03 06:28:23 -07:00
Gabe Levi d81cf658ef Deploy v0.26.0
Reviewed By: bhosmer, samwgoldman

Differential Revision: D3361342

fbshipit-source-id: c062656e3789784929102ba04c54be3be774d7dc
2016-05-27 17:58:32 -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
James Ide 1343248bbe Set statics on the NavigationCard container
Summary:
NavigationCard is wrapped in a container, which breaks statics so apply the statics to the wrapped class instead.
Closes https://github.com/facebook/react-native/pull/7483

Differential Revision: D3336226

Pulled By: ericvicenti

fbshipit-source-id: ae28e7be7a6227700c2c11081c5605f3667d1494
2016-05-23 20:43:28 -07:00
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