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

React Native Web: better solution for specifying 'title' on Text component without TypeScript warning?

$
0
0

I was happy to find out I could do this (title is not a Text prop):

<Text title={item.description}>      {item.label}</Text>

On React Native, this does not show the description (which I con't care about for the moment) but on the web, it actually uses the title attribute.But since converting my code to TypeScript, this results in a warning. So I tried the following:

<Text      // eslint-disable-next-line @typescript-eslint/ban-ts-ignore      // @ts-ignore      title={item.description}      style={textStyle}>

and the warning was gone. But is there a better solution? Relatively new on TypeScript here.


Viewing all articles
Browse latest Browse all 6212

Trending Articles



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