jordanbyron / react-native-quick-actions

A react-native interface for Touch 3D home screen quick actions
MIT License
1.06k stars 94 forks source link

Adding dynamic quick actions #32

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hi! I added 3 static quick actions like in your example code. Then I added logic to this my static actions:

const initialAction = QuickActions.popInitialAction(); if ( initialAction ) { if ( initialAction.title === 'Map' ) { // doSomething... } }

But when app is running they don't work. How can I rewrite them? Or if I add dynamic actions like here QuickActions.setShortcutItems([ { type: "Orders", // Required title: "See your orders", // Optional, if empty,typewill be used instead subtitle: "See orders you've made", icon: "Compose", // Pass any of UIApplicationShortcutIconType<name> userInfo: { url: "app://orders" // provide custom data, like in-app url you want to open } } ]); how can I add some logic for them?

jordanbyron commented 7 years ago

popInitialAction is will only return the initial action when the app is started for the first time. Read the first half of the Listening for quick actions in your javascript code section of the README and make sure you're listening for quickActionShortcut events.

Let me know if you have any more questions 😸

ghost commented 7 years ago

I have looked at this file to understand whats going on. I listen the event quickActionShortcut, but nothing happens, logs are not displayed:(