以下代码是我ScrollView在react native项目中的代码:
<ScrollView
ref={(scrollView) => { this._scrollView = scrollView; }}
horizontal={true}
showsHorizontalScrollIndicator={false}
showsVerticalScrollIndicator={false}
directionalLockEnabled={true}
bounces={false}
scrollsToTop={false}
>
Run Code Online (Sandbox Code Playgroud)
现在它从左向右移动,如何在第一次加载时从右向左移动?
首先,我在 android 上工作并且 RTL 运行良好,我添加了以下代码:
I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance();
sharedI18nUtilInstance.setAllowRTL(context, true);
Run Code Online (Sandbox Code Playgroud)
到 MainActivity.java 和
android:supportsRtl="true"
Run Code Online (Sandbox Code Playgroud)
到 AndroidManifest.xml
并在js代码中:
I18nManager.forceRTL(true);
Run Code Online (Sandbox Code Playgroud)
现在是问题:我尝试在 ios 上设置 rtl 但它不起作用我添加了
// in AppDelegate.m
[[RCTI18nUtil sharedInstance] allowRTL:YES];
Run Code Online (Sandbox Code Playgroud)
和
I18nManager.forceRTL(true);
Run Code Online (Sandbox Code Playgroud)
在 js 代码中,但所有文本和 flex 仍然是 ltr...我能做什么?
您好我正在尝试将post变量发送到我的API,而我没有在PHP文件中获取发布数据
这是我的反应本机代码:
let data = {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
'firstname': 'test',
}),
}
fetch(GLOBALS.API + '/registerApi.php?key=' + GLOBALS.KEY, data)
.then((response) => response.json())
.then((responseJson) => {
Alert.alert(
'Alert Title',
responseJson.output
)
})
.catch((error) => {
console.error(error);
});
Run Code Online (Sandbox Code Playgroud)
它让我空虚: []
$array = array(
"output" => json_encode($_POST)
);
$output = json_encode($array);
die($output);
Run Code Online (Sandbox Code Playgroud)
当我使用$_REQUEST它时,只返回key没有firstname一个参数的get参数.