hossein-zare / react-native-dropdown-picker

A single / multiple, categorizable, customizable, localizable and searchable item picker (drop-down) component for react native which supports both Android & iOS.
https://hossein-zare.github.io/react-native-dropdown-picker-website/
MIT License
992 stars 296 forks source link

Dropdown going up instead of down.!!👀 #528

Closed premdasvm closed 2 years ago

premdasvm commented 2 years ago

Hi @hossein-zare My Dropdown list goes up like this instead of down, any ideas why?

Screenshot 2022-03-30 at 1 55 57 AM

My Component

import React, { useState } from 'react';
import DropDownPicker from 'react-native-dropdown-picker';
import { Card } from 'react-native-paper';
import { COLORS } from '../theme/colors';

const PaymentTypePicker = ({ width }) => {
  const [open, setOpen] = useState(false);
  const [value, setValue] = useState(null);
  const [items, setItems] = useState([
    { label: 'Cash', value: 'Cash' },
    { label: 'UPI', value: 'UOI' },
    { label: 'Net Banking', value: 'NetBanking' },
  ]);
  return (
    <Card
      mode="elevated"
      style={{
        flex: 1,
        marginVertical: 5,
        borderRadius: 10,
      }}
      elevation={2}>
      <DropDownPicker
        open={open}
        value={value}
        items={items}
        setOpen={setOpen}
        setValue={setValue}
        setItems={setItems}
        style={{ borderWidth: 0 }}
        placeholder="Choose"
        textStyle={{ color: COLORS.black, opacity: 0.5 }}
        dropDownContainerStyle={{
          borderWidth: 0,
          shadowOpacity: 0.1,
          shadowRadius: 2,
          shadowColor: '#000',
          overflow: 'visible',
          elevation: 2,
        }}
        arrowIconStyle={{ opacity: 0.2, marginRight: 10 }}
        labelStyle={{ color: COLORS.black }}
        listMode="SCROLLVIEW"
      />
    </Card>
  );
};

export default PaymentTypePicker;
hossein-zare commented 2 years ago

Hi,

When there's not enough space at the bottom, the direction changes to TOP automatically. If you think it's a bug please take a full screenshot of your screen.

https://hossein-zare.github.io/react-native-dropdown-picker-website/docs/advanced/dropdown-box#dropdowndirection https://hossein-zare.github.io/react-native-dropdown-picker-website/docs/advanced/dropdown-box#bottomoffset

utkuimd commented 10 months ago

bottomOffset solved my problem, thanks