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

How to use React Native props with interface props together

$
0
0

I have const Bar which uses React props to pass variables in text components. I'd also like to add in an interface props which enables onPress functionalities for buttons. Is there a way to combine and use React props with the interface Foo props? I want to be able to use React props and Foo props together at the same time.

interface Foo {  onPress: () => void;}const Bar = (props) => {<RectButton {...{ onPress }} />}

HomeScreen.tsx

const HomeScreen = ({  navigation,}: StackNavigationProps<Routes, "HomeScreen">) => {  return (<Bar onPress={() => navigation.navigate('Screen2)} />}

Viewing all articles
Browse latest Browse all 6287

Trending Articles



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