无法将类调用为函数scala.js

时间:2015-06-28 09:08:52

标签: scala.js

 val ListDataSource = ReactNative.ListView.asInstanceOf[js.Dynamic].DataSource
    js.Dynamic.newInstance(ListDataSource)(args).asInstanceOf[ListViewDataSource[T]]

此代码在react-native 0.5.0中工作正常,但当我升级到0.6时,我收到以下错误

Cannot call a class as a function

在js land没什么变化!

dataSource: new ListView.DataSource({
        rowHasChanged: (row1, row2) => row1 !== row2,
      }),

编辑:好吧,我说谎了,jsworld有一个变化,反应原生使用0.6中的babel而不是jstransform。

function _classCallCheck(instance,Constructor){
    if(!(instance instanceof Constructor)){throw new TypeError('Cannot call a class as a function');
    }}
function ListViewDataSource(params){_classCallCheck(this,ListViewDataSource);

https://github.com/babel/babel/issues/798

0 个答案:

没有答案