【问题标题】:react native : How to display weather data for the next 24 hours and next 7 daysreact native : 如何显示未来 24 小时和未来 7 天的天气数据
【发布时间】:2018-06-16 11:22:09
【问题描述】:

我是原生反应的新手。我正在网站https://darksky.net 上编写一个带有API 的天气应用程序。如何显示未来 24 小时和未来 7 天的天气数据?

【问题讨论】:

  • 到目前为止你写了什么代码?或者到目前为止做了什么研究?

标签: json reactjs api react-native weatherdata


【解决方案1】:

我为此使用了这个 https://github.com/njwest/react-native-weather 天气组件。

使用 npm i --save react-native-weather 安装

用法:

import { WeatherWidget } from 'react-native-weather';

render() {
  return(
    <WeatherWidget
      api={"your-DarkSky.net-api-here"}
      lat={"lat"}
      lng={"lng"}
      />
  );
}

阅读文档真的很容易使用

【讨论】:

    猜你喜欢
    • 2016-01-27
    • 1970-01-01
    • 2015-05-09
    • 1970-01-01
    • 2013-09-16
    • 1970-01-01
    • 2015-04-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多