RNMK - 超级表达式必须为空或函数 [英] RNMK - Super expression must either be null or a function

查看:39
本文介绍了RNMK - 超级表达式必须为空或函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将我的项目升级到 React-Native 0.26 后,应用程序崩溃并显示以下错误:

After upgrading my project to React-Native 0.26, the app crashing with the following error :

超级表达式必须为空或函数,不能是未定义的"

"Super expression must either be null or a function, not undefined"

它在属于 React-Native-Material-Kit 包的 Switch.js 文件中崩溃.

It crashes in the Switch.js file, which belongs to the React-Native-Material-Kit package.

推荐答案

啊,这是因为 React-Native 发展很快!在我的选择中太快了.在 25 中,我们看到了这个警告:

Ahh, it's because React-Native is moving fast! Too fast in my option. In 25 we saw this warning:

弃用

现在不推荐从 react-native 要求 React API - 2eafcd4 0b534d1

Requiring React API from react-native is now deprecated - 2eafcd4 0b534d1

代替:

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

你现在应该:

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

在 26 年晚些时候只有一个版本,这现在是一个重大变化

And just one release later in 26 this is now a breaking change

如果你敢的话,你可以试试这个 codemod.我只是在进行手动更改.

You can try this codemod if you dare. I'm just doing a manual change.

这篇关于RNMK - 超级表达式必须为空或函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆