Skip to content

Lazy initialized TabBar #634

Answered by grahammendick
burakgormek asked this question in Q&A
Discussion options

You must be logged in to vote

This has been fixed by #650

Thanks @burakgormek for the great discussion. I really enjoyed chewing over some ideas with you. Hopefully we can work together again on something. I’ll thank you more formally in the release notes.

In summary, the Navigation router freezes inactive tabs once they’ve been visited. To handle freezing an inactive tab that hasn’t been visited, there’s a TabBarItemContext with an onLoad function. The user calls onLoad once it’s safe to freeze. In a Twitter example, the notifications tab is frozen once the data is fetched,

const NotificationsTab = () => {
  const {onLoad} = useContext(TabBarItemContext);
  const [notifications, setNotifications] = useState();
  useE…

Replies: 6 comments 30 replies

Comment options

You must be logged in to vote
2 replies
@grahammendick
Comment options

@burakgormek
Comment options

Comment options

You must be logged in to vote
4 replies
@grahammendick
Comment options

@burakgormek
Comment options

@grahammendick
Comment options

@burakgormek
Comment options

Comment options

You must be logged in to vote
5 replies
@burakgormek
Comment options

@grahammendick
Comment options

@burakgormek
Comment options

@grahammendick
Comment options

@burakgormek
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
19 replies
@grahammendick
Comment options

@grahammendick
Comment options

@burakgormek
Comment options

@grahammendick
Comment options

@burakgormek
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by grahammendick
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants