File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { View } from 'react-native';
33import { animated , useSpring } from 'react-spring/native.cjs' ;
44import { DeepPartial } from 'ts-essentials' ;
55
6+ import { springDefaultConfig } from '../../constants/Animation' ;
67import { useTheme } from '../../theme' ;
78import { mergeStyles , ReplaceReturnType } from '../../utils/mergeStyles' ;
89import { Modal } from '../Modal' ;
@@ -51,6 +52,7 @@ export const Drawer = (props: DrawerProps) => {
5152
5253 const animation = useSpring ( {
5354 [ position ] : offset ,
55+ config : springDefaultConfig ,
5456 from : { [ position ] : - 600 } ,
5557 reset : true ,
5658 } ) ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import * as React from 'react';
33import * as ReactDOM from 'react-dom' ;
44import { animated , useSpring } from 'react-spring/web.cjs' ;
55
6+ import { springDefaultConfig } from '../../constants/Animation' ;
67import { useElement , useFreezeBody } from '../Helpers' ;
78import { ModalBaseProps } from './ModalBase' ;
89
@@ -69,6 +70,8 @@ export const ModalBase = (props: ModalBaseProps): React.ReactPortal | null => {
6970 if ( ! visible ) setIsInView ( false ) ;
7071 } ,
7172
73+ config : springDefaultConfig ,
74+
7275 opacity : animationType === 'fade' ? ( visible ? 1 : 0 ) : 1 ,
7376 y : animationType === 'slide' ? ( visible ? 0 : 100 ) : 0 ,
7477 } ) ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { Platform, View } from 'react-native';
33import { animated , useSpring } from 'react-spring/native.cjs' ;
44import { DeepPartial } from 'ts-essentials' ;
55
6+ import { springDefaultConfig } from '../../constants/Animation' ;
67import { useTheme } from '../../theme' ;
78import { mergeStyles , ReplaceReturnType } from '../../utils/mergeStyles' ;
89import {
@@ -32,6 +33,7 @@ export const Progress = (props: ProgressProps) => {
3233
3334 const boundPercent = Math . max ( Math . min ( percent , 100 ) , 0 ) ;
3435 const { width } = useSpring ( {
36+ config : springDefaultConfig ,
3537 from : { width : boundPercent } ,
3638 width : boundPercent ,
3739 } ) ;
Original file line number Diff line number Diff line change 88import { animated , useSpring } from 'react-spring/native.cjs' ;
99import { DeepPartial } from 'ts-essentials' ;
1010
11+ import { springDefaultConfig } from '../../constants/Animation' ;
1112import { Icon } from '../../icons' ;
1213import { useTheme } from '../../theme' ;
1314import { mergeStyles , ReplaceReturnType } from '../../utils/mergeStyles' ;
@@ -53,6 +54,8 @@ export const Switch = (props: SwitchProps) => {
5354 } = mergeStyles ( getSwitchStyles , getStyles ) ( theme ) ;
5455
5556 const { backgroundColor, circleColor, circlePosition } = useSpring ( {
57+ config : springDefaultConfig ,
58+
5659 backgroundColor : isSwitchedOn ? backgroundColorOn : backgroundColorOff ,
5760 circleColor : isSwitchedOn ? circleColorOn : circleColorOff ,
5861 circlePosition : isSwitchedOn
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { View } from 'react-native';
33import { animated , useSpring } from 'react-spring/native.cjs' ;
44import { Omit } from 'ts-essentials' ;
55
6+ import { springDefaultConfig } from '../../constants/Animation' ;
67import { Alert , AlertProps } from '../Alert' ;
78
89const AnimatedView = animated ( View ) ;
@@ -37,6 +38,8 @@ export const Toast = (props: ToastProps) => {
3738 } = props ;
3839
3940 const style = useSpring ( {
41+ config : springDefaultConfig ,
42+
4043 from : { translateY : - 500 } ,
4144 onRest : ( ) => onRemove ( ) ,
4245 to : async next => {
Original file line number Diff line number Diff line change 1+ export const springDefaultConfig = {
2+ friction : 40 ,
3+ tension : 400 ,
4+ } ;
You can’t perform that action at this time.
0 commit comments