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

how to pass style props of a reusable component in react native using typescript

$
0
0

I want to make a reusable component in react-native using typescript.Most of the time I use this way as a simple react-native project. This time I want to use TypeScript instead of JavaScript. how can I do it?

import React from 'react'import { Text, StyleSheet, Platform } from 'react-native'import { RFValue } from "react-native-responsive-fontsize";const AppText = ({ children, style } ) => {    return (<Text style={[styles.textcommon, style]} > {children} </Text>    )}const styles = StyleSheet.create({    textcommon: {        fontSize: RFValue(18),        alignSelf: 'center',        color: '#fff',        fontFamily: Platform.OS === 'android' ? 'Roboto-Light' : 'Avenir',    }})export default AppText;

Viewing all articles
Browse latest Browse all 6287

Trending Articles



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