I am using react-native-actions-sheet v0.51.0 which recently added Typescript support:
export default function MyFunc(){ const actionSheetRef = createRef<ActionSheet>() useEffect(() => { actionSheetRef.current?.setModalVisible(props.open) }, [props.open]) return (<><ActionSheet ref={actionSheetRef} onClose={props.onClose}> // more code here ....<>)}
But with the new versions, now my code gets a Typescript error on the ref inside the <ActionSheet>
:
Type 'RefObject' is not assignable to type '(string &MutableRefObject<{ setModalVisible(visible?: boolean | undefined):void; show(): void; hide(): void; handleChildScrollEnd(): void;snapToOffset(offset: number): void; }>) | (RefObject<...> &MutableRefObject<...>) | (((instance: ActionSheet | null) => void) &MutableRefObject<...>) | undefined'. Type 'RefObject'is not assignable to type '((instance: ActionSheet | null) => void) &MutableRefObject<{ setModalVisible(visible?: boolean | undefined):void; show(): void; hide(): void; handleChildScrollEnd(): void;snapToOffset(offset: number): void; }>'.Type 'RefObject' is not assignable to type '(instance: ActionSheet | null) => void'.Type 'RefObject' provides no match for the signature '(instance: ActionSheet | null): void'.
Any idea how to solve?