ReactRootView.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:RNLearn_Project1 作者:
private void emitOrientationChanged(final int newRotation) {
  String name;
  double rotationDegrees;
  boolean isLandscape = false;

  switch (newRotation) {
    case Surface.ROTATION_0:
      name = "portrait-primary";
      rotationDegrees = 0.0;
      break;
    case Surface.ROTATION_90:
      name = "landscape-primary";
      rotationDegrees = -90.0;
      isLandscape = true;
      break;
    case Surface.ROTATION_180:
      name = "portrait-secondary";
      rotationDegrees = 180.0;
      break;
    case Surface.ROTATION_270:
      name = "landscape-secondary";
      rotationDegrees = 90.0;
      isLandscape = true;
      break;
    default:
      return;
  }
  WritableMap map = Arguments.createMap();
  map.putString("name", name);
  map.putDouble("rotationDegrees", rotationDegrees);
  map.putBoolean("isLandscape", isLandscape);

  sendEvent("namedOrientationDidChange", map);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号