fateh999 / react-native-paper-dropdown

Dropdown using react native paper TextInput and Menu
MIT License
130 stars 74 forks source link

How to change background color? #12

Closed sanket-3101 closed 3 years ago

rumwerfer commented 3 years ago

Hi, I was just wondering the same. It uses the surface color, so simply change that in your theme.

fateh999 commented 3 years ago

There are new props in v1.0.3 dropDownStyle & dropDownItemStyle that can help with your case

sanket-3101 commented 3 years ago

Thanks 👍

On Wed, Jun 9, 2021, 00:21 Fateh Farooqui @.***> wrote:

There are new props in v1.0.3 dropDownStyle & dropDownItemStyle that can help with your case

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fateh999/react-native-paper-dropdown/issues/12#issuecomment-857011726, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANVP5LKPJNXHLPFM73KCX23TRZRCPANCNFSM45PLBNOA .

tobecwb commented 2 years ago

It's not possible to change the background color of a "closed" dropdown, even with dropDownStyle and dropDownItemStyle. The surface color only works with background of the "menu" (after click on down arrow of dropdown).

samuelvisscher commented 2 years ago

Thanks @tobecwb that's very unfortunate. Means I will have to look for another library.

bondythegreat commented 1 year ago

since it uses paper's color.background:

const myTheme = useTheme() const customTheme = { ...myTheme, colors: { ...myTheme.colors, background: '#ffffff', // white background when closed }, }

<Dropdown theme={customTheme} />

muneerpuri commented 1 year ago
this code worked for me to change background color of the dropdown. -react native paper dropdown
    <DropDown
      // label={'P'}
      mode={'outlined'}
      visible={showMobileDropDOwn}
      showDropDown={() => setShowMobileDropDOwn(true)}
      onDismiss={() => setShowMobileDropDOwn(false)}
      setValue={setPhoneCountry}
      value={phoneCountry}
      list={codes}
      inputProps={{
        style:{
          width:90,
          backgroundColor: 'rgb(252,243,207)',
          height:20
        }
      }}
    />