Reverted commit D3278698

Summary:
= Breaking Change (for experimental features) =

Major API changes in  NavigationAnimatedView

= New prop `transition` for scene renderer

In NavigationAnimatedView, we should not use `position` as a proxy of the
transtion which happens whenever navigation state changes.

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

This diff introduces an abstract prop `transition` that is exposed to the scene
renderers.

= Replace `applyAnimation` with `configureTransition`.

Expose a new optional prop  `configureTransition` that allows people to configure
transitions easily.

For instance, to configure the transition, do this:

```
function configureTransition() {
  return {
    dutation: 123,
    easing: Easing.easeInOut,
  };
}

```
<NavigationAnimatedView configureTransition={configureTransition) />

```

Reviewed By: ericvicenti

Differential Revision: D3278698

fbshipit-source-id: b790b92e0fabb42488ff1135b1c37a3f0e9420f7
This commit is contained in:
Olivier Notteghem
2016-05-12 18:52:01 -07:00
committed by Facebook Github Bot 4
parent 588183b166
commit 99b106658f
4 changed files with 42 additions and 91 deletions

View File

@@ -41,6 +41,8 @@ export type NavigationLayout = {
width: NavigationAnimatedValue,
};
export type NavigationPosition = NavigationAnimatedValue;
export type NavigationScene = {
index: number,
isStale: boolean,
@@ -59,20 +61,13 @@ export type NavigationSceneRendererProps = {
onNavigate: NavigationActionCaller,
// The progressive index of the containing view's navigation state.
position: NavigationAnimatedValue,
position: NavigationPosition,
// The scene to render.
scene: NavigationScene,
// All the scenes of the containing view's.
scenes: Array<NavigationScene>,
// The value that represents the progress of the transition when navigation
// state changes from one to another. Its numberic value will range from 0
// to 1.
// transition.__getAnimatedValue() < 1 : transtion is happening.
// transition.__getAnimatedValue() == 1 : transtion completes.
transition: NavigationAnimatedValue,
};
export type NavigationPanPanHandlers = {
@@ -90,12 +85,6 @@ export type NavigationPanPanHandlers = {
onStartShouldSetResponderCapture: Function,
};
export type NavigationTransitionSpec = {
duration: number,
// An easing function from `Easing`.
easing: () => any,
};
// Functions.
export type NavigationActionCaller = Function;
@@ -123,5 +112,3 @@ export type NavigationSceneRenderer = (
export type NavigationStyleInterpolator = (
props: NavigationSceneRendererProps,
) => Object;
export type NavigationTransitionConfigurator = () => NavigationTransitionSpec;