How can I add TypeScript types to a measure
callback within the onLayout
event?
<View ref={containerViewRef} onLayout={() => { if (containerViewRef.current) { containerViewRef?.current?.measure( (x, y, width, height, pageX, pageY): MeasureOnSuccessCallback => { setPageY(pageY); }, ); } }}>
measure
has this error:
TS2339: Property 'measure' does not exist on type 'never'.
And MeasureOnSuccessCallback
has this error:
TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.