NativeBase:如何在Toast内居中放置文本?

时间:2018-10-25 10:27:51

标签: react-native native-base

NativeBase的Toast标记显示的文本的默认位置在左侧:

enter image description here

问题:如何居中“清除缓存”文本?

所有这些尝试都无法产生所需的居中效果:

    Toast.show
        style: justifyContent: 'center', alignItems: 'center', alignSelf: 'center'
        text: 'cache cleared'
        textStyle: justifyContent: 'center', alignItems: 'center', alignSelf: 'center'

(CoffeeScript)

1 个答案:

答案 0 :(得分:0)

这就是你的做法

Toast.show({
  text: 'Some text',
  position: 'bottom',
  type: 'danger',
  duration: 1000,
  textStyle: {
    textAlign: 'center'
  }
})