File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 88import { useEffect , useMemo , useRef , useState } from "react" ;
99import { LayoutChangeEvent , Platform } from "react-native" ;
1010import { useSharedValue } from "react-native-reanimated" ;
11+ import {
12+ FocusRingAria ,
13+ useFocusRing as useWebOnlyFocusRing ,
14+ } from "@react-aria/focus" ;
1115
1216export const useOnFocus = ( ) => {
1317 const focused = useSharedValue ( 0 ) ;
@@ -113,3 +117,20 @@ export const useLayout = () => {
113117
114118 return { onLayout, layout } ;
115119} ;
120+
121+ export const useWebFocusRing = ( ) => {
122+ let useFocusRingHook : ( ) => FocusRingAria ;
123+
124+ if ( Platform . OS === "web" ) {
125+ // Import the hook only if the platform is web
126+ useFocusRingHook = useWebOnlyFocusRing ;
127+ } else {
128+ // If not on web platform, provide a dummy implementation
129+ useFocusRingHook = ( ) => ( {
130+ isFocusVisible : false ,
131+ isFocused : false ,
132+ focusProps : { } ,
133+ } ) ;
134+ }
135+ return useFocusRingHook ( ) ;
136+ } ;
You can’t perform that action at this time.
0 commit comments