I am trying to figure out how I need to use React.createRef()
in react native with typescript as following code throws errors
// ...
circleRef = React.createRef();
componentDidMount() {
this.circleRef.current.setNativeProps({
someProperty: someValue
});
}
// ...
Currently following errors are thrown for this.circleRef.current.setNativeprops
[ts] Object is possibly 'null'. (property) React.RefObject<{}>.current: {} | null
and
[ts] Property 'setNativeProps' does not exist on type '{}'. any
any ideas?
const customCompRef = React.createRef<CustomComponentType>()
– Hairtail