在本机中从右到左
Right to Left in react-native
通过使用这段代码(在下面),应用程序已经是 RTL,但是左右的位置发生了变化(所以必须显示在右边的东西变成了左边)。我通过 tutorial 做到了。
ReactNative.I18nManager.allowRTL(true);
另一个问题是,当 Mobile 的语言是 LTR 时,图像和设计的位置会变成另一侧(例如从右到左的变化),因为 App 只有一种 LTR 语言。有没有什么办法可以让 RTL 和 LTR 看起来一样??
您可以使用此代码:
首先:
import { I18nManager } from 'react-native';
应用程序中的第二个 class 使用此 :
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;
通过使用这段代码(在下面),应用程序已经是 RTL,但是左右的位置发生了变化(所以必须显示在右边的东西变成了左边)。我通过 tutorial 做到了。
ReactNative.I18nManager.allowRTL(true);
另一个问题是,当 Mobile 的语言是 LTR 时,图像和设计的位置会变成另一侧(例如从右到左的变化),因为 App 只有一种 LTR 语言。有没有什么办法可以让 RTL 和 LTR 看起来一样??
您可以使用此代码:
首先:
import { I18nManager } from 'react-native';
应用程序中的第二个 class 使用此 :
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;