Skip to content
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

Open
Darshan972 opened this issue Sep 26, 2019 · 0 comments
Open

undefined is not a function #87

Darshan972 opened this issue Sep 26, 2019 · 0 comments

Comments

@Darshan972
Copy link

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

@Darshan972 Darshan972 changed the title undefined is not a function. undefined is not a function Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant