react-native-siri-shortcut
This module lets you use the new iOS 12 Siri Shortcuts inside your React Native app.
You can also use this for <iOS 12 User Activities.
Disclaimer
This project is in it's very early stages. I am adding features and fixing things
as I have time to work on them. If you have anything you want added, feel free to
do a Pull Request detailing your changes and why.
Android
This package is safe-guarded for Android, so you can freely call these functions and they won't crash your Android app. But be careful because the calls don't throw any errors, so don't always assume your action was actually successful if it doesn't error out. Always check if, in case of success, the platform is iOS.
Getting started
Install the module and react-native-swift (needed to support Swift code execution)
$ npm install react-native-siri-shortcut react-native-swift --save
Mostly automatic installation
Link the package:
$ react-native link react-native-siri-shortcut && react-native link react-native-swift
Add these lines to your AppDelegate.m to get shortcut data from a cold-launch.
- Enable the Siri capabilities for your project in the Capabilities tab.
- Go to you Info.plist and add a new key
NSUserActivityTypes
of typeArray
and add your different activity types asString
.
Manual installation
TODO: Detail manual installation process.
Usage
API
Shortcut Options type
Shortcut listener
Create shortcut
Clear all shortcuts
Clear shortcuts with identifiers
Example project
Feel free to clone this repo and run the example/
project.
Just npm install
or yarn install
in the example/
directory and start the
React Native app.