我正在开发一个应用程序,其实我的应用程序显示横向和标签/ iPad中的肖像。但在平板电脑(iPad的工作正常),当我检查方向功能工作正常,直到解锁设备。当我锁定屏幕像特定模式(肖像/风景)之后,该设备显示方向前显示。不更新目前的方向。方向未更新解锁设备后在react-native- android
我跟着这个链接:https://github.com/yamill/react-native-orientation
这是我的代码:
componentWillMount(){
this.getOrientationtype()
}
getOrientationtype(){
//alert("Hello")
if(Platform.OS == 'ios'){ // to Identifying Android or iOS
if(aspectRatio>1.6){ // Code for Iphone
// alert("phone")
Orientation.lockToPortrait()
}
else{
Orientation.getOrientation((err, initial) => {
if(initial != 'UNKNOWN'){
this.setState({
orientation:initial
})
}
else{
this.setState({
orientation:'PORTRAIT'
})
}
});
}
}
else{
if(DeviceInfo.isTablet()){
// alert("android tab")
Orientation.getOrientation((err, initial) => {
if(initial != 'UNKNOWN'){
this.setState({
orientation:initial
})
}
else{
this.setState({
orientation:'PORTRAIT'
})
}
});
}
else{
Orientation.lockToPortrait()
}
}
}
请找出这个解决方案....我使用这个链接enter link description here
呀真的非常感谢........ – Lavaraju