@@ -14,12 +14,12 @@ struct TabViewImpl: View {
1414#else
1515 @Weak var tabBar : UITabBar ?
1616#endif
17-
17+
1818 var onSelect : ( _ key: String ) -> Void
1919 var onLongPress : ( _ key: String ) -> Void
2020 var onLayout : ( _ size: CGSize ) -> Void
2121 var onTabBarMeasured : ( _ height: Int ) -> Void
22-
22+
2323 var body : some View {
2424 TabView ( selection: $props. selectedPage) {
2525 ForEach ( props. children. indices, id: \. self) { index in
@@ -34,7 +34,7 @@ struct TabViewImpl: View {
3434 guard let key = props. items. filter ( {
3535 !$0. hidden || $0. key == props. selectedPage
3636 } ) [ safe: index] ? . key else { return }
37-
37+
3838 if isLongPress {
3939 onLongPress ( key)
4040 emitHapticFeedback ( longPress: true )
@@ -73,17 +73,17 @@ struct TabViewImpl: View {
7373#endif
7474 }
7575 }
76-
76+
7777 @ViewBuilder
7878 private func renderTabItem( at index: Int ) -> some View {
7979 let tabData = props. items [ safe: index]
8080 let isHidden = tabData? . hidden ?? false
8181 let isFocused = props. selectedPage == tabData? . key
82-
82+
8383 if !isHidden || isFocused {
8484 let child = props. children [ safe: index] ?? PlatformView ( )
8585 let icon = props. icons [ index]
86-
86+
8787 RepresentableView ( view: child)
8888 . ignoresTopSafeArea (
8989 props. ignoresTopSafeArea,
@@ -103,7 +103,7 @@ struct TabViewImpl: View {
103103#if !os(macOS)
104104 updateTabBarAppearance ( props: props, tabBar: tabBar)
105105#endif
106-
106+
107107#if os(iOS)
108108 guard index >= 4 ,
109109 let key = tabData? . key,
@@ -113,13 +113,13 @@ struct TabViewImpl: View {
113113 }
114114 }
115115 }
116-
116+
117117 func emitHapticFeedback( longPress: Bool = false ) {
118118#if os(iOS)
119119 if !props. hapticFeedbackEnabled {
120120 return
121121 }
122-
122+
123123 if longPress {
124124 UINotificationFeedbackGenerator ( ) . notificationOccurred ( . success)
125125 } else {
@@ -132,12 +132,12 @@ struct TabViewImpl: View {
132132#if !os(macOS)
133133private func updateTabBarAppearance( props: TabViewProps , tabBar: UITabBar ? ) {
134134 guard let tabBar else { return }
135-
135+
136136 if props. scrollEdgeAppearance == " transparent " {
137137 configureTransparentAppearance ( tabBar: tabBar, props: props)
138138 return
139139 }
140-
140+
141141 configureStandardAppearance ( tabBar: tabBar, props: props)
142142}
143143#endif
@@ -149,8 +149,8 @@ private func createFontAttributes(
149149 inactiveTintColor: PlatformColor ?
150150) -> [ NSAttributedString . Key : Any ] {
151151 var attributes : [ NSAttributedString . Key : Any ] = [ : ]
152-
153-
152+
153+
154154 if family != nil || weight != nil {
155155 attributes [ . font] = RCTFont . update (
156156 nil ,
@@ -164,7 +164,7 @@ private func createFontAttributes(
164164 } else {
165165 attributes [ . font] = UIFont . boldSystemFont ( ofSize: size)
166166 }
167-
167+
168168 return attributes
169169}
170170
@@ -180,25 +180,25 @@ private func configureTransparentAppearance(tabBar: UITabBar, props: TabViewProp
180180 tabBar. barTintColor = props. barTintColor
181181 tabBar. isTranslucent = props. translucent
182182 tabBar. unselectedItemTintColor = props. inactiveTintColor
183-
183+
184184 guard let items = tabBar. items else { return }
185-
185+
186186 let fontSize = props. fontSize != nil ? CGFloat ( props. fontSize!) : tabBarDefaultFontSize
187187 let attributes = createFontAttributes (
188188 size: fontSize,
189189 family: props. fontFamily,
190190 weight: props. fontWeight,
191191 inactiveTintColor: nil
192192 )
193-
193+
194194 items. forEach { item in
195195 item. setTitleTextAttributes ( attributes, for: . normal)
196196 }
197197}
198198
199199private func configureStandardAppearance( tabBar: UITabBar , props: TabViewProps ) {
200200 let appearance = UITabBarAppearance ( )
201-
201+
202202 // Configure background
203203 switch props. scrollEdgeAppearance {
204204 case " opaque " :
@@ -207,33 +207,33 @@ private func configureStandardAppearance(tabBar: UITabBar, props: TabViewProps)
207207 appearance. configureWithDefaultBackground ( )
208208 }
209209 appearance. backgroundColor = props. barTintColor
210-
210+
211211 // Configure item appearance
212212 let itemAppearance = UITabBarItemAppearance ( )
213213 let fontSize = props. fontSize != nil ? CGFloat ( props. fontSize!) : tabBarDefaultFontSize
214-
214+
215215 var attributes = createFontAttributes (
216216 size: fontSize,
217217 family: props. fontFamily,
218218 weight: props. fontWeight,
219219 inactiveTintColor: props. inactiveTintColor
220220 )
221-
221+
222222 if let inactiveTintColor = props. inactiveTintColor {
223223 attributes [ . foregroundColor] = inactiveTintColor
224224 }
225-
225+
226226 if let inactiveTintColor = props. inactiveTintColor {
227227 itemAppearance. normal. iconColor = inactiveTintColor
228228 }
229-
229+
230230 itemAppearance. normal. titleTextAttributes = attributes
231-
231+
232232 // Apply item appearance to all layouts
233233 appearance. stackedLayoutAppearance = itemAppearance
234234 appearance. inlineLayoutAppearance = itemAppearance
235235 appearance. compactInlineLayoutAppearance = itemAppearance
236-
236+
237237 // Apply final appearance
238238 tabBar. standardAppearance = appearance
239239 if #available( iOS 15 . 0 , * ) {
@@ -259,7 +259,7 @@ extension View {
259259 self
260260 }
261261 }
262-
262+
263263 @ViewBuilder
264264 func tabBadge( _ data: String ? ) -> some View {
265265 if #available( iOS 15 . 0 , macOS 15 . 0 , visionOS 2 . 0 , tvOS 15 . 0 , * ) {
@@ -276,7 +276,7 @@ extension View {
276276 self
277277 }
278278 }
279-
279+
280280 @ViewBuilder
281281 func ignoresTopSafeArea(
282282 _ flag: Bool ,
@@ -290,7 +290,7 @@ extension View {
290290 . ignoresSafeArea ( . container, edges: . bottom)
291291 }
292292 }
293-
293+
294294#if !os(macOS)
295295 @ViewBuilder
296296 func configureAppearance( props: TabViewProps , tabBar: UITabBar ? ) -> some View {
@@ -321,7 +321,7 @@ extension View {
321321 }
322322 }
323323#endif
324-
324+
325325 @ViewBuilder
326326 func tintColor( _ color: PlatformColor ? ) -> some View {
327327 if let color {
@@ -335,7 +335,7 @@ extension View {
335335 self
336336 }
337337 }
338-
338+
339339 // Allows TabView to use unfilled SFSymbols.
340340 // By default they are always filled.
341341 @ViewBuilder
0 commit comments