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

add-symbol-name-for-ios

Open nicolasdevienne opened this issue 1 year ago • 3 comments

Hi @mouselangelo can you please merge this PR and publish new release?

nicolasdevienne avatar Jun 26 '24 14:06 nicolasdevienne

@mouselangelo I'm also wanting to implement this. Is this planned to be added soon?

kierancrown avatar Sep 27 '24 14:09 kierancrown

Hi @kierancrown! We are waiting for the merge of the PR! @mouselangelo 🙏🏻

nicolasdevienne avatar Sep 27 '24 17:09 nicolasdevienne

Hi @kierancrown! We are waiting for the merge of the PR! @mouselangelo 🙏🏻

Awesome. I've created a patch file for now (for anyone else who needs this in the meantime)

diff --git a/node_modules/react-native-actions-shortcuts/ios/Shortcuts.swift b/node_modules/react-native-actions-shortcuts/ios/Shortcuts.swift
index ad77cd9..827d999 100644
--- a/node_modules/react-native-actions-shortcuts/ios/Shortcuts.swift
+++ b/node_modules/react-native-actions-shortcuts/ios/Shortcuts.swift
@@ -96,7 +96,7 @@ fileprivate extension UIApplicationShortcutItem {
         }
 
         let subtitle = value["subtitle"] as? String
-        let icon = UIApplicationShortcutIcon.from(value["iconName"] as? String)
+        let icon = UIApplicationShortcutIcon.from(value)
         let userInfo = value["data"] as? [String: NSSecureCoding]
 
         return UIApplicationShortcutItem(
@@ -110,10 +110,13 @@ fileprivate extension UIApplicationShortcutItem {
 }
 
 fileprivate extension UIApplicationShortcutIcon {
-    static func from(_ imageName: String?) -> UIApplicationShortcutIcon? {
-        guard let imageName = imageName else {
-            return nil
+    static func from(_ value: [String: Any]) -> UIApplicationShortcutIcon? {
+        guard let symbolName = value["symbolName"] as? String else {
+            guard let imageName = value["iconName"] as? String else {
+                return nil
+            }
+            return UIApplicationShortcutIcon(templateImageName: imageName) 
         }
-        return UIApplicationShortcutIcon(templateImageName: imageName)
+        return UIApplicationShortcutIcon(systemImageName: symbolName)
     }
 }
\ No newline at end of file
diff --git a/node_modules/react-native-actions-shortcuts/lib/typescript/src/index.d.ts b/node_modules/react-native-actions-shortcuts/lib/typescript/src/index.d.ts
index 73e6b03..3856510 100644
--- a/node_modules/react-native-actions-shortcuts/lib/typescript/src/index.d.ts
+++ b/node_modules/react-native-actions-shortcuts/lib/typescript/src/index.d.ts
@@ -22,6 +22,10 @@ export interface ShortcutItem {
      * The name of the iOS Asset or Android drawable
      */
     iconName?: string;
+    /**
+     * The name of the iOS SF Symbol
+     */
+    symbolName?: string;
     /**
      * Custom payload for the action
      */
diff --git a/node_modules/react-native-actions-shortcuts/src/index.tsx b/node_modules/react-native-actions-shortcuts/src/index.tsx
index e0d0e46..2bf4ec2 100644
--- a/node_modules/react-native-actions-shortcuts/src/index.tsx
+++ b/node_modules/react-native-actions-shortcuts/src/index.tsx
@@ -28,6 +28,11 @@ export interface ShortcutItem {
    */
   iconName?: string;
 
+   /**
+   * The name of the iOS SF Symbol Name
+   */
+    symbolName?: string;
+
   /**
    * Custom payload for the action
    */

kierancrown avatar Sep 27 '24 17:09 kierancrown

@mouselangelo please :)

nicolasdevienne avatar Feb 26 '25 17:02 nicolasdevienne