我正在使用此处指示的示例,
但它会引发Invariant Violation: element Type is invalid: expected a string
错误页面。
按钮组件工作正常,但表单组件不知何故会导致此问题,
任何人以前使用过 react-native-elements 的表单组件并且知道如何修复它?
这里代码:
import React, { Component } from 'react';
import { View, Text,StyleSheet } from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';
import { Input, Button, FormLabel, FormInput, FormValidationMessage } from 'react-native-elements';
class Login extends Component {
constructor(props) {
super(props);
this.state = {
};
}
Login = ()=>{
}
onChangeText=()=>{
}
render() {
return (
<View style={styles.container}>
<View style={styles.headerContainer}>
<Text> Login Page </Text>
</View>
<View style={styles.inputContainer}>
<FormLabel>Name</FormLabel>
</View>
<View style={styles.buttonContainer}>
<Button
large
icon={{name: 'key', type: 'octicon', buttonStyle: styles.someButtonStyle }}
title='Oturum Aç' onPress={()=>this.Login()} />
</View>
</View>
);
}
}
包.json:
"dependencies": {
"react": "16.6.3",
"react-native": "0.57.8",
"react-native-elements": "^1.0.0-beta7",
"react-native-vector-icons": "^6.1.0"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.48.5",
"react-test-renderer": "16.6.3"
},