react-native-date-picker icon indicating copy to clipboard operation
react-native-date-picker copied to clipboard

Reduce library size by excluding for non english resources

Open ranjanrukhaya opened this issue 3 years ago • 1 comments

This lib support multiple languages and include many resources for that but I just need to support only one language i.e "en" in the date picker.

Is there any way by which i can only get the resources required for "en" language and exclude others. This will help us in reducing app size.

ranjanrukhaya avatar Mar 05 '21 10:03 ranjanrukhaya

For Android: You can use the following code in app/build.gradle to reduce size. This assumes you want only english language. The patterns & include exclude could be modified according to your needs. Put it in android block as given.

You could easily save around 400kb with this.

applicationVariants.all { variant ->
        if (variant.buildType.name == 'release') {
            variant.mergeAssetsProvider.configure {
                doLast {
                    delete(fileTree(dir: outputDir, includes: ['**/time4j/**/*.*'],
                            excludes: ['**/time4j/**/*.repository',
                                       '**/time4j/**/roc.*',
                                       '**/time4j/**/indian.*',
                                       '**/time4j/**/*.tab',
                                       '**/time4j/**/tzname.*',
                                       '**/time4j/i18n/**/iso8601.*',
                                       '**/time4j/i18n/**/relpattern.*',
                                       '**/time4j/i18n/**/upattern.*',
                                       '**/time4j/i18n/**/symbol.*',
                                       '**/time4j/**/generic.*', 
                                       '**/time4j/**/*_en.*', 
                                       '**/time4j/**/*_en_*.*']))
                }
            }
        }
    }

amankgo avatar Apr 20 '21 14:04 amankgo