Error: 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.
Check the render method of Application
.
enter code hereimport React, { Component } from 'react'; import { View, StatusBar, TouchableOpacity, Image } from 'react-native'; import Camera from 'react-native-camera'; import styles from './styles'; import PhotoCaptureIcon from '../assets/ic_photo_camera_36pt.png'; export default class Application extends Component { constructor(props){ super(); this.camera=null; } takePicture= () =>{ if(this.camera){ this.camera.capture() .then((Data)=> console.log(data)) .catch(err=> console.error(err)); } } render(){ return (<View style={styles.container}><StatusBar animated hidden /> <Camera ref={(cam) => { this.camera = cam; }} style={styles.preview} /> <View style={[styles.overlay, styles.bottomOverlay]}> <TouchableOpacity style={styles.captureButton} onPress= {this.takePicture}> <Image source={PhotoCaptureIcon} /> </TouchableOpacity> </View> </View> ); }
}