-
Notifications
You must be signed in to change notification settings - Fork 958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ApplicationProvider shouldn't process mappings everytime it's mounted #613
Comments
Hi. Big thanks for reporting this as we were not able to test it with react-native-navigation. Unfortunately, we're able to process mappings just because we had an idea to support custom mappings. Btw, can you please share related code so I can play with it? AFAIK, |
this issue still existing, did you guys find a solution already? @DaniShalash @artyorsh |
@kabus202 we can't focus on this at the moment. This issue is also mentioned in our docs |
@kabus202 The problem:When using react-native-navigation by Wix, every time you push a screen/modal/view in your app, UI Kitten's Application provider is re-processing the styles mappings, which is the process that's causing the performance issue. The Solution:If the "ApplicationProvider" can process the style mappings once, and then cache the result for the subsequent times (or even better if we can process these results at build time and save it to a local file to be used in real time) then we can solve the issue. So here's the solution in 2 different ways: The quick way:
The better way:
### Notes:
@artyorsh |
@DaniShalash thank you for you explanation, i manage to get it working! |
@DaniShalash thanks for the detailed answer. We need to support mapping customization, hence we do it in runtime. I've already thought about parsing I would like to discuss this if you have any other ideas on doing this better @kabus202 this will work, but keep in mind that you need to do this manually every time you update |
@artyorsh In other words, the themeProvider can be a hoc that accepts the app component along with style mappings and theme as args, and after processing and caching the output it will provide changeMappings and changeTheme props to appComponent. I know this is kind of complicated in comparison to what we have now, but it'll make UIKitten navigation-solution-agnostic, which I guess is pretty much important. BTW, I still find something like |
Probably similar to #593: I was curious whether Expo Constants package dynamically updates |
@DaniShalash Could you please review the idea of this pr and give feedback? |
Hi @artyorsh I installed the v4.4.1 yesterday and it didn't fix my issue #855
|
@qlereboursBS this and related issues (e.g #855) were closed because now we have a package that processes mapping during the build time. Read the docs |
Thanks, I didn't see that your message was linking to a changelog. |
Hey guys, sorry I’ve quiet busy lately so I couldn’t have time to respond, however I’ll be free soon. Just wanted to point out that the current solution is much better, but honestly I’m still holding to 4.2.x, the reason: The processed mapping output in 4.2.x is about 35k lines json file, while in the latest version it’s more than 100k! Also, if we take a look at that json file, there’s a lot of unnecessary duplications, like for example, all of the style variants of a single component share 90% of their style attribute values. This would result in a much more efficient and compressed file than what we have now. I know all I did now is talking, but I just wanted to express my opinion for the time being now. |
@DaniShalash thanks for sharing! Can you please give more details on it?
|
I'm submitting a ...
Issue description
This is not an issue with UI Kitten itself, but rather a request to make play well with a very popular library (react-native-navigation by Wix) and maybe others.
Current behavior:
In order to use the framework with its theming capabilities we should wrap our app with UI Kitten ApplicationProvider.
ApplicationProvider uses Eva System to process mapping schemas upon its construction, which takes a couple of seconds on an average Android phone (Which is fine).
Now, In case we're using react-navigation as a navigation solution, ApplicationProvider will be mounted only once at startup (process mapping once), and then all the navigation will take place inside that provider node, and there are no issues in this case.
however, if react-native-navigation is being used, and as you may know, it works by registering each screen component individually and in isolation of others after the app is launched, we have to wrap each screen component with whatever providers being used, including redux, and in this case, UI Kitten ApplicationProvider, thus, whenever a page is being pushed or a modal being shown, the Application provider will process the mapping again which is causing a few seconds delay before the screen component being mounted.
Expected behavior:
Unless mapping prop has changed, Application provider should use a pre-processed data from previous component construction.
Steps to reproduce:
It can be simply reproduced by using react-native-navigation with UI Kitten.
Other information:
OS, device, package version
The text was updated successfully, but these errors were encountered: