Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add-symbol-name-for-ios #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nicolasdevienne
Copy link

@nicolasdevienne nicolasdevienne commented Jun 26, 2024

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

@kierancrown
Copy link

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

@nicolasdevienne
Copy link
Author

nicolasdevienne commented Sep 27, 2024

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

@kierancrown
Copy link

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
    */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants