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

Extending react-native-paper components in TypeScript

$
0
0

I'm struggling to extend the react-native-paper components correctly. What am I doing wrong or how to do it correctly? actually, I'm not totally new to Typescript, but I always struggled with this one:

// TextInput.tsximport React from "react";import { TextInput as PaperTextInput } from "react-native-paper";import { TextInputProps } from "react-native-paper/lib/typescript/src/components/TextInput/TextInput";interface MyTextInputProps extends TextInputProps {}const MyTextInput: React.FC<MyTextInputProps> = (props) => {  return <PaperTextInput {...props} />;};export default MyTextInput;
// Usage:<TextInput mode="outlined" style={styles.input} label="Email" />

And I get this error:

Property 'theme' is missing in type '{ mode: "outlined"; style: { alignSelf: "stretch"; }; label: string; }' but required in type 'MyTextInputProps'


Viewing all articles
Browse latest Browse all 6213

Trending Articles



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