Button中的文本不显示ios中的文本(本机库)

问题描述 投票:0回答:1

嗨,在我的项目中,我使用nativeBase。我用<Button><Text>blablabla</Text></Button>在android上正常运行时,但未显示run-ios文本时。这是我的组件:

<View style={{ marginLeft: 7, flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
  <View style={styles.btncontent}>
    <Right style={{ flex: 0.2 }}>
      <Image source={mapBtnLogo} style={styles.btnImage} />
    </Right>
    <Left style={{ flex: 0.8 }}>
      <Button full transparent style={styles.btn} onPress={() => props.myProps.gotoMap([section.YPOINT, section.XPOINT])}>
        <Text style={styles.btnText}>
          نمایش روی نقشه
                </Text>
      </Button>
    </Left>
  </View>
</View>

这是styles

const styles = StyleSheet.create({
  ...Platform.select({
    ios: {
      btnImage: {
        margin: 5,
        marginRight: 20,
        width: moderateScale(20),
        height: moderateScale(20),
      },
      btn: {
        //alignItems: 'flex-start',
        width: '100%',
        height: '10%',

      },
      btnText: {
        fontFamily: 'IRANSansMobile',
        fontSize: 15,
        color: '#000',
      },
    }, android: {
      btn: {
        width: '100%',
        height: '10%',
      },
      btnText: {
        fontFamily: 'IRANSansMobile',
        fontSize: 15,
        color: '#000000'
      },
      btncontent: {
        backgroundColor: '#59c5b8',
        flexDirection: 'row-reverse',
        alignItems: 'center',
        borderWidth: 0.3,
        borderRadius: 5,
        marginLeft: 10,
        width: '95%',
      },
    }

删除node module,然后重新安装无法正常工作。并清除Xcode并再次运行,但不起作用。我读了这篇文章NativeBase Button doesn't show text,但我没有使用padding,但仍然没有显示文字

react-native react-native-ios native-base
1个回答
0
投票

您可以尝试TouchableOpacity

<Left style={{ flex: 0.8 }}>
  <TouchableOpacity style={styles.btn} onPress={() => props.myProps.gotoMap([section.YPOINT, section.XPOINT])}>
    <Text style={styles.btnText}>
      نمایش روی نقشه
                </Text>
  </TouchableOpacity>
</Left>
© www.soinside.com 2019 - 2024. All rights reserved.