티스토리 뷰

React Navigation의 native stack을 활용하여 네비게이션을 사용중이었는데, 공식문서에 나와있는 것처럼 뒤로가기 방지 설정을 해주었는데도 방지가 안되고 뒤로가기가 잘 되고 해당 에러를 뱉었다.

 

아무래도 e.preventDefault() 함수가 작동하지 않아 발생하는 것 같다.

 

The screen ... was removed natively but didn't get removed from JS state.
This can happen if the action was prevented in a 'beforeRemove' listener, which is not fully supported in native-stack.
Consider using 'gestureEnabled: false' to prevent back gesture and use a custom back button with 'headerLeft' option to override the native behavior.

 

검색을 해보니 native stack 말고 stack 으로 변경해야 뒤로가기 방지가 잘 된다는 말을 듣고 stack으로 변경 후 시도를 했을 때 뒤로가기 방지가 되었다.

 

다만, 기존의 native-stack에서 사용중이었던 화면전환 animation 옵션(fade)은 지원하지 않아 따로 기능을 변경하거나 추가적인 작업이 필요할 것 같다.

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/03   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
글 보관함