jordanbyron / react-native-quick-actions

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

userInfo & userInfo.url required for Android when calling setShortcutItems #90

Open Rehubbard opened 4 years ago

Rehubbard commented 4 years ago

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!

jordanbyron commented 4 years ago

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?