fix(CheckBox): reduce needless re-rendering of Icon by fivecar · Pull Request #3773 · react-native-elements/react-native-elements

Motivation

CheckBoxIcon re-renders every time, even if nothing has changed. You can easily see this using a tool like https://github.com/welldone-software/why-did-you-render.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Checked with app

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation using yarn docs-build-api
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Additional context

In looking through this function, it seems that the || 24 might not be necessary because the function already provides a default value of 24 for size. But I left it alone in case it's meant to guard against users providing a zero for size (as opposed to an undefined).