Skip to content

Commit 3eb0846

Browse files
committed
fix(ios): ensure fallback system image
1 parent 84df4ad commit 3eb0846

2 files changed

Lines changed: 28 additions & 7 deletions

File tree

ios/App/App/LiquidTabsPlugin.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,20 @@ public class LiquidTabsPlugin: CAPPlugin, CAPBridgedPlugin {
3939

4040
let tabs: [LiquidTab] = tabsArray.compactMap { dict in
4141
guard
42-
let id = dict["id"] as? String,
43-
let title = dict["title"] as? String
42+
let id = dict["id"] as? String,
43+
let title = dict["title"] as? String
4444
else { return nil }
4545

46-
let systemImage = dict["systemImage"] as? String ?? "square"
46+
let rawSystemImage = dict["systemImage"] as? String ?? "square"
47+
48+
let systemImage: String = {
49+
if UIImage(systemName: rawSystemImage) != nil {
50+
return rawSystemImage
51+
} else {
52+
return "square"
53+
}
54+
}()
55+
4756
let roleStr = dict["role"] as? String ?? "normal"
4857
let role: LiquidTab.Role = (roleStr == "search") ? .search : .normal
4958

src/main/mobile/bottom_tabs.cljs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,19 @@
122122
(defn configure
123123
[]
124124
(configure-tabs
125-
[{:id "home" :title "Home" :systemImage "house" :role "normal"}
126-
{:id "graphs" :title "Graphs" :systemImage "app.background.dotted" :role "normal"}
127-
{:id "capture" :title "Capture" :systemImage "tray" :role "normal"}
128-
{:id "go to" :title "Go To" :systemImage "square.stack.3d.down.right" :role "normal"}]))
125+
[{:id "home"
126+
:title "Home"
127+
:systemImage "house"
128+
:role "normal"}
129+
{:id "graphs"
130+
:title "Graphs"
131+
:systemImage "app.background.dotted"
132+
:role "normal"}
133+
{:id "capture"
134+
:title "Capture"
135+
:systemImage "tray"
136+
:role "normal"}
137+
{:id "go to"
138+
:title "Go To"
139+
:systemImage "square.stack.3d.down.right"
140+
:role "normal"}]))

0 commit comments

Comments
 (0)