-
-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
undefined is not a function #87
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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);
}
}
/>
here is the another file from where i am calling this:
return (
<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);
});
}
The text was updated successfully, but these errors were encountered: