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)} />}