Skip to content
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

chore: add @ui-kitten/metro-config package #895

Merged
merged 14 commits into from
Feb 24, 2020

Conversation

artyorsh
Copy link
Collaborator

@artyorsh artyorsh commented Feb 17, 2020

Please read and mark the following check list before creating a pull request:

Short description of what this resolves:

Computes Eva styles during the build time allowing the application load much faster.


Integration (Guide)

  1. yarn add -D @ui-kitten/metro-config
  2. Add or modify metro.config.js with following configuration
+ const MetroConfig = require('@ui-kitten/metro-config');

+ const evaConfig = { 
+   evaPackage: '@eva-design/eva', // Required (Can be `@eva-design/material`)
+   customMappingPath: './custom-mapping.json', // Optional
+ };

+ module.exports = MetroConfig.create(evaConfig, {
+   // Whatever was in previous metro.config.js 
+ });
  1. Modify props of ApplicationProvider
- import { mapping, light } from '@eva-design/eva';
+ import * as eva from '@eva-design/eva'; 
- import { customMapping } from './custom-mapping.js'

export default = () => (
- <ApplicationProvider mapping={mapping} theme={light} />
+ <ApplicationProvider {...eva} theme={eva.light} />
);

Limitations

Not compatible with Fast Refresh - will reload app completely whenever custom mapping is changed if it is used.

How it works

@artyorsh artyorsh self-assigned this Feb 17, 2020
@github-actions
Copy link

Try running it with Kitten Tricks

.

@artyorsh artyorsh marked this pull request as ready for review February 18, 2020 08:17
@alansoliditydev
Copy link

please merge this, my app have issues with the boot time. approx 6 - 7 secs for fully loaded :(

@artyorsh
Copy link
Collaborator Author

@TRANDINHKHANG do you use custom mapping or React Native Navigation by Wix?

@YIZHUANG
Copy link

@artyorsh have you tested this change reduce the load time to almost 0?

@artyorsh
Copy link
Collaborator Author

@YIZHUANG yes, I already run it locally in Kitten Tricks

@YIZHUANG
Copy link

@artyorsh nice, good job!

@YIZHUANG
Copy link

Any guides on how i can test this in my app already before it's merged?

@YIZHUANG
Copy link

I ended up just copying the end output (2.6mb) json, and remove the "process" function

@artyorsh artyorsh merged commit 12230c6 into next Feb 24, 2020
@artyorsh artyorsh deleted the feat/build-time-mapping-processing branch February 24, 2020 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants