通过使用此代码(在下面),该应用程序已 RTL,但左右的位置发生了变化(因此必须将右侧显示的内容转向左侧)。我通过教程做到了。
ReactNative.I18nManager.allowRTL(true);
另一个问题是当Mobile 的语言是LTR 时,图像和设计的位置会转向另一侧(例如从右到左的变化),因为App 只有一种LTR 语言。有什么办法可以像彼此一样显示 RTL 和 LTR 吗?
通过使用此代码(在下面),该应用程序已 RTL,但左右的位置发生了变化(因此必须将右侧显示的内容转向左侧)。我通过教程做到了。
ReactNative.I18nManager.allowRTL(true);
另一个问题是当Mobile 的语言是LTR 时,图像和设计的位置会转向另一侧(例如从右到左的变化),因为App 只有一种LTR 语言。有什么办法可以像彼此一样显示 RTL 和 LTR 吗?
您可以使用此代码:
第一的 :
import { I18nManager } from 'react-native';
App 类中的第二个使用这个:
constructor(props) {
super(props);
I18nManager.forceRTL(true);
}
像这样的东西:
import React, { Component } from 'react';
import { View, I18nManager } from 'react-native';
import { Header } from './src/components/common';
import LoginForm from './src/components/LoginForm';
class App extends Component {
constructor(props) {
super(props);
I18nManager.forceRTL(true);
}
render() {
return (
<View>
<Header headerText="Authentication" />
<LoginForm />
</View>
);
}
}
export default App;