mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
Merge pull request #17096 from fangpenlin/react-navigation/transitioner
Export Transitioner for react-navigation
This commit is contained in:
33
types/react-navigation/index.d.ts
vendored
33
types/react-navigation/index.d.ts
vendored
@@ -1,6 +1,8 @@
|
||||
// Type definitions for react-navigation 1.0
|
||||
// Project: https://github.com/react-community/react-navigation
|
||||
// Definitions by: Huhuanming <https://github.com/huhuanming>, mhcgrq <https://github.com/mhcgrq>
|
||||
// Definitions by: Huhuanming <https://github.com/huhuanming>
|
||||
// mhcgrq <https://github.com/mhcgrq>
|
||||
// fangpenlin <https://github.com/fangpenlin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as React from 'react'
|
||||
@@ -627,3 +629,32 @@ export interface NavigationComponentProps<T> {
|
||||
|
||||
export const TabBarTop: React.ReactElement<any>;
|
||||
export const TabBarBottom: React.ReactElement<any>;
|
||||
|
||||
interface TransitionerProps {
|
||||
configureTransition: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps?: NavigationTransitionProps
|
||||
) => NavigationTransitionSpec
|
||||
navigation: NavigationProp<any, NavigationAction>
|
||||
onTransitionEnd?: () => void
|
||||
onTransitionStart?: () => void
|
||||
render: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps?: NavigationTransitionProps
|
||||
) => any
|
||||
style?: ViewStyle
|
||||
}
|
||||
|
||||
interface TransitionerState {
|
||||
layout: NavigationLayout
|
||||
position: Animated.Value
|
||||
progress: Animated.Value
|
||||
scenes: Array<NavigationScene>
|
||||
}
|
||||
|
||||
export class Transitioner extends React.Component<
|
||||
TransitionerProps,
|
||||
TransitionerState
|
||||
> {
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,10 @@ import {
|
||||
TabNavigatorConfig,
|
||||
TabBarTop,
|
||||
TabBarBottom,
|
||||
NavigationProp,
|
||||
NavigationAction,
|
||||
NavigationTransitionProps,
|
||||
Transitioner
|
||||
} from 'react-navigation';
|
||||
|
||||
const Start = (
|
||||
@@ -44,3 +48,28 @@ const tabNavigatorConfig: TabNavigatorConfig = {
|
||||
lazy: true,
|
||||
tabBarComponent: TabBarTop,
|
||||
}
|
||||
|
||||
interface CustomTransitionerProps {
|
||||
navigation: NavigationProp<any, NavigationAction>
|
||||
}
|
||||
|
||||
const configureTransition = (
|
||||
_transitionProps: NavigationTransitionProps,
|
||||
_prevTransitionProps: NavigationTransitionProps
|
||||
) => {
|
||||
return {}
|
||||
}
|
||||
|
||||
const renderTransitioner = (props: NavigationTransitionProps, prevProps: NavigationTransitionProps) => {
|
||||
return <View />
|
||||
}
|
||||
|
||||
const CustomTransitioner = (props: CustomTransitionerProps) => {
|
||||
<Transitioner
|
||||
configureTransition={configureTransition}
|
||||
navigation={props.navigation}
|
||||
render={renderTransitioner}
|
||||
onTransitionStart={() => { }}
|
||||
onTransitionEnd={() => { }}
|
||||
/>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user