React Native中的“右”等同于“左”

3
尝试在renderRow中显示列表项。 我已经在项目中实现了RTL,就像React Native文档中定义的那样,我通过console.log(I18nManager.isRTL ? 'yes' : 'no')获得了肯定的结果。
我正在尝试呈现一个设计好的表格单元格,因此它是一张图片,在这张图片上我正试图布置我的项目。 所以,该标志的样式定义如下:
var styles = StyleSheet.create({
  logo:{
    position: 'absolute',
    top:11,
    right:11,
    width: 26,
    height: 26
  }
  frame: {
    flex: 1,
    flexDirection:  'row',
    margin: 5,
  },


txtFirstName:{
    position:'absolute',
    top:7,
    right:40,
    marginRight:36,
    color:'white',
    fontSize:PixelRatio.get()*4/PixelRatio.getFontScale(),
    fontWeight:'bold',
    textAlign:'right',
    textShadowColor: 'black',
    textShadowOffset: {width:2,height:2},
    writingDirection : 'rtl'
  },

txtSecondName:{
    position:'absolute',
    top:17,
    right:40,
    marginRight:36,
    color:'white',
    fontSize:PixelRatio.get()*3/PixelRatio.getFontScale(),
    fontWeight:'bold',
    textAlign:'right',
    textShadowColor: 'black',
    textShadowOffset: {width:2,height:2},
    writingDirection : 'rtl'
  },

txtMainText:{
    position:'absolute',
    marginRight:36,
    color:'white',
    fontWeight:'bold',
    textAlign:'right',
    textShadowColor: 'black',
    textShadowOffset: {width:2,height:2},
    writingDirection : 'rtl',
    fontSize:PixelRatio.getPixelSizeForLayoutSize(3),
  },

});

  renderRow(rowData, sectionID, rowID) {
    return(
    <TouchableOpacity onPress={()=>this.showBusiness(rowData)}>
      <View style={{flex:1}}>
        <Image style={styles.logo} resizeMode = 'cover' source=}require('../images/logo.png’){/>
        <Image source={require('../images/mainFrame.png’){ style={styles.frame}/>
    <Text style={[styles.txtMainText,styles.txtFirstName]}>
      טקסט
    </Text>
    <Text style={[styles.txtMainText,styles.txtSecondName]}>
      מיושר לימין
    </Text>

      </View>
    </TouchableOpacity>
  );
  }

结果令人失望。
以下是应该看起来的样子: enter image description here 而现在却是这样: enter image description here 最让我困扰的是,以前看起来还好,我不确定是什么原因导致了这种情况。
此外,在应用程序启动时,“Loading”文本显示在窗口右侧。
1个回答

1
根据文档,“我们将JS端的左/右样式映射到开始/结束,在RTL布局中,所有代码中的左侧在屏幕上变为“右侧”,代码中的右侧在屏幕上变为“左侧”。 ”...您是否考虑过在定位时使用left而不是right?或者,考虑使用flex-start或flex-end以获得所需的结果。

你如何处理大量文本?它们向左换行,而不是向右。 - AmerllicA

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接