Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

How to solve this problem in react native :component exception

$
0
0

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>       );   }

}


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>