react-native-reanimated#Transition TypeScript Examples
The following examples show how to use
react-native-reanimated#Transition.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: heavy-screen.tsx From react-navigation-heavy-screen with MIT License | 6 votes |
OptimizedHeavyScreen = ({ transition = ( <Transition.Together> <Transition.Change interpolation="easeInOut" /> <Transition.In type="fade" /> </Transition.Together> ), style, children, placeHolder: Placeholder, }: Props) => { const { transitionRef, areInteractionsComplete } = useAfterInteractions() return ( <Transitioning.View transition={transition} style={style} ref={transitionRef} > {areInteractionsComplete ? ( children ) : !!Placeholder ? ( <Placeholder /> ) : null} </Transitioning.View> ) }
Example #2
Source File: optimize-heavy-screen.tsx From react-navigation-heavy-screen with MIT License | 5 votes |
export function optimizeHeavyScreen<Props>(
Component: ComponentType<Props>,
Placeholder: ComponentType | null = null,
options: {
disableHoistStatics?: boolean
transition?: ComponentPropsWithoutRef<
typeof Transitioning.View
>['transition']
} = {}
) {
const {
disableHoistStatics = false,
transition = (
<Transition.Together>
<Transition.Change interpolation="easeInOut" />
<Transition.In type="fade" />
</Transition.Together>
),
} = options
const OptimizedHeavyScreen = (props: Props) => {
const {
transitionRef,
areInteractionsComplete,
} = useAfterInteractions()
return (
<Transitioning.View
transition={transition}
style={styles.container}
ref={transitionRef}
>
{areInteractionsComplete ? (
<Component {...props} />
) : !!Placeholder ? (
<Placeholder />
) : null}
</Transitioning.View>
)
}
if (!disableHoistStatics) {
// forward navigationOptions, and other statics
hoistNonReactStatics(OptimizedHeavyScreen, Component)
}
return OptimizedHeavyScreen
}