通过使用这个代码(在下面),应用程序已经RTL但右和左的位置发生了变化(所以必须在右边显示的东西都转向左).我是通过教程完成的.
ReactNative.I18nManager.allowRTL(true);
Run Code Online (Sandbox Code Playgroud)
另一个问题是当Mobile的语言是LTR时,图像和设计的位置变成了另一面(例如从右到左的变化),因为App只有一种LTR语言.有没有办法让人们像对方一样展示RTL和LTR?
我在 react-native 中引入了一个用于搜索的 Texinput。以下是代码:
constructor(props){
super(props);
this.state = {
value : "",
items: [],
}
this.handleHeaderSearch = this.handleHeaderSearch.bind(this);
this.handleSearchBtn = this.handleSearchBtn.bind(this);
}
handleSearchBtn(){
}
handleHeaderSearch(){
if(!this.state.value) return;
}
Run Code Online (Sandbox Code Playgroud)
和:
<TextInput
value={this.props.value}
onChange = {this.props.onChange}
placeholder={"?????"}
blurOnSubmit={false}
style={{flex:0.9}}
returnKeyType="done"
/>
Run Code Online (Sandbox Code Playgroud)
每当我在输入文本后运行 Android 时,我都会看到以下警告:
“警告失败的道具类型无效道具“值”的类型“对象”提供给 TextInput,预期为“字符串”