lawnstarter / react-native-picker-select

🔽 A Picker component for React Native which emulates the native <select> interfaces for iOS and Android
https://npmjs.com/package/react-native-picker-select
MIT License
1.73k stars 491 forks source link

.togglePicker() is not working on android #511

Open romanmatus opened 11 months ago

romanmatus commented 11 months ago

.togglePicker() is not working on android but on iOS is working fine

This works perfectly on ios, but on android it is working only if you press inside red square, but i need it work if i press inside blue rectangle as on image below. image

To Reproduce
Steps to reproduce the behavior:

  1. .togglePicker() is working, but it is not oppening anything

Expected behavior
If i press inside blue rectangle, it should open picker select

Screenshots
image

Additional details

Reproduction and/or code sample

const handlePickerToggle = () => {
    if (dropDownRef.current) {
      if (Platform.OS === 'android') {
      dropDownRef.current.togglePicker();
      console.log("iam here")
      }
      else{
      dropDownRef.current.togglePicker();
      }
    }
  };
<TouchableOpacity className="bg-blue-200" onPress={handlePickerToggle}>
          <View className="h-full flex-row items-center">
            <Image
              className="h-6 w-6 mr-2 ml-2"
              source={getImageSource(nationalPrefix)}
            />
            <DropDown 
              ref={dropDownRef}
              fixAndroidTouchableBug={true}
              useNativeAndroidPickerStyle={false}
              placeholder={{
                label: "USA",
                value: "+1",
                inputLabel: "+1",
              }}
              onValueChange={(value) => {
                setNationalPrefix(value);
                handleValueChange();
              }}
              style={pickerStyle}
              items={[
                { label: "Australia", value: "+61", inputLabel: "+61" },
                { label: "UK", value: "+44", inputLabel: "+44" },
              ]}

            />

            <Feather
              className="ml-2 mr-2"
              name={"chevron-down"}
              size={20}
              color="#899295"
            />
          </View>
        </TouchableOpacity>
focux commented 8 months ago

I'm having the same problem. Did you find a work-around?

satanand7 commented 8 months ago

I am also facing the same issue. How much time it will take to fix this?

adrianso commented 7 months ago

Have you tried setting fixAndroidTouchableBug to true? Seems to work for me.

dzpt commented 22 hours ago

@adrianso no, it does not work. any workaround for this?