react-native-quick-actions icon indicating copy to clipboard operation
react-native-quick-actions copied to clipboard

userInfo & userInfo.url required for Android when calling setShortcutItems

Open Rehubbard opened this issue 5 years ago • 1 comments

On Android, the only way to get my Android build to work is to specify the userInfo property with a url field.

This works:

QuickActions.setShortcutItems([
      {
        type: "my_type",
        title: "Action title",
        icon: "my_icon",
        userInfo: {
           url: "" // for some reason this is required
        }
      },
])

But this crashes the app:

QuickActions.setShortcutItems([
      {
        type: "my_type",
        title: "Action title",
        icon: "my_icon"
      },
])

Is userInfo.url required on Android? If so, the readme could be updated to say that. I'm just curious and making sure i'm not doing anything wrong. Thanks for the awesome library!

Rehubbard avatar Nov 13 '19 22:11 Rehubbard

This looks like the code in question:

https://github.com/jordanbyron/react-native-quick-actions/blob/master/android/src/main/java/com/reactNativeQuickActions/UserInfo.java

I'm assuming it's failing at the getString("url"); line. I couldn't tell you why it was written in a way that made it required, but it appears it may be, along with userInfo on Android. Unfortunately I did not write our android code so it's still primarily a black box to me. Would you mind taking a look and seeing if there is an easy way to make that attribute optional?

jordanbyron avatar Nov 14 '19 19:11 jordanbyron