Skip to content

Commit e012e77

Browse files
authored
Fix/types (#149)
* release: 4.1.0 * release: 4.2.0 * fix: fix types
1 parent 99317bd commit e012e77

File tree

6 files changed

+63
-23
lines changed

6 files changed

+63
-23
lines changed

.commitlintrc.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"extends": ["@commitlint/config-conventional"],
3+
"rules": {
4+
"type-enum": [
5+
2,
6+
"always",
7+
[
8+
"build",
9+
"chore",
10+
"ci",
11+
"docs",
12+
"feat",
13+
"fix",
14+
"perf",
15+
"refactor",
16+
"revert",
17+
"style",
18+
"test",
19+
"release"
20+
]
21+
],
22+
"subject-case": [2, "never", ["sentence-case", "start-case", "pascal-case", "upper-case"]]
23+
}
24+
}

.markdownlint.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"default": true,
3-
"MD007": { "indent": 4 },
3+
"MD007": { "indent": 8 },
4+
"MD045": false,
45
"MD013": {"line_length": 800},
56
"MD033": false,
67
"no-hard-tabs": false

README.md

+34-14
Original file line numberDiff line numberDiff line change
@@ -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+
8890
If 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+
```

example/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-autocomplete-dropdown-playground",
3-
"version": "4.0.0",
3+
"version": "4.1.0",
44
"private": true,
55
"license": "MIT",
66
"author": "Alexandr Kozhevnikov <[email protected]>",

package.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-autocomplete-dropdown",
3-
"version": "4.0.0",
3+
"version": "4.2.0",
44
"description": "Dropdown Item picker with search and autocomplete (typeahead) functionality for react native",
55
"keywords": [
66
"react-native",
@@ -48,11 +48,6 @@
4848
"tsc": "tsc --noEmit",
4949
"typecheck": "tsc --noEmit"
5050
},
51-
"commitlint": {
52-
"extends": [
53-
"@commitlint/config-conventional"
54-
]
55-
},
5651
"resolutions": {
5752
"@types/react": "^18.2.44"
5853
},

src/types/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface IAutocompleteDropdownRef {
1111
clear: () => void
1212
close: () => void
1313
blur: () => void
14-
open: (params: { focused: false }) => Promise<void>
14+
open: (params?: { focused: boolean }) => Promise<void>
1515
setInputText: (text: string) => void
1616
toggle: () => void
1717
setItem: (item: AutocompleteDropdownItem) => void

0 commit comments

Comments
 (0)