Skip to content
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

Crashfix for CalendarDay having an undefined props.height #324

Merged
merged 1 commit into from
Sep 13, 2021

Conversation

wbercx
Copy link
Contributor

@wbercx wbercx commented Sep 13, 2021

CalendarDay's calcSizes calculates a responsive containerHeight by doing Math.round(props.height). Ditto for the width.

During development, props.height would sometimes be undefined, causing it to do Math.random(undefined) which yielded NaN. This occurred even when an explicit dayComponentHeight was being passed in. That in turn led to the following error, causing an app crash on Android:

Invariant Violation: [847,"RCTView",81,{"justifyContent":"center","alignItems":"center","alignSelf":"center","width":0,"height":"<<NaN>>","borderRadius":0,"backgroundColor":0}] is not usable as a native method argument
  • That's when using JSC and RN 0.64.2. Hermes crashes without a useful error.
  • The issue was particularly prevalent when using Fast Refresh. Once it happened I always had to reinstall the app onto the device to get it to work again.
  • I noticed containerWidth was always 0 in my logs, so I defaulted it to that and chose to do the same with the height. Have not seen any issues so far.

@peacechen
Copy link
Collaborator

Thanks @wbercx

@peacechen peacechen merged commit c440c92 into BugiDev:master Sep 13, 2021
@peacechen
Copy link
Collaborator

Published in 2.2.5

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.

2 participants