<View
style={
isFetch
? {
position: "absolute",
width: widthScreen,
height: heightScreen,
backgroundColor: "rgba(0, 0, 0, 0.3)",
zIndex: 666666,
}
: null
}
>
{isFetch !== undefined && isFetch === true ? (
<View
style={{
width: widthScreen,
height: heightScreen,
backgroundColor: "rgba(0, 0, 0, 0.3)",
justifyContent: "center",
alignItems: "center",
}}
>
<ActivityIndicator size="large" color="#000000" />
</View>
) : null}
</View>
)
<input type="text" className="search-field" onChange={()=>this.handleSearch}/>
fetch(`api.openweathermap.org/data/2.5/forecast/?q=${this.state.value}&cnt=1&APPID=e94f24c463ec7a0d1a69ebdebc88c694&lang=ru`)
.then((response) => response.json())
.then((responseJson) => {
console.log( responseJson.movies);
})
.catch((error) => {
console.error(error);
});
componentWillReceiveProps(nextProps) {
console.log("nextProps.idcat",nextProps.idcat)
if (nextProps.idcat!==undefined){
fetch(`${ENV.API_PROT}${ENV.API_LINK}/api/${ENV.API_VER_GLOBAL}/categories/${nextProps.idcat}`)
.then(response => response.json())
.then(json => {
console.log(json);
this.setState({
sameNews: json.data,
isLoading: false
});
console.log(this.state.sameNews);
});
}
}
componentWillReceiveProps(nextProps) {
console.log("nextProps.idcat",nextProps.idcat)
this.getSameNewsInCat()
}