Reputation: 157
I am trying to create a Form which can take user Name and email address with the help of react-native-elements but it is giving error inside render function(Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports).
I have tried to put the FormLabel, FormIput, and FormValidationMessage inside a View and Container in render function but it is giving me an error which I am unable to figure out.
import React from 'react';
import { View, StyleSheet} from "react-native";
import { FormLabel, FormInput, FormValidationMessage } from 'react-native-elements'
export default class UserDetailsInput extends React.Component {
render() {
return (
<View>
<FormLabel>Name</FormLabel>
<FormInput/>
<FormValidationMessage>Error message</FormValidationMessage>
</View>
);
}};
package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject"
},
"dependencies": {
"expo": "^32.0.0",
"native-base": "^2.12.1",
"react": "16.5.0",
"react-dom": "^16.8.6",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"react-native-elements": "^1.1.0",
"react-native-otp-inputs": "^3.0.2"
},
"devDependencies": {
"babel-preset-expo": "^5.0.0"
},
"private": true
}
I require the react-native-elements to be shown on the UI similar as shown on the docs site.
(source: github.io)
Upvotes: 2
Views: 5023
Reputation: 4070
These components have been renamed or removed in React Native Elements 1.0, your imports therefore yield undefined
. Please see the corresponding release notes.
Upvotes: 5