@@ -13,6 +13,7 @@ import type {
1313 AnimatedPressableOptions ,
1414 PressableContextType ,
1515} from '../provider/context' ;
16+ import type { PressableConfig } from '../provider/constants' ;
1617
1718const AnimatedBaseButton = Animated . createAnimatedComponent ( BaseButton ) ;
1819type AnimatedPressableProps = ComponentProps < typeof AnimatedBaseButton > ;
@@ -22,6 +23,7 @@ export type AnimatedPressableStyleOptions<TMetadata = unknown> = {
2223 isToggled : boolean ;
2324 isSelected : boolean ;
2425 metadata : TMetadata ;
26+ config : PressableConfig ;
2527} ;
2628
2729export type BasePressableProps < TMetadata = unknown > = {
@@ -37,7 +39,7 @@ export type BasePressableProps<TMetadata = unknown> = {
3739 * @platform web
3840 */
3941 activateOnHover ?: boolean ;
40- } & Omit < Partial < PressableContextType < 'timing' | 'spring' > > , 'metadata' > &
42+ } & Omit < Partial < PressableContextType < 'timing' | 'spring' > > , 'metadata' | 'config' > &
4143 Partial <
4244 Pick <
4345 AnimatedPressableProps ,
@@ -81,18 +83,19 @@ const BasePressable: React.FC<BasePressableProps> = React.memo(
8183 onPressOut,
8284 animatedStyle,
8385 animationType : animationTypeProp ,
84- config : configProp ,
86+ animationConfig : animationConfigProp ,
8587 enabled = true ,
8688 initialToggled = false ,
8789 activateOnHover : activateOnHoverProp ,
8890 ...rest
8991 } ) => {
9092 const {
9193 animationType : animationTypeProvider ,
92- config : configPropProvider ,
94+ animationConfig : animationConfigProvider ,
9395 globalHandlers,
9496 metadata,
9597 activateOnHover : activateOnHoverProvider ,
98+ config,
9699 } = usePressablesConfig ( ) ;
97100
98101 const lastTouchedPressable = useLastTouchedPressable ( ) ;
@@ -107,31 +110,31 @@ const BasePressable: React.FC<BasePressableProps> = React.memo(
107110 const active = useSharedValue ( false ) ;
108111 const isToggled = useSharedValue ( initialToggled ) ;
109112
110- const { animationType, config } = useMemo ( ( ) => {
113+ const { animationType, animationConfig } = useMemo ( ( ) => {
111114 if ( animationTypeProp != null ) {
112115 return {
113116 animationType : animationTypeProp ,
114- config : configProp ,
117+ animationConfig : animationConfigProp ,
115118 } ;
116119 }
117120 return {
118121 animationType : animationTypeProvider ,
119- config : configProp ?? configPropProvider ,
122+ animationConfig : animationConfigProp ?? animationConfigProvider ,
120123 } ;
121124 } , [
122125 animationTypeProp ,
123126 animationTypeProvider ,
124- configProp ,
125- configPropProvider ,
127+ animationConfigProp ,
128+ animationConfigProvider ,
126129 ] ) ;
127130
128131 const withAnimation = useMemo ( ( ) => {
129132 return animationType === 'timing' ? withTiming : withSpring ;
130133 } , [ animationType ] ) ;
131134
132135 const progress = useDerivedValue < number > ( ( ) => {
133- return withAnimation ( active . get ( ) ? 1 : 0 , config ) ;
134- } , [ config , withAnimation ] ) ;
136+ return withAnimation ( active . get ( ) ? 1 : 0 , animationConfig ) ;
137+ } , [ animationConfig , withAnimation ] ) ;
135138
136139 const onPressInWrapper = useCallback ( ( ) => {
137140 active . set ( true ) ;
@@ -214,6 +217,7 @@ const BasePressable: React.FC<BasePressableProps> = React.memo(
214217 isToggled : isToggled . get ( ) ,
215218 isSelected : lastTouchedPressable . get ( ) === pressableId ,
216219 metadata,
220+ config,
217221 } )
218222 : { } ;
219223 } , [
@@ -224,6 +228,7 @@ const BasePressable: React.FC<BasePressableProps> = React.memo(
224228 lastTouchedPressable ,
225229 pressableId ,
226230 metadata ,
231+ config ,
227232 ] ) ;
228233
229234 const hoverProps = useMemo (
0 commit comments