react-native-dropdown-picker icon indicating copy to clipboard operation
react-native-dropdown-picker copied to clipboard

Does this work with expo managed flow? dropDown Items not selecting.

Open Jsh007 opened this issue 3 years ago • 23 comments

dropDown Items not selecting: When I press to select a dropdown Item, it doesn't get selected and the dropdown remains open. Expo version: 38.0.8

Jsh007 avatar Oct 27 '20 10:10 Jsh007

Hello,

Send your code please.

hossein-zare avatar Oct 29 '20 23:10 hossein-zare

Hi @hossein-zare, same here. I tried both on Android and iOS and the bug seems to happen just on Android.

Device: OnePlus Nord Android version: 10 Build number: Oxygen OS 10.5.8

<DropDownPicker
    items={[ { ... } ]} // just value and label
    placeholder="Filter by category"
    onChangeItem={item => console.log('selected', item.value)}
    containerStyle={{ height: 70 }}
    dropDownMaxHeight={500}
    style={{ paddingHorizontal: 24, backgroundColor: colors.primary, borderWidth: 0 }}
    itemStyle={{ height: 70, paddingHorizontal: 24, justifyContent: 'flex-start', borderBottomWidth: 2, borderBottomColor: '#e7e7e7' }}
    dropDownStyle={{ backgroundColor: colors.whiteDark, paddingHorizontal: 0, paddingBottom: 0, borderBottomWidth: 0 }}
    labelStyle={{ fontFamily: 'Neue-Medium', fontSize: 16, lineHeight: 16 }}
    arrowSize={20}
/>

Thanks for the support and for the nice lib!

UPDATE: onChangeItem seems not to work when there's no content below the component

cescoallegrini avatar Nov 11 '20 01:11 cescoallegrini

I have the same problem in android 9, some solutions?

MisaelMa avatar Nov 21 '20 22:11 MisaelMa

Encountering the same on Android as well, though it does not seem limited to android 9 only

mikeslinkman avatar Dec 21 '20 09:12 mikeslinkman

I had the same problem. I solved it by putting a view underneath it with a height taller than the dropdown is when open. It seems there must be some element under the dropdown.

<DropDownPicker
                    items={[
                        { label: 'USA', value: 'usa' },
                        { label: 'UK', value: 'uk' },
                        { label: 'France', value: 'france' },
                    ]}
                    defaultValue='usa'
                    containerStyle={{ height: 40 }}
                    onChangeItem={item => {alert(item.value)}}
                />
                <View style={{height: 200}} />

ShiromMakkad avatar Dec 27 '20 05:12 ShiromMakkad

Please fix this issue as it makes it unusable on android, as we can't select any item.

shivamkj avatar Jan 13 '21 21:01 shivamkj

Please fix this issue as it makes it unusable on android, as we can't select any item.

containerStyle={{ ... zIndex:5000 }}

naldyn avatar Jan 25 '21 06:01 naldyn

Please fix this issue as it makes it unusable on android, as we can't select any item.

Same here, no chance with @naldyn or @ShiromMakkad workaround :(

Please note that I've been able to select items from the dropdown by commenting containerstyle (doc section : zIndex conflicts (Untouchable Items, Overlapping pickers), but my containerstyle has only a height value, nothing more, so that's quite strange.

Without containerstyle property it seems quite difficult to to design the picker correctly :(

Vaneste avatar Jan 25 '21 10:01 Vaneste

Ok, I finally managed to get it working :)

I had to :

  • move heigth from containerSize to style. => got it working but with placeholder invisible and arrow misplaced.

  • add flex-direction:"row" to containerStyle

Voilà !

Vaneste avatar Jan 25 '21 11:01 Vaneste

First of all, thanks for putting the time into this lib. It works great for me on iOS but I'm stuck with this same issue and it's the only thing holding me up from pushing this build. Any updates?

Thanks!

ghost avatar Feb 08 '21 10:02 ghost

Hello again, 😶

I'm really sorry for the late response, Github didn't notify me about comments in this issue.

This issue depends on your parent elements, if they have backgroundColor, borderColor props, The dropdown box will be visible but not touchable. I've used position: absolute in the package that's why React Native doesn't let the dropdown box be touchable. I'm not 100% sure if that's why it's not working.

Can someone please add full component code (DropDownPicker itself isn't enough) and an expo snack? 🤔

Similar issue: https://github.com/hossein-zare/react-native-dropdown-picker/issues/204

hossein-zare avatar Feb 13 '21 21:02 hossein-zare

After I stopped being an idiot and learned how to read, I read your notes about this issue and found the issue. If memory serves, it was having a borderwidth/color on the drop down container style. Moving those to a different style resolved it for me.

ghost avatar Feb 13 '21 21:02 ghost

I was able to make this work !

This is one difficult component to handle Inside the dropdown is a scrollView, that will not work if height is given implicitly, therefor this configuration did work... Also managed to remove borderWidth from the component.

            <DropDownPicker
                    items={[
                        { label: "Relevenace", value: "Relevance" },
                        { label: "Price High to Low", value: "Price High to Low" },
                        { label: "Price Low to High", value: "Price Low to High" }
                    ]}
                    defaultValue={filterSelected}
                    onChangeItem={(item) => {
                        console.log(item);
                        setFilterSelected(item.value)
                    }}
                    containerStyle={{
                        flex: 0.4
                    }}
                    style={{
                        width: 150,
                        borderWidth: 0
                    }}
                    labelStyle={{
                        fontSize: 13,
                        fontFamily: 'NotoSans-Bold',
                        color: colors.primary,
                    }}
                >
            </DropDownPicker>

sheikx1221 avatar Mar 23 '21 07:03 sheikx1221

I didn't specify any static height(but I have flexWrap: 'wrap', which I can't remove really since it would mess up my UI) and removed background color/width, borderWidth. And still doesn't work. Are there any other updates on this issue?

erkankarabulut avatar Mar 24 '21 08:03 erkankarabulut

Same issue on Android. Are there any updates?

eo-sdev avatar Mar 09 '22 16:03 eo-sdev

Same issue on Android. Are there any updates?

thanhdevapp avatar Apr 16 '22 08:04 thanhdevapp

@thanhdevapp https://hackernoon.com/i-thought-i-understood-open-source-i-was-wrong-cf54999c097b

mikehardy avatar Apr 16 '22 13:04 mikehardy

After I stopped being an idiot and learned how to read, I read your notes about this issue and found the issue. If memory serves, it was having a borderwidth/color on the drop down container style. Moving those to a different style resolved it for me.

Hi! I'm stuck with this issue here on my end. May I ask what did you mean by moving to a different style? Thanks for the reply in advance.

This issue depends on your parent elements, if they have backgroundColor, borderColor props, The dropdown box will be visible but not touchable.

@hossein-zare , i'd like to ask, by parent elements, does it mean the immediate parent elements of the picker? or does it include the parents of the parent element/component as well?

Same as the other guys above, I'm only encountering this issue on Android, it works seamlessly in iOS

Nestor231 avatar Apr 25 '22 08:04 Nestor231

@Nestor231 probably https://hossein-zare.github.io/react-native-dropdown-picker-website/docs/rules#avoid-inappropriate-styles

mikehardy avatar Apr 25 '22 14:04 mikehardy

@mikehardy Yeah I saw this, thing is i didn't even have those styles on my picker's immediate parent. nor have i set those styles in the containerstyle property

Nestor231 avatar Apr 25 '22 14:04 Nestor231

@Nestor231 All of your nested containers should follow the rules.

See: https://github.com/hossein-zare/react-native-dropdown-picker/issues/450#issuecomment-976497649

hossein-zare avatar Apr 25 '22 16:04 hossein-zare

@hossein-zare Thanks! I got it working now, For those having the same issues, posting this link for reference

Nestor231 avatar Apr 26 '22 02:04 Nestor231

I solved it like this https://github.com/hossein-zare/react-native-dropdown-picker/issues/204#issuecomment-1375368537

manawaraquevix avatar Jan 09 '23 10:01 manawaraquevix