kirillzyusko / react-native-bundle-splitter

HOC for lazy components loading

Home Page:https://kirillzyusko.github.io/react-native-bundle-splitter/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory Leak Detect Tools

seenyea opened this issue · comments

Is your feature request related to a problem? Please describe.
when I rewrite my page following the step by the document, but two main problem cause:

  1. navigation.goBack() dose not cool
  2. the static props does not cool

but let it my pc alone a while, what a amazing! Everything goes cool

Describe the solution you'd like
Supply a Memory Leak Detect Tool

Hi @seenyea

Could you please provide more details?

  1. In which cases navigation.goBack() doesn't work? Could you create small reproducible demo?
  2. What you mean by static props? static navigation options? You can not continue use them. Please, read docs how this support is implemented in this library: https://kirillzyusko.github.io/react-native-bundle-splitter/docs/static-options

What you mean by memory leaks? Have you found them in library?

Problem 1 and problem 2 occur randomly(about 1times per 10 times) in react native navigation v3.
React native navigation v3 support static props https://reactnavigation.org/docs/3.x/headers
here are some code snap
image
image

@seenyea I know, that it supports. And I'm using this fact in my library.

The reason why I moved static fields outside of component was quite simple. In this options you can specify some important things, such as style for header, title and so on, right? If you do lazy loading of these props - during transition between screens you will see default header and after some time (when component will be loaded) you will see proper elements.
And it will be not good from UI perspective.

I could try to inject static props from component when you are doing preload, but... At the point of designing a library I knew, that in react-navigation v5 you will not need to use static props. Instead of it you can declare all options straight in markup. And I didn't want to add additional complexity into library and decided to stick with simple approach :)

The reason why I moved static fields outside of component was quite simple. In this options you can specify some important things, such as style for header, title and so on, right?

I think the final OptimizedComponent need set static properties at first, or it may cause state no routes error, especially for tabs.

@seenyea it sets static props: https://github.com/kirillzyusko/react-native-bundle-splitter/blob/master/src/optimized.tsx#L54

If you pass static into register function - everything should be okay.

Closing this issue as no proof provided about memory leaks.