-
-
Notifications
You must be signed in to change notification settings - Fork 413
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
TimePicker display="spinner" no longer working in RN 64 (Android) #411
Comments
yeah this is happening in react native 64 only on Android |
If I change:
to
It works. |
My recommendation is to do:
I'll set up a PR |
🎉 This issue has been resolved in version 3.4.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@klandell please let us know if the issue is resolved in latest release and please test it on different android versions (not just the appearance but the actual function), thank you! |
@vonovak @billnbell Thank you both for looking into this. I updated to the latest package in the rn-64 branch of the demo repo above to 3.4.1. Unfortunately, the app is now crashing with the following exception:
|
Hmm, sorry about that. If you or someone else could look into this, that would be great, my time is limited now. In the mean time, im going to revert the fix because it was probably better before. Thanks. |
Thanks. I'll try to take a look at this next week as my time is limited right now as well. Unless someone else gets to it first! |
I was able to do a little bit of digging into this. From what I can tell so far the issue seems to be stemming from this code activityContext.getResources().getIdentifier(
resourceName,
"style",
activityContext.getPackageName()
), in the This value is passed as the public RNDismissableTimePickerDialog(
Context context,
int theme,
@Nullable TimePickerDialog.OnTimeSetListener callback,
int hourOfDay,
int minute,
int minuteInterval,
boolean is24HourView,
RNTimePickerDisplay display
) {
super(context, theme, callback, hourOfDay, minute, minuteInterval, is24HourView, display);
fixSpinner(context, hourOfDay, minute, is24HourView, display);
} In React native 63, I'm not sure of the reason yet. |
I just inspected the In <style name="SpinnerTimePickerDialog" parent="Theme.AppCompat.Light.Dialog" ns1:targetApi="lollipop">
<item name="android:timePickerStyle">@style/SpinnerTimePickerStyle</item>
</style>
<style name="SpinnerTimePickerStyle" parent="android:Widget.Material.Light.TimePicker" ns1:targetApi="lollipop">
<item name="android:timePickerMode">spinner</item>
</style> These values do not exist in This is the commit that removed the styles this library relied on: |
Simply adding <style name="SpinnerTimePickerDialog" parent="Theme.AppCompat.Light.Dialog">
<item name="android:timePickerStyle">@style/SpinnerTimePickerStyle</item>
</style>
<style name="SpinnerTimePickerStyle" parent="android:Widget.Material.Light.TimePicker">
<item name="android:timePickerMode">spinner</item>
</style> to my Is there a recommended way of integrating this change into the this library? I removed If someone with more familiarity with Android could weigh in it would be hugely helpful. |
ah, so it's this: #258 becoming a real issue 6 months later 😆 Nice, thanks a lot for the investigation!
I'm assuming we should keep it. There probably is a commit in RN's history that explains what those things do and why they are there. So if you add those things to the Thanks again! 👍 |
🎉 This issue has been resolved in version 3.4.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Bug report
Hello!
Summary
Setting display to spinner on the time picker in Android renders a clock in React Native 64. It works as expected in React Native 63. I have only tested on Android.
Reproducible sample code
See this repo for a sample. Branch
main
uses RN 63 and works as expected. Branchrn-64
is exactly the same code, simply upgraded by runningnpx react-native upgrade
https://github.com/klandell/time-spinner-bug
Steps to reproduce
Open the app on an Android device. Click show time spinner. On react native 63, it shows as a spinner. On react native 64 it shows as a clock.
Environment info
Vanilla react native app, not Expo.
datetimepicker version: 3.2
iOS / Android version: Samsung Galaxy S20e, Android 10.
The text was updated successfully, but these errors were encountered: