title: Swiftui - Padding is changing when using navigationlink to open another view
body: <p>This is a slightly odd issue I'm running into. The best way to explain it is to show you. You can see with this video, <a href="https://imgur.com/a/mNoNcQl" rel="nofollow noreferrer">https://imgur.com/a/mNoNcQl</a>. What's causing this?</p>
  <p>I'm also getting this message at the same time.</p>
  <p>[Assert] displayModeButtonItem is internally managed and not exposed for DoubleColumn style. Returning an empty, disconnected UIBarButtonItem to fulfill the non-null contract.</p>
  <p>This is the first view you see.</p>
  <pre><code>var body: some View {
      
      let income = getIncome()
      let expenses = getExpenses()
      let difference = income - expenses
  
      NavigationView {
  
          List {
              Text(getGreeting())
                  .font(.title2)
              
              Section(header: Text(&quot;Stats&quot;)) {
                  let incomeTransactions = transactions.filter({$0.kind == TransactionType.income.rawValue})
                  let expenseTransactions = transactions.filter({$0.kind == TransactionType.expense.rawValue})
                  
                  NavigationLink(destination: StatDetailView(title: &quot;Income&quot;, balance: income.round(), transactions: incomeTransactions, month: now.month, user: $user)) {
                      HStack {
                          Text(&quot;Income&quot;)
                          Spacer()
                          Text(&quot;$\(income.round())&quot;)
                              .foregroundColor(.brg)
                      }
                  }
                  
                  NavigationLink(destination: StatDetailView(title: &quot;Expenses&quot;, balance: expenses.round(), transactions: expenseTransactions, month: now.month, user: $user)){
                      HStack {
                          Text(&quot;Expenses&quot;)
                          Spacer()
                          Text(&quot;$\(expenses.round())&quot;)
                              .foregroundColor(.darkRed)
                      }
                  }
                  
                  HStack {
                      Text(&quot;Difference&quot;)
                      Spacer()
                      Text(&quot;$\(difference.round())&quot;)
                          .foregroundColor(income &lt; expenses ? .darkRed : .brg)
                  }
              }
              
              Section(header: Text(&quot;Accounts&quot;)) {
                  
                  ForEach(user.accounts, id: \.self) { account in
                      HStack {
                          Text(account.fullName)
                          Spacer()
                          Text(&quot;$\(account.balance.round())&quot;)
                              .foregroundColor((account.kind == Account.Kind.credit.rawValue) ? .darkRed : .brg) //Set credit account balance to red since you owe that money
                      }
                  }
              }
              
              Section(header: Text(&quot;Categories&quot;)) {
                  ForEach(user.categories, id: \.self) { category in
                      HStack {
                          Text(category.name)
                          Spacer()
                          Text(&quot;$\(getCategoryAmount(category: category).round())&quot;)
                      }
                  }
              }
          }
          .listStyle(InsetGroupedListStyle())
          .navigationTitle(now.month)
          .navigationBarItems(trailing: Button(action: {showSettings.toggle()}, label: {
              Image(systemName: &quot;gearshape&quot;)
                  .font(.title2)
          }))
          .sheet(isPresented: $showSettings, content: {
              //Show view
              SettingsView(user: $user)
          })
          .onChange(of: scenePhase){ phase in
              if phase == .inactive {saveAction()}
          }
      }
  </code></pre>
  <p>This is the view titled &quot;Expenses&quot;</p>
  <pre><code>var body: some View {
          List{
              Section(header: Text(&quot;Current \(title)&quot;)) {
                  HStack {
                      Text(month)
                      Spacer()
                      Text(&quot;$\(balance)&quot;)
                  }
                  
                  if title == TransactionType.income.rawValue {
                      let sources = getSourceAmount()
                      
                      if sources.count == 0 {
                          Text(&quot;No source income information.&quot;)
                      } else {
                          ForEach(sources, id:\.self) { source in
                              HStack {
                                  Text(&quot;From \(source.name)&quot;)
                                  Spacer()
                                  Text(&quot;$\(source.amount.round())&quot;)
                              }
                              
                          }
                      }
                  }
                      
              }
              
              
              Section(header: Text(&quot;Transactions&quot;)) {
                  
                  if transactions.count &gt; 0 {
                      
                      ForEach(transactions.indices, id: \.self) { index in
                          NavigationLink(destination: TransactionDetailView(index: index)) {
                              TransactionRow(transaction: transactions[index])
                          }
                      }
                      .padding()
                      
                      
                  } else {
                      Text(&quot;No transactions for this month.&quot;)
                  }
              }
          }
          .navigationTitle(title)
          .listStyle(InsetGroupedListStyle())
      
      
  }
  </code></pre>
  <p>This is the view that shows when you click on the transaction.</p>
  <pre><code>var body: some View {
      let transaction = transactions[index]
      
      List {
          Section(header: Text(&quot;Details&quot;)) {
              HStack {
                  Text(&quot;Type&quot;)
                  Spacer()
                  Text(transaction.kind!)
              }
              
              HStack {
                  Text(&quot;Amount&quot;)
                  Spacer()
                  Text(&quot;$\(transaction.amount.round())&quot;)
              }
              
              if transaction.note != &quot;&quot; {
                  HStack{
                      Text(&quot;Note&quot;)
                      Spacer()
                      Text(transaction.note!)
                  }
                  
              }
              
              if transaction.kind == TransactionType.income.rawValue {
                  HStack {
                      Text(&quot;Source&quot;)
                      Spacer()
                      Text(transaction.source!)
                  }
                  
                  HStack {
                      Text(&quot;Account&quot;)
                      Spacer()
                      Text(transaction.account!)
                  }
              } else
              if transaction.kind == TransactionType.expense.rawValue {
                  HStack {
                      Text(&quot;Category&quot;)
                      Spacer()
                      Text(transaction.category!)
                  }
                  
                  if transaction.subcategory != &quot;&quot; {
                      HStack {
                          Text(&quot;Subcategory&quot;)
                          Spacer()
                          Text(transaction.subcategory!)
                      }
                  }
                  
                  HStack {
                      Text(&quot;Account&quot;)
                      Spacer()
                      Text(transaction.account!)
                  }
              } else {
                  HStack {
                      Text(&quot;From&quot;)
                      Spacer()
                      Text(transaction.account!)
                  }
                  
                  HStack {
                      Text(&quot;To&quot;)
                      Spacer()
                      Text(transaction.toAccount!)
                  }
              }
          }
          
      }
      .navigationTitle(&quot;\(transaction.date!.monthDayYear)&quot;)
      .listStyle(InsetGroupedListStyle())
  }
  </code></pre>