File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ const YourComponent = () => {
106
106
| debounceDelay | number | No | 200 | Delay before triggering search |
107
107
| showLoadingIndicator | boolean | No | true | Show/hide loading indicator |
108
108
| style | StyleProp | No | {} | Custom styles object |
109
+ | onTextChange | (text: string) => void | No | - | Callback triggered on text input changes |
109
110
110
111
## Methods
111
112
Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ const GooglePlacesTextInput = forwardRef(
81
81
biasPrefixText,
82
82
minCharsToFetch = 1 ,
83
83
onPlaceSelect,
84
+ onTextChange,
84
85
debounceDelay = 200 ,
85
86
showLoadingIndicator = true ,
86
87
style = { } ,
@@ -172,7 +173,8 @@ const GooglePlacesTextInput = forwardRef(
172
173
173
174
const handleTextChange = ( text ) => {
174
175
setInputText ( text ) ;
175
- onPlaceSelect ( null ) ; // Notify parent when text changes
176
+ onPlaceSelect ( null ) ;
177
+ onTextChange ?. ( text ) ;
176
178
177
179
if ( debounceTimeout . current ) {
178
180
clearTimeout ( debounceTimeout . current ) ;
@@ -190,7 +192,7 @@ const GooglePlacesTextInput = forwardRef(
190
192
onPlaceSelect ( place ) ; // Notify parent with selected place
191
193
} ;
192
194
193
- // Show suggestions on focus if text length > 1
195
+ // Show suggestions on focus if text length > minCharsToFetch
194
196
const handleFocus = ( ) => {
195
197
if ( inputText . length >= minCharsToFetch ) {
196
198
fetchPredictions ( inputText ) ;
You can’t perform that action at this time.
0 commit comments