@@ -28,19 +28,19 @@ or download the [Expo Go](https://expo.dev/go) app and scan the QR code below
28
28
## Nav
29
29
30
30
- [ 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 )
44
44
45
45
## Installation
46
46
@@ -85,6 +85,8 @@ Wrap your root component in `AutocompleteDropdownContextProvider` from `react-na
85
85
< / AutocompleteDropdownContextProvider>
86
86
```
87
87
88
+ The dropdown position is relative to the ` AutocompleteDropdownContextProvider ` , so put this in the right place, it should cover all the screen/modal.
89
+
88
90
If you have a header component, you can pass an offset. For example with react navigation
89
91
90
92
``` js
@@ -305,4 +307,22 @@ yarn android
305
307
| ` textInputProps ` | text input props | TextInputProps | |
306
308
| ` flatListProps ` | props for \ component | FlatListProps\ | |
307
309
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