Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[질문] push로 인해 stack에 쌓인 액티비티들을 한번에 없앨 수 있는 방법에 대한 문의입니다 #525

Open
uthem150 opened this issue Oct 4, 2024 · 0 comments

Comments

@uthem150
Copy link

uthem150 commented Oct 4, 2024

안녕하세요,
이전에 pop을 할 때, 배열을 함께 지워야 하는지에 대해 pull request를 드렸던 학생입니다.

해당 부분 외에, 추가로 궁금한 사항이 있었는데,
https://stackflow.so/ 문서에는 궁금한 부분에 대한 내용이 없어서
좋은 방법이 있는지에 대한 문의를 드리고자 issue를 남기게 되었습니다.

stackflow를 활용한 개발 도중, push를 통해 액티비티들을 추가하다 보면,
'홈 버튼' 기능과 같이, 쌓인 이전 액티비티들을 모두 초기화하고,
처음으로 돌아가고자 하는 상황에 대한 처리도 필요하다는 생각을 하게 되었습니다.

액티비티들을 1개씩 push하고, pop하는 방법 외에,
clear하는 함수는 따로 문서에 제공되어있지 않아

아래와 같이, 배열 길이만큼 pop을 반복하는 식으로 기능을 대신하고 있는데,
혹시 별도의 제공되는 기능이나, 더 좋은 구현 방식이 있다면 알 수 있을까요?

	const activeActivities = stack.activities.filter(
		(activity) => activity.transitionState === 'enter-active' || activity.transitionState === 'enter-done'
	);

	for (let i = activeActivities .length; i > 1; --i) {
		pop({ animate: false });
	 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant