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

Extending react-native-paper Button and Text components in TypeScript

$
0
0

I was trying to make a reusable component using react-native-paper

the problem comes when I try to use extends a type from the package

import React from 'react';import {Button, Text} from 'react-native-paper';export type ButtonProps = React.ComponentProps<typeof Button>;type CustomButtonProps = ButtonProps & {title: string;};export const ButtonPaper: React.FC<CustomButtonProps> = ({title, ...props}) => {return (<Button mode="contained" {...props}>  welcome</Button>);};

everything is fine so far but when I try to use the component on the screen, typescript gives me that error

enter image description here

any solution for that?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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