fateh999 / react-native-paper-dropdown

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

Support for style attribute from React Native #94

Open prime4567 opened 1 year ago

prime4567 commented 1 year ago

I am passing StyleSheet via property "style". However, the StyleSheet doesn't seems to be processed.

Below is the code

<DropDown
    label="Category"
    mode="flat"
    visible={showMultiSelectDropDown}
    showDropDown={() => setShowMultiSelectDropDown(true)}
    onDismiss={() => setShowMultiSelectDropDown(false)}
    value={category}
    setValue={setCategory}
    list={ categoryList }
    style={ styles.expenseInput }
/>

and the StyleSheet

expenseInput: {
  marginVertical: 8
},

The margin however is not visible in the screen

Donorlin commented 6 months ago

You can use inputProps prop for styling the input.

As an example

<DropDown
    label="Category"
    mode="flat"
    visible={showMultiSelectDropDown}
    showDropDown={() => setShowMultiSelectDropDown(true)}
    onDismiss={() => setShowMultiSelectDropDown(false)}
    value={category}
    setValue={setCategory}
    list={ categoryList }
    inputProps={{ style:styles.expenseInput }} // THIS
/>