未定义不是setInterval附近的函数

时间:2019-09-28 19:06:22

标签: ecmascript-6 react-native-android

我在onPressed上导入一个函数,但是每次我按图标时,都会给我一个错误:“未定义不是setInterval附近的函数”。请解决。

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);
alert('calling2');
})
//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);
});
}

我从中导入文件的文件:

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

1 个答案:

答案 0 :(得分:0)

您有一个。在需要删除的setInterval之前。

  If InStr(r.Formula, anchored) > 0 Then
    r.Formula = VBA.Replace(r.Formula, anchored, repl)
  End If

  If InStr(r.Formula, find) > 0 Then
    r.Formula = VBA.Replace(r.Formula, find, repl)
  End If
相关问题