@@ -20,11 +20,13 @@ import {
20
20
} from './utils' ;
21
21
import { PressabilityDebugView } from '../../handlers/PressabilityDebugView' ;
22
22
import { GestureTouchEvent } from '../../handlers/gestureHandlerCommon' ;
23
- import { INT32_MAX , isTestEnv } from '../../utils' ;
23
+ import { INT32_MAX , isFabric , isTestEnv } from '../../utils' ;
24
24
25
25
const DEFAULT_LONG_PRESS_DURATION = 500 ;
26
26
const IS_TEST_ENV = isTestEnv ( ) ;
27
27
28
+ let IS_FABRIC : null | boolean = null ;
29
+
28
30
export default function Pressable ( props : PressableProps ) {
29
31
const {
30
32
testOnly_pressed,
@@ -367,8 +369,6 @@ export default function Pressable(props: PressableProps) {
367
369
368
370
const gesture = Gesture . Simultaneous ( ...gestures ) ;
369
371
370
- const defaultRippleColor = android_ripple ? undefined : 'transparent' ;
371
-
372
372
// `cursor: 'pointer'` on `RNButton` crashes iOS
373
373
const pointerStyle : StyleProp < ViewStyle > =
374
374
Platform . OS === 'web' ? { cursor : 'pointer' } : { } ;
@@ -381,6 +381,18 @@ export default function Pressable(props: PressableProps) {
381
381
? children ( { pressed : pressedState } )
382
382
: children ;
383
383
384
+ const rippleColor = useMemo ( ( ) => {
385
+ if ( IS_FABRIC === null ) {
386
+ IS_FABRIC = isFabric ( ) ;
387
+ }
388
+
389
+ const defaultRippleColor = android_ripple ? undefined : 'transparent' ;
390
+ const unprocessedRippleColor = android_ripple ?. color ?? defaultRippleColor ;
391
+ return IS_FABRIC
392
+ ? unprocessedRippleColor
393
+ : processColor ( unprocessedRippleColor ) ;
394
+ } , [ android_ripple ] ) ;
395
+
384
396
return (
385
397
< GestureDetector gesture = { gesture } >
386
398
< NativeButton
@@ -389,7 +401,7 @@ export default function Pressable(props: PressableProps) {
389
401
hitSlop = { appliedHitSlop }
390
402
enabled = { isPressableEnabled }
391
403
touchSoundDisabled = { android_disableSound ?? undefined }
392
- rippleColor = { processColor ( android_ripple ?. color ?? defaultRippleColor ) }
404
+ rippleColor = { rippleColor }
393
405
rippleRadius = { android_ripple ?. radius ?? undefined }
394
406
style = { [ pointerStyle , styleProp ] }
395
407
testOnly_onPress = { IS_TEST_ENV ? onPress : undefined }
0 commit comments