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

fix: classCastException on Huawei devices with android 7.0 (#329) #434

Merged
merged 2 commits into from
Apr 15, 2021

Conversation

VNDRN
Copy link
Contributor

@VNDRN VNDRN commented Apr 13, 2021

Summary

This fixes #329.

All changes were made in the file MinuteIntervalSnappableTimePickerDialog.java.

When minuteInterval was set on Huawei devices running android 7.0, a ClassCasteException was thrown, causing the app to crash.

I surrounded the crashing code in try...catch and added logging for this specific error.

Devices running android M and above now no longer use the deprecated functions setCurrentHour(); and setCurrentMinute();.

Test Plan

tested this on

  • Samsung Galaxy S10
  • android 7.0 emulator
  • android 11.0 emulator

What's required for testing (prerequisites)?

To test/find the bug, a Huawei device running android 7.0 is needed.
To test the new implementation, any android will do.

What are the steps to reproduce (after prerequisites)?

use the datetimepicker with a minuteInterval set.

Compatibility

OS Implemented
iOS
Android

Checklist

  • I have tested this on a device and a simulator
  • I added the documentation in README.md
  • I updated the typed files (TS and Flow)
  • I added a sample use of the API in the example project (example/App.js)
  • I have added automated tests, either in JS or e2e tests, as applicable

Copy link
Member

@vonovak vonovak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot for the PR! 🙂

@vonovak vonovak enabled auto-merge (squash) April 15, 2021 19:51
@vonovak vonovak merged commit 671435e into react-native-datetimepicker:master Apr 15, 2021
vonovak pushed a commit that referenced this pull request Apr 15, 2021
## [3.4.4](v3.4.3...v3.4.4) (2021-04-15)

### Bug Fixes

* classCastException on Huawei devices with android 7.0 ([#329](#329)) ([#434](#434)) ([671435e](671435e))
@vonovak
Copy link
Member

vonovak commented Apr 15, 2021

🎉 This PR is included in version 3.4.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when using minuteInterval in time picker on Huawei-devices with Android 7.0
2 participants