Skip to content

source.uri should not be an empty string #86

@Darshan972

Description

@Darshan972

Hey what the the hell is the error i am getting here please solve it . i am 16 years old right now please give a expln that i can understand perfectly.

here is the code:

constructor(props)
{
super(props);
this.state= {
imgLink: '',
}
};

here i am fetching it:

fetchData = data => {
this.setState({imgLink: data.items[0].snippet.thumbnails.default.url});
}

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

here is the render method:
render()
{
<Image style = {
{width:width,height:height,alignItems:'center',borderRadius:50 ,marginLeft:'auto',marginRight: 'auto',marginTop: 30}
} source = {{uri: imgLink}}/>
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions