web-ridge / react-native-paper-dates

Smooth and fast cross platform Material Design date and time picker for React Native Paper
https://www.reactnativepaperdates.com
MIT License
637 stars 161 forks source link

Fix v2 dark theme #377

Closed jamiees2 closed 2 months ago

jamiees2 commented 3 months ago

https://github.com/web-ridge/react-native-paper-dates/commit/e9d69556b50cdf5df70c6df440818d6b3454e387 introduced a bug where if the app is using a Material V2 dark theme, the time picker will access a color property which isn't defined, resulting in a hard crash with a "Cannot read property 'level3' of undefined".

This is due to the previous logic gating on theme.isV3 before accessing the property, while the current logic does not gate on this.

This PR changes the logic to be similar to the change to Day.tsx, which does check if the theme is V3 before accessing potentially undefined properties.

We have deployed this change to our app, and it has fixed the crashes our users were seeing.

iM-GeeKy commented 3 months ago

@jamiees2 This looks okay once the linting error is resolved. I'll let @RichardLindhout be responsible for merging it after he takes a look.

iM-GeeKy commented 2 months ago

@jamiees2 Can you resolve the merge conflict? Then I'll go ahead and merge it.

jamiees2 commented 2 months ago

Done :)