fateh999 / react-native-paper-dropdown

Dropdown using react native paper TextInput and Menu
121 stars 72 forks source link

Apply margins fix from react-native-paper #102

Closed o-murphy closed 7 months ago

o-murphy commented 7 months ago

https://github.com/callstack/react-native-paper/pull/2997

o-murphy commented 7 months ago

For accepting native margins for the DropDown component

Add this please


const DropDown = forwardRef((props, ref) => {
    const activeTheme = useTheme();
    const { multiSelect = false, visible, onDismiss, showDropDown, value, setValue, 
        activeColor, mode, label, placeholder, inputProps, list, dropDownContainerMaxHeight, 
        dropDownContainerHeight, theme, dropDownStyle, dropDownItemStyle, dropDownItemSelectedStyle, 
        dropDownItemTextStyle, dropDownItemSelectedTextStyle, accessibilityLabel, 

        inputStyle  // the text input style 
    } = props;

And this

    <TextInput 

    style={inputStyle}

    value={displayValue} 
    mode={mode} label={label} 
    placeholder={placeholder} 
    pointerEvents={"none"} 
    theme={theme} 
    right={<TextInput.Icon name={visible ? "menu-up" : "menu-down"}/>} {...inputProps}
    />

This change apply to use it as is

        <CustomDropDown
        label={label}
        mode={"outlined"}
        visible={showDropDown}
        showDropDown={() => setShowDropDown(true)}
        onDismiss={() => setShowDropDown(false)}
        value={unit}
        setValue={setUnit}
        list={unitList}

        inputStyle={{
          marginVertical: 10
        }}
        />
o-murphy commented 7 months ago

sorry i forgot about inputProps property