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

React Native SegmentedControl: How can I use Typescript to type case the onChange "event"?

$
0
0

How can I use Typescript to type case the onChange "event"?

I've tried using (event: NativeEvent) as onChange={(event: NativeEvent) => setSegmentIndex(event.nativeEvent.selectedSegmentIndex)}, but no luck.

SegmentedControl.tsx

<SegmentedControl  values={['Active', 'Expired']}  selectedIndex={segmentIndex}  onChange={(event) => setSegmentIndex(event.nativeEvent.selectedSegmentIndex)}/>

Viewing all articles
Browse latest Browse all 6287

Trending Articles



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