Commit Graph

325 Commits

Author SHA1 Message Date
Jeff Thomas de70a622aa Docs improvement
Summary:
In the `Additional Scenes` section, the `TouchableHighlight` component is used, but is not present in the import statement.

This is confusing and results in a `Can't find variable: TouchableHighlight` error.

This PR attempts to correct this confusion.
Closes https://github.com/facebook/react-native/pull/10276

Differential Revision: D3997058

Pulled By: hramos

fbshipit-source-id: 22ebf39cd39d8a76427c89cecc774ff9aef2c3c8
2016-10-10 18:29:03 -07:00
leeight 176f96d7b6 Remove duplicated call from NavigatorSceneConfigs
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.**

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
Closes https://github.com/facebook/react-native/pull/10299

Differential Revision: D3997827

Pulled By: ericvicenti

fbshipit-source-id: a98e112d95015842936a9d2bdc89553772ba49c2
2016-10-10 17:44:28 -07:00
Domenico Matteo b6719b247d Fix small typo in the help text
Summary:
Not much to add. My OCD spotted this 😄
Closes https://github.com/facebook/react-native/pull/10275

Differential Revision: D3984542

Pulled By: hramos

fbshipit-source-id: 2de8c8f7f5c2c518e0ec5277087095e0553c72d6
2016-10-06 20:28:37 -07:00
Michał Łazowik f77185f27e Fix rest operator syntax errors
Summary:
These are caused by new [syntax checking](1285131e3e/CHANGELOG.md (v6113-2016-10-01)) introduced by babylon.

"The single rest at the end only applies to binding `let { x, ...y } = obj;` and assignment `({ x, ...y } = obj).`"

I'd say this really should be cherry picked into the stable branch.

**Test plan**
1. install babylon@6.11.3
2. see that things break
3. apply patch
4. things work
5. make sure all instances were fixed (I used `\.\.\..*,.*\n.*=` in IntelliJ regex format—find all ... followed by newline followed by =)

Issue #10199
Closes https://github.com/facebook/react-native/pull/10200

Differential Revision: D3974066

Pulled By: javache

fbshipit-source-id: 3f3c1e9df01a3b3bdd61dd3863416c638d3ed98d
2016-10-05 04:43:45 -07:00
Lord Daniel Zautner 95b1fc42b7 Emit `willfocus` from immediatelyResetRouteStack
Summary:
The Navigator component inconsistently emits the `willfocus` event.

While it is emitted in `Navigator#resetTo`, `Navigator#push`, `Navigator#pop` and event `Navigator#replaceAtIndex` it is not emitted from `Navigator#immediatelyResetRouteStack`. This leads to surprising inconsistencies when working with these events.

With the PR I suggest to emit the `willfocus` event before resetting the route stack.
Closes https://github.com/facebook/react-native/pull/10125

Differential Revision: D3931284

fbshipit-source-id: 6e4f45c6d38426bcd0acc8f8c39478524032a03a
2016-09-27 11:43:32 -07:00
Lord Daniel Zautner 9584480261 Remove unnecessary double test in Navigator
Summary:
_renderScene would unnecessary test if `this.state.transitionFromIndex != null` twice.

The left side and right side of the 'or' statement would always be the same.

For cleaner code I suggest to remove it.
Closes https://github.com/facebook/react-native/pull/10042

Differential Revision: D3923058

fbshipit-source-id: 7466c1f0f24eac3f9f296debd9a5e9f5320aea28
2016-09-26 01:43:41 -07:00
Fred Liu 0c7ccfe172 Prevent 1st breadcrumb from stealing touches from title
Summary:
In certain cases, if a navigation title is present in place of an empty nav stack, the first breadcrumb may steal part of the title's touch events since it's hardcoded to sit 1/4 from the left of the screen (for animation reasons). This diff fixes it, allowing titles on an empty nav stack to be entirely touchable while retaining all other breadcrumb functionality.

Also, applied some suggested lint changes.

Reviewed By: hedgerwang

Differential Revision: D3891909

fbshipit-source-id: 97d1fb3bba4e4118401d84cec2d8836b94bfde75
2016-09-20 14:13:30 -07:00
yunfeng 8ebe66d0e3 Added the PushFromLeft animation to Navigator
Summary:
Added the  PushFromLeft animation to Navigator
Closes https://github.com/facebook/react-native/pull/8911

Differential Revision: D3841403

Pulled By: mkonicek

fbshipit-source-id: d8e388e507270a24be0b85cb5974d34f9aa1c6fa
2016-09-09 06:28:34 -07:00
Andrew Grewell 7b18b2c409 check if this._navBar has immediatelyRefresh method
Summary:
`Navigator` throws an error if using a custom `NavigationBar` component that does not have a `immediatelyRefresh` method present.
Closes https://github.com/facebook/react-native/pull/9438

Differential Revision: D3838928

Pulled By: mkonicek

fbshipit-source-id: 74d62ef09e179f457a4b14f8537dfaf0d4697322
2016-09-08 17:28:57 -07:00
Richard Evans 0cf9505630 Allow the disabling of navigation gestures.
Summary:
During development of an app I decided upon NavigationExperimental as I found it easily configurable with my Redux stores and make it work the way I wanted. One thing I found missing was the ability to decide if gestures were on or not for the card stack. In my case I need the gestures off as they conflict with what I am trying to do. This PR simply opens up the ability to turn the gestures for a CardStack off.

Testing was completed via UI Explorer. An additional example replicating the existing one with the new setting set to false was created. To ensure nothing broke I tested both the original example and new example to ensure gestures worked (and didn't work) when expected.

I did not see any unit tests around NavigationExperimental but if I simply missed them I would be more then happy to update/add any.
Closes https://github.com/facebook/react-native/pull/9505

Differential Revision: D3749880

Pulled By: ericvicenti

fbshipit-source-id: dfa42ff8b6c8b41490ad1efc931b364e47058243
2016-08-21 13:13:46 -07:00
Mengjue Wang fc864a22bd Provide RTL support in NavigationCardStack
Summary: Provide RTL support in NavigationCardStack

Reviewed By: fkgozali

Differential Revision: D3740172

fbshipit-source-id: 69466d24e148d0d81cb9f21c55f545abda46ac35
2016-08-19 08:43:39 -07:00
Martin Konicek 700574fe76 Use an ES6 class in ListView docs
Reviewed By: mkonicek

Differential Revision:
D3723141
Ninja: docs only

fbshipit-source-id: e1030f85b524777d2efbedb3cf78c218c34bad88
2016-08-16 09:58:45 -07:00
Ian MacLeod 02557d2cfe Accept children of all types for NavigationHeaderTitle
Summary:
`<Text>` accepts more than just string as its children; and it's handy to be able to style nav titles without a proptype warning throwing
Closes https://github.com/facebook/react-native/pull/8338

Differential Revision: D3719045

fbshipit-source-id: a02d181b5e133dbe467fbaca794f0d2119be2da7
2016-08-15 18:13:30 -07:00
Hedger Wang d600367715 NavigationExperimental: Add documentation for NavigationCardStack
Summary: Add documentation for NavigationCardStack

Reviewed By: ericvicenti

Differential Revision: D3685319

fbshipit-source-id: 6cd62195a434b3a7ed6b9cdca6fbd17212160ee2
2016-08-14 23:28:51 -07:00
Eric Vicenti 6c4d3c39c6 Remove shouldComponentUpdate policy from NavigationCard and NavigationCardStack
Summary:
The `shouldComponentUpdate` policies were meant to be a built-in optimization, but it prevents rendering at unexpected times, which has been causing confusion. Apps can use normal react optimization techniques to avoid extra rendering- Navigation will no longer attempt to optimize the render tree

Addresses https://github.com/facebook/react-native/issues/7720

Reviewed By: hedgerwang

Differential Revision: D3649735

fbshipit-source-id: 9461620445a6a57a1635113df7ec4026c0d6b9d2
2016-08-09 20:28:30 -07:00
David Aurelio 94666f16c7 Auto-fix lint errors
Reviewed By: bestander

Differential Revision: D3683952

fbshipit-source-id: 9484d0b0e86859e8edaca0da1aa13a667f200905
2016-08-09 06:43:46 -07:00
Hedger Wang 38979f9c68 NavigationExperimental: Stop using absolute position for NavigationHeader.
Summary:
Not a API change, but this may break the layout of exisitng apps that
uses NavigationHeader.

For now, NavigationHeader uses absolute position, which makes it hard for
NavigationCardStack to determine the height of the scenes.

Theoretically, the height of the scenes would be the height of the cards
stack minus the height of the header.

That said, if we want to support the headers with different height (e.g.
MyIOSHeader or MyAndroidHeader), we're forced to expose the height of the
headers and manually compute the height of the scenes.

Alternatively, if the header does not use absolute position, the height
of the scenes can adjust automatically with flex box, and that's what this
commit is about to do.

Reviewed By: ericvicenti

Differential Revision: D3671119

fbshipit-source-id: 26e48f801da3661c5d7dce4752ba927621172f4a
2016-08-04 15:28:30 -07:00
Kyle Corbitt 341b29da71 Render NavigationHeader correctly with hidden status bar
Summary:
Currently, the NavigationExperimental `Header` only renders correctly on iOS when the system status bar is visible. There are legitimate reasons to hide the status bar, especially when displaying in landscape.

This PR adds a `statusBarHeight` prop to the header, which defaults to 20 on iOS and 0 (no status bar) on Android. Changing this value causes the extra space at the top of the header reserved for the status bar to change.

I've tested this change in my own app on iOS with `statusBarHeight` set to 0, 20, and `undefined`, and ensured that it works correctly.
Closes https://github.com/facebook/react-native/pull/8983

Differential Revision: D3668637

fbshipit-source-id: 777a0c53e8fd1caa35ce4980ca3118adcf83b62d
2016-08-04 11:43:55 -07:00
Hedger Wang ca8531105e NavigationExperimental: Rename `renderOverlay` to `renderHeader`
Summary:
NavigationCardStack is a custom component, and its API should be explicit, not
too generic..

In NavigationCardStack, the prop `renderOverlay` is actually used to render
the NavigationHeader, and we uses absolute position to build the layout for
the header and the body.

One of the problem with using absolute postion and fixed height to build the
layout that contains the header is that the header can't have variant height
easily.

Ideally, if the layout for the header used flex-box, we'd ve able to be more
adaptive to deal with the header that has variant height.

That said, let's rename `renderOverlay` to `renderHeader`, then build the
proper layout that explicitly works better with the header.

If we to need to support overlay in navigation, we may consider add
`renderOverlay` later, if it's really necessary.

Reviewed By: ericvicenti

Differential Revision: D3670224

fbshipit-source-id: ff04acfe9dc995cb57117b3fd9b07d5f97b9c6ee
2016-08-04 11:28:31 -07:00
yueshuaijie bbe95c2acf Add method popN() to Navigator.
Summary:
Compareing API of
`Navigator`(http://facebook.github.io/react-native/releases/next/docs/navigator.html)
and
`NavigatorIOS`(http://facebook.github.io/react-native/releases/next/docs/navigatorios.html),

we found `Navigator` object lacks of the method `popN()` which is sometimes useful. This PR add it.
Closes https://github.com/facebook/react-native/pull/8806

Differential Revision: D3648001

Pulled By: ericvicenti

fbshipit-source-id: 661efba39e68049fd4a094304ec080092a14296d
2016-07-31 13:43:36 -07:00
Florent Le Gall 48f0dde630 Fix flow error in Flow error in NavigationError/NavigationHeaderTitle
Summary:
Fixes the "Unused suppression" error in NavigationHeaderTitle.
This closes https://github.com/facebook/react-native/issues/9058
Closes https://github.com/facebook/react-native/pull/9103

Differential Revision: D3647364

fbshipit-source-id: 1fff92b35a46ccb1c2c6206e54779b6a1ec58bda
2016-07-30 17:13:41 -07:00
Ben Alpert a2fb703bbb Convert from React.createClass to ES6 classes
Reviewed By: cpojer

Differential Revision: D3619143

fbshipit-source-id: e14e81468d467437ee3d79c34c34b7780a46ca1c
2016-07-26 01:13:31 -07:00
ahanriat c658cc545f Fix navigation card stack pan responder
Summary:
Hi folks !
🔧 Fix the navigation card stack pan responder when the `vertical` direction is enabled.

**Issue:**
When using a `ScrollView` with the `vertical` direction enabled, the pan handler catch the gesture before the `ScrollView`.

I don't know why there was no default value here for `RESPOND_POSITION_MAX_VERTICAL` 5162eb3254
ericvicenti could you tell me what you think about setting a default value for `RESPOND_POSITION_MAX_VERTICAL` ? 😃

Thanks !!

**EDIT June 15, 2016**
I'll update this PR this week end to provide a way to give custom values as there is no magic value for `RESPOND_POSITION_MAX_VERTICAL`

**EDIT June 24, 2016**
I've added a props `gestureResponseDistance` to control both the `RESPOND_POSITION_MAX_VERTICAL` and `RESPOND_POSITION_MAX_HORIZONTAL`
Closes https://github.com/facebook/react-native/pull/8076

Differential Revision: D3605973

Pulled By: ericvicenti

fbshipit-source-id: 158d88cf8ebbab742bf0b38c217ae502e9dd1963
2016-07-25 11:58:44 -07:00
Dhananjoy Biswas 09fff496c9 Remove redundant destructuring
Summary: Closes https://github.com/facebook/react-native/pull/8964

Differential Revision: D3605729

fbshipit-source-id: 517a06d5100742af2fa57bc5ccf8e8e957165f7c
2016-07-22 09:58:29 -07:00
David Aurelio 94efa8f58f Adapt unit tests
Reviewed By: mirciulix, bestander

Differential Revision: D3561508

fbshipit-source-id: afede6b03112d99f73ed7cf6bbce03d1aeea0492
2016-07-14 06:28:21 -07:00
David Aurelio 9bfa393a79 fix new flow errors after D3561327
Reviewed By: bestander

Differential Revision: D3561376

fbshipit-source-id: 226f0d1c6a771a987f9e04f114dc3ba1cca531b1
2016-07-14 04:58:43 -07:00
Hedger Wang 5189c94a6e Fix Navigator transition.
Summary: Fix the bug reported as https://github.com/facebook/react-native/pull/8071

Reviewed By: fkgozali

Differential Revision: D3553062

fbshipit-source-id: 286feddc268f51c0d9005a8831640c5e6af4880e
2016-07-12 17:43:26 -07:00
Mengjue Wang 38a6eec0db Provide RTL support for new Navigator -- Make RTL works in NUX
Summary: Provide RTL support in NavigationPager

Reviewed By: fkgozali

Differential Revision: D3536850

fbshipit-source-id: 29890a125dc5e001b4c10208cd53bfeca0d9b5c3
2016-07-11 20:58:32 -07:00
Mengjue Wang 471ee87445 Wrap native module I18nManager with a new RCTI18nManager.js and fix current use of native module I18nManager
Summary: create new RCTI18nManager.js to warp-up native module I18nManager and fix current use of it.

Reviewed By: ericvicenti

Differential Revision: D3547427

fbshipit-source-id: 53a695c94ca6bba2f566d0725c553e58d60bf451
2016-07-11 20:58:32 -07:00
Nivetha Singara Vadivelu 0b773c41ac Navigator - making changes so that a simple flick can be detected
Summary:
Decreased the distance threshold so that the user doesn't need to swipe a large distance to
set the pan responder.

Also, set a threshold for the velocity so that a simple flick can be detected.

Reviewed By: hedgerwang

Differential Revision: D3540354

fbshipit-source-id: 251a4f14dc014bc32b3a83fa8de419f86ca40b84
2016-07-10 20:43:26 -07:00
Mengjue Wang cadc753e4c Change NavigatorSceneConfig for RTL
Summary:
For RTL experiment, we need to swap all the Left and Right gesture and animation.
 Provide RTL support for Navigator in RN.

Reviewed By: hedgerwang

Differential Revision: D3519811

fbshipit-source-id: b53d9bf901ec056614658b627823d2225bdc82b1
2016-07-08 10:58:55 -07:00
Jake Murzy 46a685169e Use active scene passed in `props` by `NavigationTransitioner`
Summary:
With facebook/react-native@c57bac4, `NavigationTransitioner` passes the currently active `scene` in transition `props`. This simplifies the handling of transition changes when rendering overlay.

🍺
Closes https://github.com/facebook/react-native/pull/8298

Differential Revision: D3533447

Pulled By: ericvicenti

fbshipit-source-id: df568dc5cf5d57d8948b9f0400a8d693cf5564e1
2016-07-07 21:13:31 -07:00
Jeff Morrison 7795918eb4 Unrevert D3518381
Reviewed By: gabelevi

Differential Revision: D3522895

fbshipit-source-id: 52f28c7f3142566a07d8bc845be882aeda098809
2016-07-06 12:58:41 -07:00
Ian Childs 0fde81c816 Reverted commit D3518381
Reviewed By: gabelevi

Differential Revision: D3518381

fbshipit-source-id: 645c25191d5e7cff7689bd4dc583c478eba46496
2016-07-06 09:43:37 -07:00
Jeff Morrison a8e6a236cc fbobjc -> Flow v0.28
Reviewed By: gabelevi

Differential Revision: D3518381

fbshipit-source-id: 2dd5f89177aaefbd098ba1fd3c193da111ff14c7
2016-07-06 08:58:42 -07:00
David Aurelio bd60d828c5 Remove `node_modules/react` from the list of discoverable haste modules
Summary: This removes `node_modules/react` from the list of directories that are used for haste module resolutions. Modules required from React are now imported with `require('react/lib/…')`.

Reviewed By: astreet

Differential Revision: D3509863

fbshipit-source-id: 32cd34e2b8496f0a6676dbe6bb1eacc18124c01e
2016-07-05 06:44:33 -07:00
JasperStam aa0efd2e64 Add cardStyle prop to NavigationCardStack.
Summary:
This allows the `NavigationCard` style to be extended, the default `backgroundColor` style of the `NavigationCard` is not applicable to all apps.
Fixes issue #8116. PR #8115 was already made for this but didn't pass CI checks.

**Test plan**

When rendering a NavigationCardStack, add

```
const { CardStack } = NavigationExperimental;
...

<CardStack cardStyle={{ backgroundColor: 'purple' }} />
```

to see that the `NavigationCard` background has changed to purple.
Closes https://github.com/facebook/react-native/pull/8471

Differential Revision: D3508849

Pulled By: javache

fbshipit-source-id: 65703cccf3d01def9f2060256f0ff564bbdc47d3
2016-07-01 04:43:28 -07:00
Sunny Gurnani 730619dabf BugFix: Title should be from scene.route.title
Summary:
Its a minor Bug fix for rendering Title in NavigationHeader
Closes https://github.com/facebook/react-native/pull/8437

Differential Revision: D3507319

Pulled By: ericvicenti

fbshipit-source-id: ff4aa36be3c4991be11aabecbaad952c015a60e2
2016-06-30 17:58:25 -07:00
Nivetha Singara Vadivelu 8b57f078de Making the navigation transition page style
Reviewed By: hedgerwang

Differential Revision: D3499189

fbshipit-source-id: 809096e7f0f51c241b88d642704d09da259da4b3
2016-06-29 14:58:28 -07:00
Héctor Ramos 3085b35e63 Initial stab at NavigationExperimental tutorial
Summary:
Add a NavigationExperimental section to the Navigation guide.

![navexp](https://cloud.githubusercontent.com/assets/165856/16355280/120e7d38-3a67-11e6-9567-51c19c249fdf.png)
Closes https://github.com/facebook/react-native/pull/8431

Differential Revision: D3493158

Pulled By: JoelMarcey

fbshipit-source-id: 5e9646c3abf97f5cce6f5ba5b3d10853aa84ee8e
2016-06-29 05:28:24 -07:00
Nathan Azaria 267ccfb787 Enabled flow on ListView.js
Reviewed By: javache

Differential Revision: D3476167

fbshipit-source-id: 25ca5fe5063c5d19a96357338235a251a5839dcd
2016-06-23 09:28:27 -07:00
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