如何在React Native中的嵌套导航器中重置导航堆栈状态

时间:2020-10-17 05:40:07

标签: react-native navigation stack-navigator tabnavigator react-native-tabnavigator

我的代码类似于以下代码。假设当前我的导航堆栈历史记录是:

屏幕A>屏幕B>屏幕D。

在屏幕D上按下按钮,我要重设导航堆栈的状态/历史记录,如下所示:屏幕A>屏幕F

但是我收到此错误:

Imports System.Data
Imports System.Data.SqlClient

Public Class Form1
    Private conn As New SqlConnection
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            conn.ConnectionString = "Data Source=ROG\SQLEXPRESS;Initial Catalog=GKEAPL;Integrated Security=True;"
            conn.Open()
            MsgBox("Connected")
        Catch ex As Exception
            MsgBox("Could Not connect")
        End Try
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Try
            Dim officeexcel As New Microsoft.Office.Interop.Excel.Application
            officeexcel = CreateObject("Excel.Application")
            Dim workbook As Object = officeexcel.Workbooks.Add("D:\GKEAPL\project 1\gk format.xltx")
            officeexcel.Visible = True
            Dim da As New SqlDataAdapter
            Dim ds As New DataSet
            da = New SqlDataAdapter("SELECT FeedWaterTankLevelFWST101,
                                    FeedFlowFT101,
                                    ClearWaterTankLevelCWST201,
                                    TMFilPressurePT201,
                                    TMFolPressurePT202,
                                    HPPilPressurePT203,
                                    MembraneilPressurePT204,
                                    MembraneolPressurePT205,
                                    PermeateFlowFT201,
                                    RejectFlowFT202
                 FROM DATA1 WHERE(DATEnTIME >='2020-12-18 11:06:30.000' AND DATEnTIME <= '2020-12-19 10:07:31.000')", conn)
            da.Fill(ds, "DATA1")

            For i As Integer = 0 To ds.Tables("DATA1").Rows.Count - 1

                With officeexcel
                    .Range("Sheet2!B" + (i + 7).ToString).Value = ds.Tables("DATA1").Rows(i).Item(0).ToString
                    .Range("Sheet2!C" + (i + 7).ToString).Value = ds.Tables("DATA1").Rows(i).Item(1).ToString
                    .Range("Sheet2!D" + (i + 7).ToString).Value = ds.Tables("DATA1").Rows(i).Item(2).ToString
                    .Range("Sheet2!E" + (i + 7).ToString).Value = ds.Tables("DATA1").Rows(i).Item(3).ToString
                    .Range("Sheet1!F" + (i + 7).ToString).Value = ds.Tables("DATA1").Rows(i).Item(4).ToString
                    .Range("Sheet1!G" + (i + 7).ToString).Value = ds.Tables("DATA1").Rows(i).Item(5).ToString
                    .Range("Sheet1!H" + (i + 7).ToString).Value = ds.Tables("DATA1").Rows(i).Item(6).ToString
                    .Range("Sheet1!I" + (i + 7).ToString).Value = ds.Tables("DATA1").Rows(i).Item(7).ToString
                    .Range("Sheet1!J" + (i + 7).ToString).Value = ds.Tables("DATA1").Rows(i).Item(8).ToString
                    .Range("Sheet1!K" + (i + 7).ToString).Value = ds.Tables("DATA1").Rows(i).Item(9).ToString
                End With
            Next

            officeexcel = Nothing
            workbook = Nothing
        Catch ex As Exception

        End Try

    End Sub
    Private Sub Report_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        DateTimePicker1.CustomFormat = "YYYY-MMMM-DD"
    End Sub

End Class
  The action 'RESET' with payload {"index":1,"routes":[{"name":"Screen A"},{"name":"Screen F"}]} was not handled by any navigator.

1 个答案:

答案 0 :(得分:1)

从这里使用 CommonActions.reset() https://reactnavigation.org/docs/navigation-actions

效果很好。

相关问题