Skip to content

UILib Packages #723

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

Merged
merged 8 commits into from
Jul 26, 2020
Merged

UILib Packages #723

merged 8 commits into from
Jul 26, 2020

Conversation

ethanshar
Copy link
Collaborator

@ethanshar ethanshar commented Mar 29, 2020

This PR include a script for generating custom, partial packages for uilib.

What does it mean?
It means the user will be able to import a single component in the following way

import View from 'react-native-ui-lib/view';

Why is it important?
By not importing the whole library and only specific components you

  1. Don't have to install peer native dependencies that you don't need (You won't get an error)
  2. The total bundle size of the app will be reduced only to the component files you import.
    (Today uilib is 33% of bundle size of a new empty project)
  • Create 'react-native-ui-lib/core' package for basic components (View, Text, Image, TouchableOpacity, etc..)
  • Create 'react-native-ui-lib/keyboard' package for all Keyboard components we migrated from other repos (KeyboardTrackingView, KeyboardAwareInsetsView, etc...)
  • Create 'react-native-ui-lib/xxx' package per component to allow single component imports.

@ethanshar ethanshar added the WIP label Mar 29, 2020
@stale stale bot added the wontfix label Jul 13, 2020
@ethanshar ethanshar removed the wontfix label Jul 13, 2020
@wix wix deleted a comment from stale bot Jul 13, 2020
@ethanshar ethanshar changed the title Create an entry file for core sub module of rnuilib UILib Packages Jul 23, 2020
const packages = [
{
filename: 'keyboard.js',
content: `module.exports = require('./lib/components/Keyboard').default;\n`
Copy link
Collaborator

@Inbal-Tish Inbal-Tish Jul 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use 'components: [keyboard]'? It's clearer and you can add other keyboard components in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look at ./lib/components/Keyboard
It already contains all the various Keyboard components we have.
The user will be able to import it like this

import {KeyboardTrackingView, KeyboardAwareInsetsView, KeyboardRegistry, ...} from 'react-native-ui-lib/keyobard';

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. mmm... I still think it's clearer to use the same object format, seems less random. Your call.

@Inbal-Tish
Copy link
Collaborator

Very cool!!!

@ethanshar ethanshar requested a review from Inbal-Tish July 26, 2020 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using indidividual components impact on app size and performance
2 participants