@@ -28,19 +28,19 @@ or download the [Expo Go](https://expo.dev/go) app and scan the QR code below
2828## Nav
2929
3030- [ react-native-autocomplete-dropdown] ( #react-native-autocomplete-dropdown )
31- - [ Demo] ( #demo )
32- - [ Nav] ( #nav )
33- - [ Installation] ( #installation )
34- - [ Post-install Steps] ( #post-install-steps )
35- - [ iOS] ( #ios )
36- - [ Android] ( #android )
37- - [ Usage] ( #usage )
38- - [ Dataset item format] ( #dataset-item-format )
39- - [ Example with local Dataset] ( #example-with-local-dataset )
40- - [ Example with remote requested Dataset] ( #example-with-remote-requested-dataset )
41- - [ Playground] ( #playground )
42- - [ Options] ( #options )
43- - [ Contribution ] ( #contribution )
31+ - [ Demo] ( #demo )
32+ - [ Nav] ( #nav )
33+ - [ Installation] ( #installation )
34+ - [ Post-install Steps] ( #post-install-steps )
35+ - [ iOS] ( #ios )
36+ - [ Android] ( #android )
37+ - [ Usage] ( #usage )
38+ - [ Dataset item format] ( #dataset-item-format )
39+ - [ Example with local Dataset] ( #example-with-local-dataset )
40+ - [ Example with remote requested Dataset] ( #example-with-remote-requested-dataset )
41+ - [ Playground] ( #playground )
42+ - [ Options] ( #options )
43+ - [ Usage with a Modal ] ( #usage-with-a-modal )
4444
4545## Installation
4646
@@ -85,6 +85,8 @@ Wrap your root component in `AutocompleteDropdownContextProvider` from `react-na
8585< / AutocompleteDropdownContextProvider>
8686```
8787
88+ The dropdown position is relative to the ` AutocompleteDropdownContextProvider ` , so put this in the right place, it should cover all the screen/modal.
89+
8890If you have a header component, you can pass an offset. For example with react navigation
8991
9092``` js
@@ -305,4 +307,22 @@ yarn android
305307| ` textInputProps ` | text input props | TextInputProps | |
306308| ` flatListProps ` | props for \ component | FlatListProps\ | |
307309
308- ## Contribution
310+ ## Usage with a Modal
311+
312+ if you want to use the dropdown in a modal, you need to wrap the dropdown in another ` AutocompleteDropdownContextProvider ` inside the modal component
313+
314+ ``` js
315+ < Modal
316+ visible= {opened}
317+ presentationStyle= " formSheet"
318+ animationType= " slide"
319+ onRequestClose= {() => setOpened (false )}>
320+ < SafeAreaView style= {{ flex: 1 , backgroundColor: ' transparent' }}>
321+ < AutocompleteDropdownContextProvider>
322+ < View style= {{ paddingHorizontal: 20 , flex: 1 , paddingTop: 20 }}>
323+ < AutocompleteDropdown {... props}/ >
324+ < / View>
325+ < / AutocompleteDropdownContextProvider>
326+ < / SafeAreaView>
327+ < / Modal>
328+ ```
0 commit comments