Skip to content

Commit 079c5b2

Browse files
add theme prop (#165)
1 parent 9f00e71 commit 079c5b2

File tree

5 files changed

+6
-1
lines changed

5 files changed

+6
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ yarn android
285285
| `direction` | "up" or "down" | string | down + auto calculate |
286286
| `matchFrom` | Whether match suggestions from start of titles or anywhere in the title. Possible values are "any" or "start" | string | any |
287287
| `bottomOffset` | For calculate dropdown direction (e.g., tabbar) | number | 0 |
288+
| `theme` | Color scheme. Possible values are "light" or "dark" | string | OS's color scheme |
288289
| `onChangeText` | Event textInput onChangeText | function | |
289290
| `onSelectItem` | Event onSelectItem | function | |
290291
| `onOpenSuggestionsList` | Event onOpenSuggestionsList | function | |

README^2.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ npm run ios
239239
| `direction` | "up" or "down" | string | down + auto calculate |
240240
| `position` | "relative" or "absolute" | string | relative |
241241
| `bottomOffset` | for calculate dropdown direction (e.g. tabbar) | number | 0 |
242+
| `theme` | Color scheme. Possible values are "light" or "dark" | string | OS's color scheme |
242243
| `onChangeText` | event textInput onChangeText | function | |
243244
| `onSelectItem` | event onSelectItem | function | |
244245
| `onOpenSuggestionsList` | event onOpenSuggestionsList | function | |

README^3.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ yarn ios
277277
| `direction` | "up" or "down" | string | down + auto calculate |
278278
| `matchFrom` | whether match suggestions from start of titles or anywhere in the title. Possible values are "any" or "start" | string | any |
279279
| `bottomOffset` | for calculate dropdown direction (e.g. tabbar) | number | 0 |
280+
| `theme` | Color scheme. Possible values are "light" or "dark" | string | OS's color scheme |
280281
| `onChangeText` | event textInput onChangeText | function | |
281282
| `onSelectItem` | event onSelectItem | function | |
282283
| `onOpenSuggestionsList` | event onOpenSuggestionsList | function | |

src/Dropdown.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ export const Dropdown = memo((props: DropdownProps) => {
1818
ListEmptyComponent,
1919
ItemSeparatorComponent,
2020
direction,
21+
theme,
2122
...rest
2223
} = props
23-
const themeName = useColorScheme()
24+
const themeName = theme || useColorScheme()
2425
const styles = useMemo(() => getStyles(themeName || 'light'), [themeName])
2526

2627
const defaultItemSeparator = useMemo(() => {

src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export interface IAutocompleteDropdownProps {
4646
position?: 'absolute' | 'relative'
4747
bottomOffset?: number
4848
textInputProps?: TextInputProps
49+
theme?: 'light' | 'dark'
4950
onChangeText?: (text: string) => void
5051
onSelectItem?: (item: AutocompleteDropdownItem | null) => void
5152
renderItem?: (item: AutocompleteDropdownItem, searchText: string) => React.ReactElement | null

0 commit comments

Comments
 (0)