@@ -23,9 +23,9 @@ import {
2323 generateBoxShadow ,
2424 styleAdapter ,
2525 useHaptic ,
26- useOnFocus ,
2726 useOnHover ,
2827 useScaleAnimation ,
28+ useWebFocusRing ,
2929} from "../../utils" ;
3030import { mergeRefs } from "../../utils/mergeRefs" ;
3131import { createIcon } from "../create-icon" ;
@@ -132,7 +132,7 @@ const RNCheckbox: React.FC<Partial<CheckboxProps>> = forwardRef<
132132 } = props ;
133133
134134 const { onHoverIn, onHoverOut, hovered } = useOnHover ( ) ;
135- const { onFocus , onBlur , focused } = useOnFocus ( ) ;
135+ const { focusProps , isFocusVisible , isFocused } = useWebFocusRing ( ) ;
136136 const { handlers, animatedStyle } = useScaleAnimation ( ) ;
137137 const hapticSelection = useHaptic ( ) ;
138138
@@ -264,6 +264,12 @@ const RNCheckbox: React.FC<Partial<CheckboxProps>> = forwardRef<
264264 ) ,
265265 ) ,
266266 // - Web only - Checkbox toggle on Spacebar Press
267+ /**
268+ * * The TypeScript error arises due to an inconsistency between the expected ViewStyle type
269+ * * and the specific styling provided for the web platform,
270+ * * which includes outline and boxShadow properties not defined in the ViewStyle type.
271+ */
272+ // @ts -ignore
267273 isFocussed && ! hasOnlyLabel
268274 ? Platform . select ( {
269275 web : {
@@ -357,8 +363,6 @@ const RNCheckbox: React.FC<Partial<CheckboxProps>> = forwardRef<
357363 // Web Callbacks
358364 onHoverIn = { onHoverIn }
359365 onHoverOut = { onHoverOut }
360- onFocus = { onFocus }
361- onBlur = { onBlur }
362366 // Web Callbacks
363367 // A11y Props
364368 accessibilityLabel = { accessibilityLabel }
@@ -369,6 +373,12 @@ const RNCheckbox: React.FC<Partial<CheckboxProps>> = forwardRef<
369373 accessibilityValue = { { text : props ?. value } }
370374 onAccessibilityTap = { handleChange }
371375 // A11y Props
376+ /**
377+ * * The TypeScript error arises due to an inconsistency between the expected ViewStyle type
378+ * * and the specific styling provided for the web platform,
379+ * * which includes outline and boxShadow properties not defined in the ViewStyle type.
380+ */
381+ // @ts -ignore
372382 style = { ( touchState : PressableStateCallbackType ) => [
373383 ts (
374384 cx (
@@ -388,7 +398,8 @@ const RNCheckbox: React.FC<Partial<CheckboxProps>> = forwardRef<
388398 : "" ,
389399 ) ,
390400 ) ,
391- focused . value
401+ Platform . OS === "web" ? checkboxTheme . web : { } ,
402+ isFocusVisible && isFocused
392403 ? Platform . select ( {
393404 web : {
394405 outline : 0 ,
@@ -429,12 +440,13 @@ const RNCheckbox: React.FC<Partial<CheckboxProps>> = forwardRef<
429440 } ) }
430441 disabled = { isDisabled }
431442 { ...( description ? { } : handlers ) }
443+ { ...focusProps }
432444 >
433445 { ( touchState : PressableStateCallbackType ) =>
434446 children ( {
435447 pressed : touchState . pressed ,
436448 isHovered : ! ! hovered . value ,
437- isFocussed : ! ! focused . value ,
449+ isFocussed : ! ! ( isFocusVisible && isFocused ) ,
438450 } )
439451 }
440452 </ Touchable >
0 commit comments