Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.togglePicker() is not working on android #511

Open
romanmatus opened this issue Jul 24, 2023 · 3 comments
Open

.togglePicker() is not working on android #511

romanmatus opened this issue Jul 24, 2023 · 3 comments

Comments

@romanmatus
Copy link

.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

  • Device: [Pixel 3a]
  • OS: [Android 14]
  • react-native-picker-select version: [8.0.4]
  • react-native version: [0.72.3]
  • expo sdk version: [49.0.3]

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
Copy link

focux commented Nov 3, 2023

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

@satanand7
Copy link

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

@adrianso
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants