Граф коммитов

24 Коммитов

Автор SHA1 Сообщение Дата
rh389 7a4166c31d Deal with 0.38 'FlowFixMe's
Summary:
Largely typing fixes to deal with the glut of new `FlowFixMe` suppressions introduced with flow 0.38 in a4bfac907e

Tested with flow itself. CC gabelevi
Closes https://github.com/facebook/react-native/pull/11985

Differential Revision: D4452045

Pulled By: ericvicenti

fbshipit-source-id: acc46c4c406ae706a679e396be1d40ae2f4ce5a1
2017-01-31 13:13:32 -08:00
Gabe Levi e2ce98b7c6 Fix the suppress comment regex for react_native
Reviewed By: davidaurelio

Differential Revision: D4435640

fbshipit-source-id: c680aee6931979859f04c0dca47037ba6f6cba73
2017-01-19 10:28:28 -08:00
Gabe Levi a4bfac907e Deploy v0.38.0
Reviewed By: jeffmo

Differential Revision: D4428858

fbshipit-source-id: 10dc69349a2b563e1fa444a8b0612e3b2d4ccd1c
2017-01-18 11:13:30 -08:00
Timur Gibadullin df43cc7f6b Fix animation in fast navigation between scenes
Summary:
There is a bug in navigation animation:
![-05-2016 16-04-23](https://cloud.githubusercontent.com/assets/3778452/20030228/8d93bc3e-a371-11e6-87d6-2c5c994733b5.gif)
navigation animation from route-2 was awful, route-3 scene appeared without any animation, I pushed above example to 46dd8c93b4.

This bug can be reproduced when user navigates to the next scene immediately after navigation to the current one or when navigating between scenes programmatically (e.g. between loading scene and whatever next scene). I made some investigation and It looks like that `progress` should be reseted before building the new _transitionProps.

The above example after applying this patch:
![-05-2016 16-12-16](https://cloud.githubusercontent.com/assets/3778452/20030259/a800681e-a372-11e6-847a-991d355a5940.gif)
Closes https://github.com/facebook/react-native/pull/10761

Differential Revision: D4226864

Pulled By: mkonicek

fbshipit-source-id: 31dceb6c8e497b2cbd891bbda4cb3add01cbcca0
2016-11-23 09:58:42 -08:00
Linmic 35e517562c Fixed the issue that _onTransitionEnd might try to setState at unmoun…
Summary:
This is to fix the issue that if `Animated.parallel`'s callback - `_onTransitionEnd` being triggered twice in a really short period(say quickly double-click the Android's hardware back button),  it might try to `setState` at unmounted stage, hence cause app crash.

This will make sure `_onTransitionEnd` only fired after mounted.
Closes https://github.com/facebook/react-native/pull/10878

Differential Revision: D4167266

Pulled By: ericvicenti

fbshipit-source-id: 7361e0ea4e8481b2da3fa39f78cdc0461693631f
2016-11-11 09:43:48 -08:00
Konstantin Raev 6ea26c01de Reverted commit D4027388
Reviewed By: yungsters

Differential Revision: D4027388

fbshipit-source-id: 8e3341b6f393ccf432c1a4e22a7cbf422284a06f
2016-10-16 04:13:42 -07:00
Jan Kassens e58d17e68b React.Element<any> » React.Element<*>
Reviewed By: yungsters

Differential Revision: D4027388

fbshipit-source-id: 5bc178eab1ab72283622b4b7d418f9fd43ec0792
2016-10-15 17:58:38 -07:00
Tim Yung e8198aed8d Cleanup: Prefer `React.Element` over `React$?Element`
Reviewed By: vjeux

Differential Revision: D4013049

fbshipit-source-id: 18a447fdbc584418d6a51770363bcd221e7fb7dc
2016-10-14 08:59:37 -07:00
Gabe Levi 85a6f011b6 Deploy v0.32.0
Reviewed By: jeffmo

Differential Revision: D3821852

fbshipit-source-id: 01fd16707cba860a830d682a2af2bdd542605abf
2016-09-06 13:43:47 -07:00
Chace Liang dadfe40f55 do not reset layout state if they are the same in NavigationTransitioner
Reviewed By: fred2028

Differential Revision: D3773370

fbshipit-source-id: 7999cada80361b68f77f2433c6d2194ee6d26c73
2016-08-26 10:58:31 -07:00
Eric Vicenti de9d22ee7e Ensure NavigationTransitioner props.onTransitionEnd happens after scene cleanup
Summary:
We only want to call onTransitionEnd after the transition has fully completed, including scene cleanup.

This will help avoid race conditions when we start new navigation after a transition completes.

Reviewed By: fkgozali

Differential Revision: D3712235

fbshipit-source-id: 146f30a0caf3d2fe164285fbef12293b7b161c6e
2016-08-12 17:13:37 -07:00
Will Sun 3a53228127 Prevent race condition on immediate transition
Summary:
NavigationTransitioner prepares for transition within `componentWillReceiveProps`, using previously-saved state to determine how to properly handle new props. If a transition is to take place, the code saves new info in state, executes the transition, and cleans up scenes within `_onTransitionEnd`.

If the transition is a jump-to transition, or otherwise takes very little time, then it is possible for the setState call within `_onTransitionEnd` to use state which hasn't yet been set by the code within `componentWillReceiveProps`, resulting in a failed transition.

This fix ensures that the initial setState call is completed before executing the transition.
Closes https://github.com/facebook/react-native/pull/8709

Differential Revision: D3550872

fbshipit-source-id: 1364612048025f5f970b44cbfd0c31acc4a60f56
2016-07-12 13:13:24 -07:00
Hedger Wang d72f844530 Pass TransitionProps to `configureTransition` for <NavigationTransitioner />
Summary:
This follows up the PR https://github.com/facebook/react-native/pull/8306

= Changes

1. Provides the TransitionProps (current and previous) to the function
`configureTransition`.

2. Adds a new member `timing` to `NavigationTransitionSpec`.

= Why

1. Helps people to customize the animation between transitions
2. Helps people to migrate from the deprecated `applyAnimation` prop.

Reviewed By: ericvicenti

Differential Revision: D3470802

fbshipit-source-id: be49becccd53aed7bc57093da1c7dae20153febd
2016-06-29 18:43:47 -07:00
Hedger Wang 229d6d2fd0 Fix NavigationScenesReducer.
Summary:
Fix a bug in NavigationScenesReducer that prevents scenes from re-rendering.
This happens when jumping the index between routes.

The fix is to add an new property `isActive` to `NavigationScene` to indicate the current active scene.

Reviewed By: ericvicenti

Differential Revision: D3479736

fbshipit-source-id: a71419887acd94ad2fead71596ca46419a88efef
2016-06-27 12:13:40 -07:00
Hedger Wang 37e41d2549 Fix transtion props `layout` in NavigationTransitioner.
Summary: When layout is measure, transtion props should be updated.

Reviewed By: ericvicenti

Differential Revision: D3479967

fbshipit-source-id: 14bcd96b9691b7ee68689393b4fef51dbd04b69f
2016-06-24 15:28:35 -07:00
Eric Vicenti b4d15d3c5a Fix stale scene cleanup
Summary: Previously we would not re-compute `this._transitionProps` after cleaning up stale scenes, so the render caused by setState still had the stale scenes in the props

Reviewed By: hedgerwang

Differential Revision: D3471011

fbshipit-source-id: fd08ef7a21355a229e877c85f06d6584eb44f38e
2016-06-22 15:13:32 -07:00
Hedger Wang c57bac4767 Pass the current and previous transition props to `render`, `onTransitionStart` and `onTransitionEnd`.
Summary: This shall make it convenient to handle transition changes.

Reviewed By: ericvicenti

Differential Revision: D3442291

fbshipit-source-id: aee0ffe18ada40ef133484b4a4999f282c66c181
2016-06-21 14:13:27 -07:00
Hedger Wang 3a6231432a Define the generic `render` prop for NavigationTransitioner to render scenes.
Summary:
This defines the generic function prop `render(props: NavigationTransitionProps)`
to NavigationTransitioner, which enables developer to render scenes, header, overlay,
underlay...etc.

Differential Revision: D3431478

fbshipit-source-id: 93dbc7da23ad8c95565b01f7865d1e8dfd4401f7
2016-06-14 16:43:28 -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
Jake Murzy 3ed00f140d Fix typo in NavigationTransitioner
Summary:
Typo.

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

Differential Revision: D3384782

Pulled By: javache

fbshipit-source-id: edfd2c561dc19ac8ec8c526860b934bc19429c6a
2016-06-03 04:28:23 -07:00
Hedger Wang 8097fcf4e7 Fix NavigationTransitioner.
Summary:
- Address the issues reported at 7db7f78dc7 (commitcomment-17575647)
- Fix the logic that reduces the scenes.
- Fix the logic that computes the active scene for `renderOverlay`.

Reviewed By: ericvicenti

Differential Revision: D3344716

fbshipit-source-id: 3fce517ff1de212f412a77936012695bd2dcfc3c
2016-05-25 11:28:21 -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
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
Hedger Wang 7db7f78dc7 Fork NavigationAnimatedView to NavigationTransitioner
Summary:
- Fork NavigationAnimatedView to NavigationTransitioner
- NavigationAnimatedView will soon be deprecated and we'd ask people to use NavigationTransitioner instead.

Difference between  NavigationTransitioner and NavigationAnimatedView

- prop `applyAnimation` is removed.
- new prop `configureTransition`, `onTransitionStart`, and `onTransitionEnd` are added.

tl;dr;

In NavigationAnimatedView, we `position` (an Animated.Value object) as a proxy of the
transtion which happens whenever the index of navigation state changes.

Because `position` does not change unless navigation index changes, it won't
be possible to build animations for actions that changes the  navigation state
without changing the index.

Also, we believe that the name `Transitioner` is a better name for this core component
that focuses on transitioning. Note that the actual animation work is done via
`<Animated.View />` returnd from the `renderScene` prop.

Reviewed By: ericvicenti

Differential Revision: D3302688

fbshipit-source-id: 720c3a4d3ccf97eb05b038baa44c9e780aad120b
2016-05-18 13:43:31 -07:00