[React Native] Navigation 사용시, 스크린 이동할 때 새로고침

260·2023년 6월 1일
0

React Native

목록 보기
2/5

스크린 이동 시 새로고침

스크린 간의 이동이 있을 때 새로고침을 실행시키려면 스크린 옵션에 'unmountOnBlur: true' 을 추가해주면 된다.

   <Stack1.Navigator screenOptions={{ headerShown: false }}>
      <Stack1.Screen name="MyLibrary" component={ MyLibrary } options={{ unmountOnBlur: true }}/>
      <Stack1.Screen name="CreateReport" component={ CreateReport } options={{ unmountOnBlur: true }} />
    </Stack1.Navigator>
  );

위와 같이 작성하면 MyLibrary, CreateReport 스크린에 접속할 때마다 새로고침이 실행된다.

0개의 댓글