@@ -6,6 +6,27 @@ const DID_CHANGE = "ionTabsDidChange";
6
6
7
7
// TODO(FW-2969): types
8
8
9
+ /**
10
+ * Vue 3.2.38 fixed an issue where Web Component
11
+ * names are respected using kebab case instead of pascal case.
12
+ * As a result, we need to account for both here since we support
13
+ * versions of Vue < 3.2.38.
14
+ */
15
+ const isRouterOutlet = ( node : VNode ) => {
16
+ return (
17
+ node . type &&
18
+ ( ( node . type as any ) . name === "IonRouterOutlet" ||
19
+ node . type === "ion-router-outlet" )
20
+ ) ;
21
+ } ;
22
+
23
+ const isTabBar = ( node : VNode ) => {
24
+ return (
25
+ node . type &&
26
+ ( ( node . type as any ) . name === "IonTabBar" || node . type === "ion-tab-bar" )
27
+ ) ;
28
+ } ;
29
+
9
30
export const IonTabs = /*@__PURE__ */ defineComponent ( {
10
31
name : "IonTabs" ,
11
32
emits : [ WILL_CHANGE , DID_CHANGE ] ,
@@ -19,9 +40,8 @@ export const IonTabs = /*@__PURE__*/ defineComponent({
19
40
* inside of ion-tabs.
20
41
*/
21
42
if ( slottedContent && slottedContent . length > 0 ) {
22
- routerOutlet = slottedContent . find (
23
- ( child : VNode ) =>
24
- child . type && ( child . type as any ) . name === "IonRouterOutlet"
43
+ routerOutlet = slottedContent . find ( ( child : VNode ) =>
44
+ isRouterOutlet ( child )
25
45
) ;
26
46
}
27
47
@@ -57,13 +77,11 @@ export const IonTabs = /*@__PURE__*/ defineComponent({
57
77
* since that needs to be inside of `.tabs-inner`.
58
78
*/
59
79
const filteredContent = slottedContent . filter (
60
- ( child : VNode ) =>
61
- ! child . type ||
62
- ( child . type && ( child . type as any ) . name !== "IonRouterOutlet" )
80
+ ( child : VNode ) => ! child . type || ! isRouterOutlet ( child )
63
81
) ;
64
82
65
- const slottedTabBar = filteredContent . find (
66
- ( child : VNode ) => child . type && ( child . type as any ) . name === "IonTabBar"
83
+ const slottedTabBar = filteredContent . find ( ( child : VNode ) =>
84
+ isTabBar ( child )
67
85
) ;
68
86
const hasTopSlotTabBar =
69
87
slottedTabBar && slottedTabBar . props ?. slot === "top" ;
0 commit comments