4

My react-native App needs to be able to put calendar entries into the device calendar app. On the web version we call a https resource and the browser takes care of the rest.

Is there a Linking API on react-native for iCal files? Is there a common ios and android solution?

e.g.
<OpenURLButton url={'ical://www.example.com/calendar/event.ical'} />
pkbyron
  • 163
  • 3
  • 9

2 Answers2

1

I'm not sure if there's a cross platform URL scheme for calendars, but you can use the Linking API for this purpose which is available both on iOS and Android:

import { Linking } from 'react-native';
Linking.openURL('ical://www.example.com/calendar/event.ical');
oblador
  • 2,954
  • 19
  • 15
0

Unfortunately there is no ical:// style URL scheme you can use. The undocumented calshow will allow you to show the calendar at a specific date/time, but not add events automatically. You can also open a .ics file using the Linking API that @oblador mentioned, which will allow you to subscribe to events from that file as a new calendar, but won't do anything nice like open the "New Event" dialog. The closest I could find was the React Native Calendar Events module, which will help you programmatically add calendar events, but only on iOS at the moment.

Community
  • 1
  • 1
adrian
  • 2,793
  • 1
  • 23
  • 26
  • Thanks Adrian, I have used the Linking option for now. Am very interested in seeing this develop into a good functional cross reference API... fingers crossed. – pkbyron Jun 23 '16 at 04:03