【问题标题】:Cannot detect WebVR mode - Insert phone into Cardboard holder无法检测到 WebVR 模式 - 将手机插入纸板支架
【发布时间】:2018-09-04 20:09:40
【问题描述】:

我正在尝试在snack.expo 上运行aframe“hello world”示例。当我尝试进入 VR 模式时(单击右下角的纸板图标),我收到消息“将手机插入纸板支架”。

我找不到绕过消息的方法。由于某种原因,它似乎无法检测到手机被放置在纸板架内。我手机上的“自动旋转”已启用。

当我按下“X”图标时,它只是回到标准 3D 模式(不是分屏)。

import React, { Component } from 'react';
import { WebView } from 'react-native';

export default class MyWeb extends Component {
  render() {
    return (
      <WebView
        source={{uri: 'https://aframe.io/aframe/examples/boilerplate/hello-world'}}
        style={{marginTop: 20}}
      />
    );
  }
}

当前结果:

预期结果:

【问题讨论】:

    标签: javascript react-native webview expo aframe


    【解决方案1】:

    经过进一步调查后发现该应用被锁定为纵向模式,因此 aframe 无法检测到横向。

    作为一个快速测试,我尝试了以下验证:

    import React, { Component } from 'react';
    import { WebView } from 'react-native';
    
    export default class MyWeb extends Component {
      constructor(props) {
        super(props);
        Expo.ScreenOrientation.allow(Expo.ScreenOrientation.Orientation.LANDSCAPE)
      }
      render() {
        return (
          <WebView
            source={{uri: 'https://aframe.io/aframe/examples/boilerplate/hello-world'}}
            style={{marginTop: 20}}
          />
        );
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-20
      相关资源
      最近更新 更多