【问题标题】:Text not displaying in ios app (REACT-NATIVE)ios应用程序中未显示文本(REACT-NATIVE)
【发布时间】:2019-11-19 06:06:38
【问题描述】:

文本在 ANDROID 中出现/显示,但在 IOS 中没有。只有出现/显示的图像。

           <Block center>
                <Block middle>
                <Image source={Images.LogoOnboarding} style={styles.logo} />
                  <Text color="black" size={10} style={{ textAlign: "center", width: 200, position: 'relative'}}  >
                  Take control of what your kids watch on the internet.{"\n"}{"\n"}
                  Discover kid-friendly channels for your kids.{"\n"}
                  Choose only the creators that make family- friendly videos.</Text>
                  <Image source={Images.LogoOnboarding2} style={styles.logo2} /> 
                </Block>
              </Block>  

这是我的风格代码:

logo: {
    width: 100,
    height: 100,
    zIndex: 2,
    position: 'relative',
    marginTop: '-50%'
  },
  logo2: {
    width: 400,
    height: 40,
    zIndex: 2,
    position: 'absolute',
    resizeMode: 'contain',
    marginBottom: 50

  }

【问题讨论】:

  • 尝试 Platform.ios 并发现任何变化

标签: reactjs react-native react-native-android expo


【解决方案1】:

colorsize 属性都不属于 Text 组件。考虑改用style 对象的colorfontSize 属性。我不是 100% 确定这是在 iOS 上不可见文本的原因,但它可能是 :)

【讨论】:

    【解决方案2】:

    在文本样式中添加高度
    示例

    <Text color="black" size={10} style={{ textAlign: "center", width: 200, height: 80, position: 'relative'}}  >Take control of what your kids watch on the internet.{"\n"}{"\n"}
                      Discover kid-friendly channels for your kids.{"\n"}
                      Choose only the creators that make family- friendly videos.
    </Text>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-21
      • 2021-12-23
      • 2021-09-06
      • 1970-01-01
      相关资源
      最近更新 更多