-
Notifications
You must be signed in to change notification settings - Fork 943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ios): add iOS orientation #3365
Conversation
v_zxingli seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Hi, @lisicold. Thanks for your PR! 👏 🏷️ You can leave a comment in this PR with |
After a quick scan, I have approved workflow to run.
🏷️ New commits in this PR would not be tested automatically until this pull request is reviewed by our collaborators. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可能需修改对齐,等待Android端提交后一同合入
static UIInterfaceOrientation interfaceOrientation = UIInterfaceOrientationPortrait;/// 异常情况给一个默认的UIDeviceOrientationPortrait | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
[[NSNotificationCenter defaultCenter] addObserverForName:UIDeviceOrientationDidChangeNotification |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
该PR有几点问题:
1、此处监听通知并不会及时通知到 js侧,仅是native层刷新。真正hippyExportedDimensions依赖的是UIApplicationDidChangeStatusBarOrientationNotification这个通知。
2、UIDeviceOrientationDidChangeNotification是设备方向变化通知,绑定给前端的orientation变量含义是有歧义的,是“设备方向”?还是“页面布局方向”?,最佳做法可能是提供两个变量进行区分。
3、首次获取方向的代码需优化,避免出现Magic Number等,类似这种(interfaceOrientation - deviceOrientation == 0)
Hi, @lisicold, I noticed that our reviewers requested changes to this pull request. |
Pre-PR Checklist