rndevzaki / helloworld

0 stars 0 forks source link

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. Check the render method of `App #1

Open rndevzaki opened 4 years ago

rndevzaki commented 4 years ago

it gives the following error and not playing the video.the code and lib versions commented

rndevzaki commented 4 years ago

import React, {Component} from 'react'; import { StyleSheet, View, Dimensions, TouchableNativeFeedback, Text

} from 'react-native'; import Video from 'react-native-video'; import VlcPlayer from 'react-native-vlc-player'; import Icon from 'react-native-vector-icons';

const {width}= Dimensions.get('window'); const samplevideo = require('./sample.mp4'); export default class App extends React.Component{ constructor(p){ super (p); this.state = { currentTime:0, duration:0.1, paused:false, overlay:false,

}

}

render = () =>{ const {currentTime,duration,overlay,paused}=this.state return (

     <View style={styles.overlay}>
     {! overlay ? <View style={{backgroundColor:'#0006',...style.overlayset}} >
     <Icon name ='backward' style={styles.ico} onPress={this.backward}/>
     <Icon name ={paused ? 'play' :'pause'} style={styles.ico} onPress={()=> this.setState({ paused: !paused})}/>
     <Icon name ='forward' style={styles.ico} onPress={this.forward}/>

:

        <TouchableNativeFeedback onPress={this.seekleft}/><View style={{flex:1,}}></View>
        <TouchableNativeFeedback onPress={this.seekright}/><View style={{flex:1,}}></View>
      </View>}
    </View>
  </View>
);

} };

const styles = StyleSheet.create({ container:{ flex: 1,

}, overlay:{ ...StyleSheet.absoluteFillObject

}, overlayset:{ flex:1, flexDirection: 'row', }, ico:{ color: 'white', flex:1, textAlign:'center', textAlignVertical:'center', fontSize:25

  }

});

rndevzaki commented 4 years ago

"react": "16.9.0", "react-native": "0.61.5", "react-native-vector-icons": "^6.6.0", "react-native-video": "^5.0.2", "react-native-video-controls": "^2.4.0", "react-native-vlc-player": "^0.2.0", "react-player": "^1.15.2" },

rndevzaki commented 4 years ago

it also not playing the video