获取该地点的天气数据并设置在平面列表中

Fetching the weather data of the place and set in flatlist

我是 React Native 的新手,我正在制作一个虚拟项目来获取 flatlist 中该地点的天气。我从 github 下载了一个项目,但我的真实设备和模拟器出现黑屏,github 存储库的 link 是:- https://github.com/andrewsmith1996/geolocationWeatherReactNative 我们会提供任何帮助

首先将此添加到您的 AndroidManifest.xml 文件

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

第二个 URL 您必须添加您的访问密钥

let url = 'https://api.openweathermap.org/data/2.5/forecast?lat=' + this.state.latitude + '&lon=' + this.state.longitude + '&units=metric&appid=YOUR_KEY_HERE';

如果您没有密钥,那么要使此示例正常工作,请使用此 url。

let url = 'https://samples.openweathermap.org/data/2.5/forecast?q=M%C3%BCnchen,DE&appid=b6907d289e10d714a6e88b30761fae22'; 

你会得到这样的东西:https://i.stack.imgur.com/u250N.png