expo / router

[ARCHIVE]: Expo Router has moved to expo/expo -- The File-based router for universal React Native apps

Home Page:https://docs.expo.dev/routing/introduction/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nesting leads to multiple mounts

RohovDmytro opened this issue · comments

Which package manager are you using? (Yarn is recommended)

yarn

Summary

A quite simple navigation structure leads to screens beings mounted multiple times.

Memoization does not help. the screen remounts, not re-renders

I would argue that this bug is close to mission critical as many things are tight to component being mounted. Such features as analytics / data loading / animations become sadly broken.

I've spent quite some time restructuring components trying to avoid nesting, but in a more complicated scenarios (with auth, screen groups, etc) it's very hard. Found zero workarounds.

Minimal reproducible example

https://github.com/RohovDmytro/expo-router-has-a-fundamental-issue

Github threw an error while posting this issue and created a duplicate. Oh, irony!