ios - super 表达式必须为 null 或函数

标签 ios react-native

我写了这段代码来构建一个简单的 React Native UI

'use strict';
 var React = require('react-native');
 var styles = React.StyleSheet.create({
  text : {
    color : 'black',
    backgroundColor : 'white',
    fontSize : 30,
    margin : 80
  }
});
class PropertyFinderApp extends React.Component() {
  render() {
     return React.createElement(React.text,{style : styles.text},"Hello World");
  }
}
React.AppRegistry.registerComponent('PropertyFinder',function(){ return PropertyFinderApp});

我收到错误“ super 表达式必须为空或函数”

我已经尝试安装最新版本的react,但还是无法解决!

最佳答案

导致错误的是 React.Component(),它应该没有括号 React.Component。当你解决这个问题时,你会因为使用小写的 React.text 而收到另一个错误,它应该是 React.Text

关于ios - super 表达式必须为 null 或函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35404384/

相关文章:

ios - UIGraphicsGetImageFromCurrentImageContext 导致导航 Controller 返回动画断断续续

iOS - 画外音 - 大量的辅助功能

react-native - 你可以在 React Native 异步中创建 render() 方法吗?

javascript - react 和流动 : import Node type and PureComponent in one line

android - <Image> url 没有显示为 android React Native

ios - 静默刷新另一个应用程序

ios - 导航栏在执行 popViewController 时闪烁黑色

ios - 不使用网络服务时如何使用 RestKit 的核心数据?

react-native - React Native 动画输入文本

javascript - 如何衡量我的应用程序在 React Native 中的数据使用情况?