On iOS, orientation changes don't animate in a way that "looks native"
还没有人认领这个 Issue。
- 主要语言
- C++
- 星标
- 127k
- 派生
- 25.3k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 4
描述
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment:
OS: macOS Sierra 10.12.6
Node: 8.4.0
Yarn: 1.0.1
npm: 5.4.1
Watchman: 4.5.0
Xcode: Xcode 8.3.3 Build version 8E3004b
Android Studio: 2.3 AI-162.3934792
Packages: (wanted => installed)
react: 16.0.0-alpha.12 => 16.0.0-alpha.12
react-native: 0.48.3 => 0.48.3
Steps to Reproduce
- Create a react native app w/ react native init
- Run it on an iOS device or the iOS simulator
- (If on a simulator) Turn on slow animations (CMD+T) so the issue will be more obvious.
- Rotate the device a few times to landscape and portrait
- Observe that immediately after the orientation changes, the view is resized to the dimensions of the new orientation, and THEN the rotation animation begins. The view's contents and dimensions are not smoothly resized while the view is being rotated.
Expected Behavior
In a regular native iOS app, when the orientation of the device changes, the view's contents and dimensions smoothly resize while the view is also rotated at the same time.
Here is a animated gif. This is a simple native app written in swift, see how the view resizes and rotates smoothly (at the same time) on orientation changes:

Actual Behavior
On orientation changes, the view's dimensions and contents are resized once at the very beginning of the change, and then the rotation animation happens.
Here is another animated git. This is a simple RN app, with a red border applied to the view so you can see how the view's dimensions are immediately changed (not smoothly animated).

Reproducible Demo
Sadly I can't seem to get the expo app to handle rotations so I guess having a Snack wouldn't be useful.
But you can see if yourself pretty easily if you:
- Use
react-native initto create a new app - Edit
index.ios.jsand add to the container's styles (line ~40):
borderColor: 'red',
borderWidth: 10,
- Then run it, turn on slow animations in the simulator (CMD+T), and change the orientation a few times.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用 index.ios.js 在 React Native 应用中复现该行为,添加第 40 行附近所述的边框样式,并启用慢速模拟器动画。然后追踪所涉及的 iOS 方向变化处理。完成标准是视图的内容和尺寸在旋转过程中平滑调整大小,与原生 iOS 行为一致。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- ios, react-native
- 领域
- mobile
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100