oblador / react-native-vector-icons

Customizable Icons for React Native with support for image source and full styling.
https://oblador.github.io/react-native-vector-icons/
MIT License
17.4k stars 2.12k forks source link

Import only required components from react-native #1381

Closed shashankkrjain closed 2 years ago

shashankkrjain commented 3 years ago

Environment

Description

File lib/react-native.js imports all the components from React Native. This is firstly a bad practice since all the components will now be bundled with the application even if they are not being used. For example, PushNotificationsIOS will be bundled in the application even if the application does not use push notifications. Secondly, many deprecated packages are being imported unnecessarily and creating warnings. They also need to be installed separately. For example, DateTimePicker, MaskedViewIOS.

Reproducible Demo

I believe this doesn't require a reproducible demo as it will happen with any application using this package.

Solution

Replace contents of libs/react-native.js from:

export * from 'react-native';

To:

export {
  NativeModules,
  Platform,
  PixelRatio,
  processColor,
  Text,
  StyleSheet
} from 'react-native';
oblador commented 2 years ago

Fixed in 9.0.0