n4kz / react-native-material-dropdown

Material dropdown with consistent behaviour on iOS and Android
Other
732 stars 597 forks source link

feat: Add `labelStyle` prop to set advanced label styling #208

Open diosney opened 4 years ago

diosney commented 4 years ago

As title says, styles like color, margin, paddings, and so on, would be very useful.

farooqmajeed commented 4 years ago

Just pass your styles to inputContainerStyle={{your styles}}

falcononrails commented 4 years ago

There is no prop called inputContainerStyle. The right prop is ContainerStyle and even this one doesn't change text styling on the label.

kumarutsav111 commented 4 years ago

There is inputContainerStyle, And it worked for me. Thanks @farooqmajeed

<Dropdown // ref={(input) => { this.slots = input; }} allowFontScaling={false} ref={this.slotsRef} style={{ // color:'blue',backgroundColor:'green', textColor: 'black', width: Platform.OS == 'ios' ? widthPercentageToDP("68%") : widthPercentageToDP("70%"), flexGrow: 1, flex: 0, alignItems: "center", // marginBottom: Platform.OS == 'ios' ? 8 : 0, marginLeft: Platform.OS == 'ios' ? 30 : 0,

              }}
              dropdownOffset ={{ top: 42 , left:50}}
              dropdownMargins={{ min: 21, max: 45, }}
              // dropdownPosition={ 2}
              overlayStyle={{marginTop:130}}
              // dropDownStyle={{backgroundColor: '#fafafa'}}
              value={this.state.selected_provider}
              onChangeText={(value, index) => {
                debugger
                const isWalletDropdownVisible = this.props.navigation.getParam(
                  'isWalletDropdownVisible'
                )
                this.props.navigation.setParams({
                  isWalletDropdownVisible: !isWalletDropdownVisible
                })
                this.slotChange(value, index) 
              }}
              label='Select a Practice'
              labelFontSize={25}
              inputContainerStyle={{marginLeft:30}}
              data={myFavouriteActors}
          />
theneekz commented 3 years ago

inputContainerStyle only accepts ViewStyle properties like margin. You can try labelTextStyle for things like fontFamily and fontStyle.