我有像下面這樣的底部導航器
<DirectStack.Navigator screenOptions={appStackScreenOption}>
<DirectStack.Screen name="CList" component={CList}
options={(navigation) => ({
headerRight: () => (
<View style={{ flexDirection: 'row' }}>{AddListButton(navigation)}</View>
),
})} />
<DirectStack.Screen name="C" component={C} />
<DirectStack.Screen
name="AddList"
component={AddList}
/>
</DirectStack.Navigator >
默認情況下,當我第一次加載我所在的螢屏并CList
按下右鍵時,我導航到AddList
螢屏,然后從AddList
螢屏導航到C
螢屏,直到現在一切都很好,但是當我從C
螢屏按下后標題按鈕時,我想導航到初始螢屏即CList
。
目前,當我從螢屏按下后標題按鈕時,C
我導航到了AddList
我不想要的螢屏。
uj5u.com熱心網友回復:
您可以通過呼叫彈出所有螢屏堆疊來實作此目的navigation.popToTop()
另請參閱此popToTop
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/477994.html