Handle autocomplete input changes to keep selection
This commit is contained in:
@@ -83,7 +83,15 @@ export const AddItemScreen = () => {
|
|||||||
value={selectedProduct}
|
value={selectedProduct}
|
||||||
onChange={(_, value) => setSelectedProduct(value)}
|
onChange={(_, value) => setSelectedProduct(value)}
|
||||||
inputValue={query}
|
inputValue={query}
|
||||||
onInputChange={(_, value) => setQuery(value)}
|
onInputChange={(_, value, reason) => {
|
||||||
|
if (reason === 'input') {
|
||||||
|
setQuery(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reason === 'clear') {
|
||||||
|
setQuery('');
|
||||||
|
}
|
||||||
|
}}
|
||||||
filterOptions={(options) => options}
|
filterOptions={(options) => options}
|
||||||
noOptionsText={query.trim() ? 'No matching products' : 'No products available'}
|
noOptionsText={query.trim() ? 'No matching products' : 'No products available'}
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|||||||
Reference in New Issue
Block a user