Developers with the web background starting with React Native can falsely assume that tree shaking is done automatically by the bundler, but it is not. See this comment or this table.

Analyzing the bundle size can be done with react-native-bundle-visualizer

Using the following command (with flag --expo true if you are using Expo):

npx react-native-bundle-visualizer

will result in something similar to the screenshot provided below: bundle visualization

We can argue that profits from reducing a few KB are not worth the time invested, but visualizing the bundle size reminds us to be more careful when choosing libraries we use.

On the screenshot above, we can see that date-fns increases our bundle size by 1.07 MB, which should prompt us to consider other alternatives like day.js.

You can also decrease the bundle size of lodash by following this article. Here are the scripts, that can help you do it a little bit faster: