File tree Expand file tree Collapse file tree 4 files changed +13
-3
lines changed Expand file tree Collapse file tree 4 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1
1
import React , { memo , useState } from 'react'
2
+ import { useRef } from 'react'
2
3
import { useMemo } from 'react'
3
4
import { Text , View } from 'react-native'
4
5
import { AutocompleteDropdown } from 'react-native-autocomplete-dropdown'
@@ -8,12 +9,16 @@ Feather.loadFont()
8
9
9
10
export const CustomRightIconExample = memo ( ( ) => {
10
11
const [ selectedItem , setSelectedItem ] = useState ( null )
12
+ const dropdownController = useRef ( null )
11
13
12
14
const dataSet = useMemo ( generateDataSet , [ ] )
13
15
14
16
return (
15
17
< View >
16
18
< AutocompleteDropdown
19
+ controller = { controller => {
20
+ dropdownController . current = controller
21
+ } }
17
22
clearOnFocus = { false }
18
23
onSelectItem = { setSelectedItem }
19
24
dataSet = { dataSet }
@@ -25,6 +30,9 @@ export const CustomRightIconExample = memo(() => {
25
30
</ Text >
26
31
) }
27
32
RightIconComponent = { < Feather name = "smile" size = { 18 } color = "#f55" /> }
33
+ onRightIconComponentPress = { ( ) => {
34
+ dropdownController . current ?. toggle ( )
35
+ } }
28
36
showChevron = { false }
29
37
/>
30
38
< Text style = { { color : '#668' , fontSize : 13 } } > Selected item: { JSON . stringify ( selectedItem ) } </ Text >
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " react-native-autocomplete-dropdown-playground" ,
3
- "version" : " 1.2.0" ,
3
+ "version" : " 2.1.0" ,
4
+ "author" :
" Alexandr Kozhevnikov <[email protected] >" ,
5
+ "license" : " MIT" ,
4
6
"scripts" : {
5
7
"android" : " react-native run-android" ,
6
8
"ios" : " react-native run-ios" ,
Original file line number Diff line number Diff line change 45
45
"dependencies" : {
46
46
"lodash.debounce" : " *" ,
47
47
"prop-types" : " *" ,
48
- "react-native-size-matters" : " ^0.3.0 || ^0. 4.0" ,
48
+ "react-native-size-matters" : " ^0.4.0" ,
49
49
"react-native-vector-icons" : " >=7.0.0"
50
50
},
51
51
"bugs" : {
Original file line number Diff line number Diff line change @@ -2891,7 +2891,7 @@ react-is@^16.13.1:
2891
2891
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
2892
2892
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
2893
2893
2894
- " react-native-size-matters@^0.3.0 || ^0. 4.0 " :
2894
+ react-native-size-matters@^0.4.0 :
2895
2895
version "0.4.0"
2896
2896
resolved "https://registry.yarnpkg.com/react-native-size-matters/-/react-native-size-matters-0.4.0.tgz#01bfd0d59454318f4e0b13fe9c1eb0523d70f2e0"
2897
2897
integrity sha512-8/C0htHrFWeUm9N8JegmadovUfgTWkGBkDPZ1N3YkXtDWb+98Ya2gThiKcu445r8c7YhcrBfnHz/mYsXIusaOQ==
You can’t perform that action at this time.
0 commit comments