获取该地点的天气数据并将其设置为flatlist



我是新来的React Native,我正在制作一个虚拟项目,以获取Flatlist的天气。我从GitHub下载了一个项目,但是我在真实的设备和模拟器中获得了空白屏幕,以及GitHub存储库的链接是: - https://github.com/andrewsmith1996/geolocationweaterweatherrectnative任何帮助我们都将应用

首先将其添加到您的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

最新更新