react-native-action-button icon indicating copy to clipboard operation
react-native-action-button copied to clipboard

Cant change height/width of textContainer and keep it centered

Open BoKKeR opened this issue 5 years ago • 4 comments

If I change the height/width of the textContainerStyle the textContainer won't be centered anymore as the textContainerStyle only applies to the inner container not the outer one. There should be a custom prop for this just like we have offsetX offsetY etc.

image image

BoKKeR avatar Nov 07 '19 16:11 BoKKeR

same problem :(

tannguyen05 avatar Dec 18 '19 08:12 tannguyen05

Try seting the textStyle of the ActionButton.Item to: textAlignVertical: 'center'.

It's working for me.

Skullcan avatar Jan 20 '20 10:01 Skullcan

@Skullcan can you share the whole source code of this part? Thanks in advance

HappyCodingLover avatar Sep 22 '20 21:09 HappyCodingLover

Sure, I have mine styled like this.

The ActionButton Item

<ActionButton.Item
   key={acao.id}
   size={acao.size}
   spaceBetween={12}
   textContainerStyle={styles.containerTitulos}
   textStyle={styles.textTitulos}
   buttonColor={acao.color}
   title={acao.title}
   onPress={() => handleOptionFabPress(acao.id)}
>
   <Icon name={acao.icon} type={acao.iconType} style={styles.actionButtonItemIcon} />
</ActionButton.Item>

The styles I used

const styles = StyleSheet.create({
  containerTitulos: {
    justifyContent: 'flex-start',
    alignItems: 'center',
    height: 40,
    marginTop: -8,
    minWidth: 200
  },
  textTitulos: {
    textAlign: 'left',
    textAlignVertical: 'center',
    fontWeight: '600',
    fontFamily: FONT_FAMILY_SEMI_BOLD,
    marginTop: Platform.OS === 'ios' ? 8 : 0,
    color: '#203E78'
  },
  actionButtonItemIcon: {
    color: '#fff'
  }
});

@Skullcan can you share the whole source code of this part? Thanks in advance

Skullcan avatar Sep 23 '20 10:09 Skullcan