0

I cannot scroll the page , so i need to view all the dropdown items in the menu, how do i do it ? here is my code. Any one solution : One i need a way to scroll down the page or I need to view all the items in dropdown at once.

<DropDownPicker
          open={open1}
          value={value1}
          items={items1}
          setOpen={setOpen1}
          setValue={setValue1}
          setItems={setItems1}
          containerStyle={{
            height: 40,
            width: "100%",
            marginBottom: 20,
            zIndex: 3,
          }}
          style={styles.dropdown}
          itemStyle={styles.dropdownItem}
          dropDownStyle={styles.dropdownDropdown}
          dropDownContainerStyle={{
            height: "600%",
          }}
        />

The height 600% is not working with any values its max is only 500%, Please help me, thanks : )

1 Answers1

0

Adjust the Dropdown Height:

<DropDownPicker
  // ... other props ...
  dropDownItemStyle={{ 
    justifyContent: 'flex-start', // Adjust the alignment of items if needed
    height: 60, // Adjust this height as needed
  }}
/>

Implement Scrollable Dropdown:

import { ScrollView } from 'react-native';

<DropDownPicker
  // ... other props ...
  customDropDown={() => (
    <ScrollView>
      <DropDownPicker
        open={open1}
        value={value1}
        items={items1}
        setOpen={setOpen1}
        setValue={setValue1}
        setItems={setItems1}
        containerStyle={{
          height: 40,
          width: "100%",
          marginBottom: 20,
          zIndex: 3,
        }}
        style={styles.dropdown}
        itemStyle={styles.dropdownItem}
        dropDownStyle={styles.dropdownDropdown}
        dropDownContainerStyle={{
          height: 300, // Adjust the height to your preference
        }}
      />
    </ScrollView>
  )}
/>

In this approach, the customDropDown property is used to wrap the DropDownPicker inside a ScrollView to enable scrolling within the dropdown.

prabu naresh
  • 405
  • 1
  • 10
  • Hi sir, i could not fix it , can you help me , here is the full code https://pastebin.com/jSizERkL – Mastermind Aug 25 '23 at 04:47
  • dropDownContainerStyle={{ height: 200,}} Try adjusting the dropDownContainerStyle for each dropdown to set a specific height that allows you to see all the items or scroll through them. – prabu naresh Aug 25 '23 at 04:56