react-native-image-progress icon indicating copy to clipboard operation
react-native-image-progress copied to clipboard

undefined is not a function

Open Darshan972 opened this issue 5 years ago • 0 comments

Hey, i amm getting an error after calling an function after onPressesd , that "undefined is not a function near setInterval". please see it.

here is the code of 1'st file where i am calling it:

<Icon style = {styles.icon} name = 'search' type = 'material' color= 'black' onPress = {() => { this.setState({channelId: this.getChannelId(this.state.term)}); obj.onPressedButton(this.state.channelId); } } /> </View>

here is the another file from where i am calling this:

return ( <View style = {styles.btnExt}> <TouchableOpacity style = {styles.btn} onPress = { () => { obj.onPressedButton(channelId); } }> );

here is the function defination in another file:

onPressedButton = channelId => { // fetch the value entered in the input field //alert(channelId); this.setState({channelId:channelId}) //fetch the value(channelId) that is enter in the input field // make a request var url = 'https://www.googleapis.com/youtube/v3/channels?key='+API_Key+'&id=' + this.state.channelId + '&part=snippet,contentDetails,statistics'; this.setState({url: url}); fetch(url,{ method: 'GET' }) .then((response) => response.json()) // fetchData(data); .then((data) => { fetchData(data); alert(imgLink); }) //now fetching the response from the yt api again and again .setInterval(() => { var url = 'https://www.googleapis.com/youtube/v3/channels?key='+API_Key+'&id=' + this.state.channelId + '&part=statistics'; fetch(url,{ method: 'GET' }) .then((response) => updateSubscribers(response.json())) },0)

.catch((error) => { console.log(error); }); }

Darshan972 avatar Sep 26 '19 14:09 Darshan972