【问题标题】:How to open device's calendar app to add an event from React Native application?如何打开设备的日历应用程序以从 React Native 应用程序添加事件?
【发布时间】:2022-10-07 07:14:19
【问题描述】:

我从 API 获取数据,其结果如下所示

Object {
  \"name\": \"HackForGood: Grab Hackathon 2022\",
  \"site\": \"HackerEarth\",
  \"start_time\": \"2022-05-29T18:30:00.000Z\",
  \"url\": \"https://grabhackforgood.hackerearth.com/\",
}
Object {
  \"name\": \"Microsoft Virtual Hackathon 2022\",
  \"site\": \"HackerEarth\",
  \"start_time\": \"2022-05-31T16:00:00.000Z\",
  \"url\": \"https://www.hackerearth.com/challenges/hackathon/microsoft-virtual-hackathon-2022/\",
}

数据显示在平面列表中。我想实现一个功能,如果我们点击一​​个平面列表项目,它将在我们手机的日历应用程序(如谷歌日历)中打开添加事件屏幕,设置从start_time获取的日期和时间的事件和事件名称为name。如果用户单击保存,它将保存事件。

(我已经查看了https://github.com/vonovak/react-native-add-calendar-event 但不确定它是否会起作用,因为作者不再维护这个包了)

如何解决这个问题?

    标签: javascript typescript react-native


    【解决方案1】:

    我认为calendar-link(仍然保持)使用ICS 格式可能有用?否则,我建议仍然尝试react-native-add-calendar-event

    【讨论】:

      【解决方案2】:

      Primero debes saber que hay una url que la puedes correr con un Linking.URL() y es la sgte https://calendar.google.com/calendar/u/0/r/eventedit?text=Seminario+virtual+online+en+directo:+C%C3%B3mo+gestionar+de+forma+eficiente+los+riesgos+(sesi%C3%B3n+1)&dates=20220929T180000/20220929T210000&details=%5Bsu_template+name%3D%22inc/suscribirse_a_evento.php%22%5D&location&trp=false&sprop=website:https://intranet.globalcci.org&ctz=Europe/Madrid&sf=true Esa url si la abres desde el App con Linking te la abrirá en el explorador, el linking de Gmail(APP) te lleva directamente al app Google calendar pero el de react solo al explorador。

      【讨论】:

        猜你喜欢
        • 2018-11-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-05-31
        • 2015-06-23
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多