From 1d964ce68ef88de9e045eafa4cb8257d14c1102d Mon Sep 17 00:00:00 2001 From: Djorkaeff Alexandre Date: Thu, 15 Feb 2024 14:55:41 -0300 Subject: [PATCH] Update ChatScrollView on WatchOS 10 --- .../Views/ChatScrollView.swift | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/ios/RocketChat Watch App/Views/ChatScrollView.swift b/ios/RocketChat Watch App/Views/ChatScrollView.swift index bee358c3f..7e2baf745 100644 --- a/ios/RocketChat Watch App/Views/ChatScrollView.swift +++ b/ios/RocketChat Watch App/Views/ChatScrollView.swift @@ -6,29 +6,23 @@ import SwiftUI /// We hide the indicators for the flipped scroll view, since they appear reversed. struct ChatScrollView: View { private let content: () -> Content - + init(@ViewBuilder content: @escaping () -> Content) { self.content = content } var body: some View { - ScrollView(showsIndicators: false) { - content() - .rotationEffect(.degrees(180)) + if #available(watchOS 10.0, *) { + ScrollView { + content() + } + .defaultScrollAnchor(.bottom) + } else { + ScrollView(showsIndicators: false) { + content() + .rotationEffect(.degrees(180)) + } + .rotationEffect(.degrees(180)) } - .rotationEffect(.degrees(180)) } } - -// if #available(watchOS 10.0, *) { -// ScrollView { -// content() -// } -// .defaultScrollAnchor(.bottom) -// } else { -// ScrollView(showsIndicators: false) { -// content() -// .rotationEffect(.degrees(180)) -// } -// .rotationEffect(.degrees(180)) -// }