Reputation: 31
I am working on my react native app, but when I try to use Modal component,this error shows up:
View config getter callback for component `` must be a function
even if I just add <Modal></Modal>
in my code and on Web stimulator it gives this error:
InvalidCharacterError: Failed to execute 'createElement' on 'Document': The tag name provided ('') is not a valid name.
I am unable to solve this issue. Below is my complete code:
import React,{useState} from 'react';
import {View, Text, StyleSheet, Image, FlatList} from 'react-native';
import {Card,FAB,TextInput,Button} from 'react-native-paper';
import Modal from 'react-native';
const EmployeesInfo=()=> {
const [Name,setName]=useState("")
const [Email,setEmail]=useState("")
const [Phone,setPhone]=useState("")
const [Salary,setSalary]=useState("")
const [Pic,setPic]=useState("")
const [Modal,setModal]=useState("")
return (
<View style={styles.root}>
...
</View>
)}
export default EmployeesInfo
const theme ={colors:{primary:"red"}}
const styles= StyleSheet.create({
root:{
flex:1,
},
words:{
margin:9
}
})
Upvotes: 3
Views: 11774
Reputation: 308
There is a very small error: You need to import a Component
import Modal from 'react-native';
Change this to
import { Modal } from 'react-native';
And your code will be fine.
Upvotes: 3