[ReactNative] navigation 스택 커스텀하기

hyeonze·2022년 9월 1일
0

결제나 회원가입 의 경우 navigate 후 네비게이션 스택에서 일부 만 제거하거나 초기화 하는 등의 커스텀이 필요할 때가 있음. 초기화는 naivation.reset으로 간단히 처리가능하지만, 커스텀은 아래와 같은 방법을 사용할 수 있음.

import {CommonActions} from '@react-navigation/native';
navigation.dispatch(
	CommonActions.reset({
	index: 1,
	routes: [{name: 'Page1'}, {name: 'page2'}],
	}),
);
profile
Advanced thinking should be put into advanced code.

0개의 댓글