Closed lowryrussell closed 8 months ago
Hey @lowryrussell,
Can you share some sample code on how are you doing this? Or if you have a small sample project where you have this reproducible, that would be great.
Thanks, Martin
@martinmitrevski I just put up a sample app repo at https://github.com/lowryrussell/SampleStreamApp if you want to take a look. If you comment out the first two tabs, then everything works fine. Make sure to also run it on a device because the SwiftUI previews don't experience the same issue.
// TabOneNavigationStack()
// .tag(AppScreen.tabOne)
// .tabItem { AppScreen.tabOne.label }
// TabTwoNavigationStack()
// .tag(AppScreen.tabTwo)
// .tabItem { AppScreen.tabTwo.label }
Thanks for sharing the demo project. I run it, but everything works well for me. Not sure if I'm following the correct steps, I'm attaching a video.
https://github.com/GetStream/stream-chat-swiftui/assets/2971717/dedb2fb6-9384-4b2f-9490-15b351fc60e4
You can see here I go to the chat the first time and I type one letter and it backs me out to the first tab. I go back to the chat and the issue isn't present anymore.
Yes, trying with those steps, but can't reproduce it. I'm also trying on Xcode 15.1. Looking at the code, one thing that could be causing this is:
channelController: chatClient.channelController(for: try! ChannelId(cid: "messaging:18FD137A-8"))
Can you instead create and keep the controller in the parent view as state, and just pass it here?
That unfortunately doesn't solve it either.
just to make sure - the video you shared was recorded with the exact sample repo you provided and you can reproduce it there consistently?
Yes, correct. I can reproduce every new build (since it only happens the first time I type in the message field)
Hey @lowryrussell
I've just tried the repo you shared with us on an iPhone 14 Pro(17.1.2) to try match the setup you have. Unfortunately I wasn't able to reproduce the issue.
https://github.com/GetStream/stream-chat-swiftui/assets/472467/d8cd3330-4e53-482b-8975-bce1bc0263ab
Do you have any further information that may help us reproduce the issue on our side in order to be able to assist you?
I just confirmed it's not an issue on my iPhone XS Max, but it is still an issue on my iPhone 14 Pro Max. Both of my devices are on iOS 17.2.1
Interestingly enough, it appears it was due to the TabBar implementation. I moved the TabBar state to the main App and this appears to be resolved now. Thanks guys for debugging.
great, nice to hear that
What did you do?
Typing a message the first time when navigating to ChatChannelView, the view dismisses and navigates back to the first TabBarItem. Subsequent visits to the ChatChannelView don't cause this issue. I also get a list of
AttributeGraph
messages logged to the console when the issue happens the first time.What did you expect to happen?
I expect to be able to type normally without being routed to a different screen
What happened instead?
Routed back to the first TabBarItem
GetStream Environment
GetStream Chat version: 4.46.0 GetStream Chat frameworks: StreamChat, StreamChatSwiftUI iOS version: 17.1.2 Swift version: Swift 5 Xcode version: 15.1 Device: iPhone 14 Pro Max
Additional context
If the
ChatChannelView
is the first TabBarItem, this issue does not happen. Once there is a TabBarItem that precedes theChatChannelView
's TabBarItem, this error happens.