Skip to content

Commit b6b6ad0

Browse files
authored
fix(iOS): various fixes for Apple TV (#134)
1 parent f0ac627 commit b6b6ad0

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

ios/PageSelectedEvent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import React
2727
@objc public func arguments() -> [Any] {
2828
return [
2929
viewTag,
30-
RCTNormalizeInputEventName(eventName),
30+
RCTNormalizeInputEventName(eventName) ?? eventName,
3131
[
3232
"key": key
3333
]

ios/TabLongPressedEvent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protocol RCTEvent {}
3131
@objc public func arguments() -> [Any] {
3232
return [
3333
viewTag,
34-
RCTNormalizeInputEventName(eventName),
34+
RCTNormalizeInputEventName(eventName) ?? eventName,
3535
[
3636
"key": key
3737
]

ios/TabViewImpl.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ struct TabViewImpl: View {
6363
renderTabItem(at: index)
6464
}
6565
}
66+
#if !os(tvOS)
6667
.onTabItemEvent({ index, isLongPress in
6768
guard let key = props.items.filter({
6869
!$0.hidden || $0.key == props.selectedPage
@@ -76,6 +77,7 @@ struct TabViewImpl: View {
7677
emitHapticFeedback()
7778
}
7879
})
80+
#endif
7981
.introspectTabView(closure: { tabController in
8082
tabBar = tabController.tabBar
8183
})
@@ -92,6 +94,9 @@ struct TabViewImpl: View {
9294
UIView.setAnimationsEnabled(true)
9395
}
9496
}
97+
#if os(tvOS)
98+
onSelect(newValue)
99+
#endif
95100
}
96101
}
97102

@@ -278,7 +283,7 @@ extension View {
278283
func tintColor(_ color: UIColor?) -> some View {
279284
if let color {
280285
let color = Color(color)
281-
if #available(iOS 16.0, *) {
286+
if #available(iOS 16.0, tvOS 16.0, *) {
282287
self.tint(color)
283288
} else {
284289
self.accentColor(color)
@@ -292,7 +297,7 @@ extension View {
292297
// By default they are always filled.
293298
@ViewBuilder
294299
func noneSymbolVariant() -> some View {
295-
if #available(iOS 15.0, *) {
300+
if #available(iOS 15.0, tvOS 15.0, *) {
296301
self
297302
.environment(\.symbolVariants, .none)
298303
} else {

0 commit comments

Comments
 (0)