n4kz / react-native-material-dropdown

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

Label Alignment #152

Open Ahmed-Imam opened 5 years ago

Ahmed-Imam commented 5 years ago

how to align the label to the right and change the fontFamily ?

ArsalanReal commented 5 years ago

any luck??

adamt19 commented 5 years ago

Also looking to set label styles.

ProfessionalAmateur commented 5 years ago

I'd like to change the font color & size of the label vs floating label color once a selection is picked.

ryanjorgensen commented 5 years ago

Same here, would like to change the fontFamily.

iamir4g commented 5 years ago

i want to RTL how to do this?

farooqmajeed commented 4 years ago

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

zmtmaster commented 4 years ago

You can control RTL or LTR using renderBase prop. Say you have a Row component that handles the direction

const styles = StyleSheet.create({
  default: {
    display: 'flex',
    flexDirection: 'row', // Here you can control the direction 
  },
});

function Row(props) {
  const style = Array.isArray(props.style) ? props.style : [props.style];

  return (
    <View {...props} style={[styles.default, ...style]}>
      {props.children}
    </View>
  );
}

Then you can just use it as follows.

<Dropdown
...dropdownProps
renderBase={props => {
            return (
              <Row>
                <Text>
                  {props.title}
                </Text>
                {props.renderAccessory() /* This part is the arrow */}
              </Row>
            );
          }}
>