React Native 上的 Right is Left
Right is Left on React Native
正在尝试在 renderRow 中显示列表项。
我已经在我的项目 as defined on react native documentation 中实现了 RTL,我对 console.log(I18nManager.isRTL ? 'yes' : 'no')
.
的评价是积极的
我正在尝试展示一个设计好的 table 单元格,所以它是一个图像,我正在尝试在其上布置我的项目。
所以徽标的定义样式如下:
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>
);
}
结果令人失望。
下面是它应该的样子:
现在是这样的:
最让我困扰的是它以前看起来还不错,我不确定是什么让它变成这样。
此外,当应用程序启动时,"Loading" 文本显示在 window 的右侧。
根据文档:"we map the left/right styles from the JS side to start/end, all left in code for RTL layout becomes "right" 在屏幕上,代码中的 right 在屏幕上变为 "left"。"...您是否考虑过使用 left 而不是 right 进行定位?或者,考虑使用 flex-start 或 flex-end 以获得所需的结果。
正在尝试在 renderRow 中显示列表项。
我已经在我的项目 as defined on react native documentation 中实现了 RTL,我对 console.log(I18nManager.isRTL ? 'yes' : 'no')
.
的评价是积极的
我正在尝试展示一个设计好的 table 单元格,所以它是一个图像,我正在尝试在其上布置我的项目。
所以徽标的定义样式如下:
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>
);
}
结果令人失望。
下面是它应该的样子:
现在是这样的:
最让我困扰的是它以前看起来还不错,我不确定是什么让它变成这样。
此外,当应用程序启动时,"Loading" 文本显示在 window 的右侧。
根据文档:"we map the left/right styles from the JS side to start/end, all left in code for RTL layout becomes "right" 在屏幕上,代码中的 right 在屏幕上变为 "left"。"...您是否考虑过使用 left 而不是 right 进行定位?或者,考虑使用 flex-start 或 flex-end 以获得所需的结果。