@@ -4,19 +4,21 @@ import {
4
4
SearchBarCommands ,
5
5
SearchBarProps ,
6
6
} from 'react-native-screens' ;
7
- import { View , NativeSyntheticEvent , TargetedEvent , TextInputFocusEventData } from 'react-native' ;
7
+ import { View } from 'react-native' ;
8
8
9
9
// Native components
10
10
import SearchBarNativeComponent , {
11
11
Commands as SearchBarNativeCommands ,
12
- SearchBarNativeProps ,
12
+ NativeProps as SearchBarNativeProps ,
13
13
SearchBarEvent ,
14
14
SearchButtonPressedEvent ,
15
15
ChangeTextEvent ,
16
16
} from '../fabric/SearchBarNativeComponent' ;
17
17
import { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes' ;
18
18
19
- export const NativeSearchBar : React . ComponentType < SearchBarNativeProps > &
19
+ export const NativeSearchBar : React . ComponentType <
20
+ SearchBarNativeProps & { ref ?: React . RefObject < SearchBarCommands > }
21
+ > &
20
22
typeof NativeSearchBarCommands =
21
23
SearchBarNativeComponent as unknown as React . ComponentType < SearchBarNativeProps > &
22
24
SearchBarCommandsType ;
@@ -83,17 +85,17 @@ function SearchBar(props: SearchBarProps, ref: React.Ref<SearchBarCommands>) {
83
85
84
86
return (
85
87
< NativeSearchBar
88
+ ref = { searchBarRef }
89
+ { ...props }
86
90
onSearchFocus = { props . onFocus as DirectEventHandler < SearchBarEvent > }
87
91
onSearchBlur = { props . onBlur as DirectEventHandler < SearchBarEvent > }
88
92
onSearchButtonPress = {
89
- props . onSearchButtonPress as DirectEventHandler < TextInputFocusEventData >
93
+ props . onSearchButtonPress as DirectEventHandler < SearchButtonPressedEvent >
90
94
}
91
95
onCancelButtonPress = {
92
96
props . onCancelButtonPress as DirectEventHandler < SearchBarEvent >
93
97
}
94
98
onChangeText = { props . onChangeText as DirectEventHandler < ChangeTextEvent > }
95
- { ...props }
96
- ref = { searchBarRef }
97
99
/>
98
100
) ;
99
101
}
0 commit comments