Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6211

TypeScript types for React Native's measure callback within a onLayout event?

$
0
0

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.


Viewing all articles
Browse latest Browse all 6211

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>