react-native-actions-sheet: Usage example for Typescript - getting an error
Hello,
I posted this issue on SO regarding the usage with Typescript. Can you please assist?
https://stackoverflow.com/questions/68757797/typescript-createref-for-actionsheet-react-native
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 ....
<>)
}
I also added a tag for your project so others can find it easier.
Thanks for the great library!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 16 (6 by maintainers)
@johnbonds
should work.
Fixed in
v0.5.3
. UseActionSheetRefObject
type.Use as it is used in the example. Don’t use
createRef
in functional components. UseuseRef<ActionSheet>()
.