Export types for every component like "TextInputProps"
See original GitHub issueHello,
in current version of react-native-paper
i can not extend from TextInputProps in my custom component.
Current behaviour
No export in typescript/types.d.ts
for Props definitions
Expected behaviour
export of props definitions like “TextInputProps”
Code sample
// this is not a working example - only to view, what i mean :)
import React from 'react;
import { TextInput, --> TextInputProps <-- } from 'react-native-paper';
type MyCustomInputProps = TextInputProps & {
// ...mycustomprops
errorMessage?: string;
}
export function MyCustomInput({errorMessage, ...inputProps}: MyCustomInputProps): JSX.Element {
return (
<>
<TextInput {...inputProps} />
<HelperText type="error" visible={!!errorMessage}>{errorMessage}</HelperText>
</>
)
}
// File typescript/types.d.ts
...
export { default as TextInput, TextInputProps } from './components/TextInput/TextInput';
...
Your Environment
software | version |
---|---|
ios or android | |
react-native | 0.64.1 |
react-native-paper | ^4.8.1 |
node | 16.1.0 |
yarn | 1.22.5 |
react-native-vector-icons | 8.1.0 |
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Set Up Custom Component Type That Using TextInput props ...
I get the following error: 'CustomTextInput' refers to a value, but is being used as a type here. Did you mean 'typeof CustomTextInput'?...
Read more >TextInput - React Native
A foundational component for inputting text into the app via a keyboard. ... and different keyboard types, such as a numeric keypad.
Read more >A guide to React design patterns - LogRocket Blog
Explore the top React design patterns, like the render props pattern and the state reducer pattern, to solve issues experienced by ...
Read more >Time-Saving React Native TextInput Component - YouTube
In this video, we create a time-saving custom reusable textinput component with typescript. Part 4 of React Native Custom Components with ...
Read more >React Hook Form for React Native - Echobind
Optionally, you can also pass along any validation rules , and an inputs defaultValue . So let's add those as well to our...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Found a solution, that works for me.
Just use this import:
import { TextInputProps } from 'react-native-paper/lib/typescript/components/TextInput/TextInput';
Yes, this issue still exists with the latest version, because the types are missing in the build directory as described above 😉