现有反应本地项目无框架中的rect-viro

时间:2018-08-27 07:47:23

标签: react-native augmented-reality

我已经安装了react-viro@2.9.1插件,并且插件安装正确,没有任何问题。我正在尝试使用“”启动初始场景。这是我的代码:

constructor(props){
    super(props);
    this.state={
        hasInitialized : false,
        text: "Initializing AR..."
    }
}
render = function(){
    return(
        <View>
            <ViroARScene onTrackingUpdated={this.onTrackingUpdated()}>

            </ViroARScene>
        </View>
    )
}
onTrackingUpdated(state, reason){
    if (!this.state.hasInitialized && state == ViroConstants.TRACKING_NORMAL){
        this.setState({
            hasInitialized: true,
            text: 'hello Rocky!!!'
        })
    }

}

当我尝试运行该项目时,出现错误消息,因为“不变违反:“ VRTARScene”的本机组件不存在”

和我的错误堆栈跟踪:

    Invariant Violation: Native component for "VRTARScene" does not exist

This error is located at:
    in VRTARScene (at ViroARScene.js:324)
    in RCTView (at View.js:60)
    in View (at ViroARScene.js:323)
    in ViroARScene (at FirstScene.js:16)
    in RCTView (at View.js:60)
    in View (at FirstScene.js:15)
    in FirstScene (at ViroARSceneNavigator.js:455)
    in VRTARSceneNavigator (at ViroARSceneNavigator.js:479)
    in ViroARSceneNavigator (at ARConfig.js:11)
    in RCTView (at View.js:60)
    in View (at ARConfig.js:10)
    in ARConfig (at navigationStore.js:525)
    in Wrapped (at SceneView.js:17)
    in SceneView (at CardStack.js:466)
    in RCTView (at View.js:60)
    in View (at createAnimatedComponent.js:154)
    in AnimatedComponent (at Card.js:12)
    in Card (at PointerEventsContainer.js:39)
    in Container (at CardStack.js:498)
    in RCTView (at View.js:60)
    in View (at CardStack.js:414)
    in RCTView (at View.js:60)
    in View (at CardStack.js:413)
    in CardStack (at CardStackTransitioner.js:67)
    in RCTView (at View.js:60)
    in View (at Transitioner.js:142)
    in Transitioner (at CardStackTransitioner.js:19)
    in CardStackTransitioner (at StackNavigator.js:41)

我缺少任何框架吗?如何解决此问题?

0 个答案:

没有答案