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

How to get style props suggestions with react native typescript re-usable component?

$
0
0

I have a text re-usable component coded like this :

import React, {FC, ReactNode} from 'react';import {StyleSheet, Text as RNText} from 'react-native';interface TextProps {  style?: any;  children: ReactNode | ReactNode[];}const Text: FC<TextProps> = ({style, children}) => {  return <RNText style={{...styles.text, ...style}}>{children}</RNText>;};export default Text;const styles = StyleSheet.create({  text: {    color: colors.black,    fontFamily: fonts.light,  },});

So every time I want to style it I don't get any prop suggestions for styling a react native text component :

enter image description here

How can I get all react native styles props suggestions for a custom re-usable made component with typescript ?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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