SearchBar Typescript types are broken
See original GitHub issueExplain what you did (Required)
I’m using SearchBar in typescript. I have a state variable to store the search text:
const [search, setSearch] = React.useState<string>();
return (
<SearchBar
onChangeText={setSearch}
/>
)
Expected behavior (Required)
I expect this to be a valid usage according to Typescript.
Describe the bug (Required)
TS says onChangeText doesn’t match, but the required property type is essentially disjoint (I think).
index.tsx(74,11): error TS2322: Type '(text: string) => void' is not assignable to type '((text: string) => void) & ((text: string) => void) & (() => any) & (() => any) & (() => any) & ((text: string) => void) & (() => any) & (() => any) & (() => any)'.
Type '(text: string) => void' is not assignable to type '() => any'.
Your Environment (Required):
software | version |
---|---|
react-native-elements | 3.4.2 |
react-native | 0.64.2 |
Issue Analytics
- State:
- Created 2 years ago
- Reactions:10
- Comments:20 (3 by maintainers)
Top Results From Across the Web
Typescript error when using SearchBar from react-native ...
According to this issue, the type definition is broken in the latest version. Until the new version come out, you can do the...
Read more >SearchBar typescript props missing · Issue #2878 - GitHub
I get a typescript error on: searchFieldRef.current?.blur(); - it doesn't know about blur. ref={searchFieldRef} on the SearchField itself.
Read more >Search Bar in React featuring Typescript and Redux | by Roza J
Have been using Typescript and Redux lately and thought it would be a ... 4: Break List into its own component; Step 5:...
Read more >Example of Search Bar in React Native - Snack
Searching using Search Bar Filter in React Native List View // https://aboutreact.com/react-native-search-bar-filter-on-listview/ // import React in our ...
Read more >How to Filter and Search using Variables in Apollo Client
This last step is broken into two parts. First, we update the query to use a query variable called albumsInput to refer to...
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
Any updates on this?
What is the release plan for the same? been 25 days since the last activity here. And no new release has been done.