2016-12-01 73 views
0

我創建了一個新的React Native項目並在項目中安裝了@ shoutem/ui,並將Shoutem UI的Examples組件包含到了React Native應用程序中。未知的命名模塊:'react/lib/NativeMethodsMixin'

import React, { Component } from 'react'; 
import { AppRegistry } from 'react-native'; 
import { Examples } from '@shoutem/ui'; 

class HelloWorld extends Component { 
    render() { 
    return (
     <Examples /> 
    ); 
    } 
} 

AppRegistry.registerComponent('HelloWorld',() => HelloWorld); 

但是當我運行啓動項目,我得到「未知命名模塊:'反應/ lib目錄/ NativeMethodsMixin」錯誤。

回答

2

的錯誤似乎是@shoutem/animation模塊內,在Parallax.js文件:https://github.com/shoutem/animation/blob/develop/Parallax.js NativeMethodsMixin不是從react正確導入:

如果更改此: import NativeMethodsMixin from 'react/lib/NativeMethodsMixin'; 這樣:import NativeMethodsMixin from 'react'; 您的應用程序應該工作。

我要麼提交有關@shoutem/animation項目Github的問題,或者檢查是否NativeMethodsMixin是進口的方式是針對舊版本的react,然後使用該版本在您的應用程序。

我希望這會有所幫助。

+0

謝謝,那工作 – Kais