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);