File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Sources/NavigationBackport Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ struct Node<Screen>: View {
66 let truncateToIndex : ( Int ) -> Void
77 let index : Int
88 let screen : Screen ?
9+
10+ @State var isAppeared = false
911
1012 init ( allScreens: [ Screen ] , truncateToIndex: @escaping ( Int ) -> Void , index: Int ) {
1113 self . allScreens = allScreens
@@ -20,6 +22,7 @@ struct Node<Screen>: View {
2022 set: { isShowing in
2123 guard !isShowing else { return }
2224 guard allScreens. count > index + 1 else { return }
25+ guard isAppeared else { return }
2326 truncateToIndex ( index + 1 )
2427 }
2528 )
@@ -36,6 +39,8 @@ struct Node<Screen>: View {
3639 NavigationLink ( destination: next, isActive: isActiveBinding, label: EmptyView . init)
3740 . hidden ( )
3841 )
42+ . onAppear { isAppeared = true }
43+ . onDisappear { isAppeared = false }
3944 }
4045 }
4146}
You can’t perform that action at this time.
0 commit comments