Skip to content

Commit

Permalink
Fix app crash when using many tabs (#81)
Browse files Browse the repository at this point in the history
* fix: call visitableWillAppear sooner

* docs: add comment to explain fix
  • Loading branch information
mironiasty committed Dec 21, 2023
1 parent ccaf703 commit c75e5da
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/turbo/ios/RNVisitableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ class RNVisitableView: UIView, RNSessionSubscriber {
controller.didMove(toParent: reactViewController())
addSubview(controller.view)
}

override func willMove(toWindow newWindow: UIWindow?) {
// visitableWillAppear is not called automatically sometimes. So it has to be called
// manually to make sure that visitableViews list is not empty
// see https://github.com/software-mansion-labs/react-native-turbo-demo/pull/81
controller.viewWillAppear(false)
}

public func handleMessage(message: WKScriptMessage) {
if let messageBody = message.body as? [AnyHashable : Any] {
Expand Down

0 comments on commit c75e5da

Please sign in to comment.