question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hour picker - 01 am, 01 pm ain't rendered properly on android

See original GitHub issue

Describe the bug On android + 12hour mode, when set hour value as 01 am or 01pm, the hour item rendered as 12. s0

When picker view is re-rendered (ex. scroll) , it is updated to proper value. s1

It happens when androidVariant = nativeAndroid.

Expected behavior Hour label text should be 1

To Reproduce

const date = new Date();
date.setHours(13);
// or date.setHours(1);

return (
    <DatePicker
        modal
        date={date}
        open={true}
        mode="time"
        locale="ko"
    />
)

Smartphone (please complete the following information):

  • OS: Android
  • react-native-date-picker version 4.0.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
KyoungHwanLeecommented, Sep 9, 2021

And I found a weird behavior and a dirty solution.

https://github.com/henninghall/react-native-date-picker/blob/79e1e7501e2910300827433eca5cebecb02849e2/android/src/main/java/com/henninghall/date_picker/wheels/Wheel.java#L94-L100

When I modify 97th line to displayValues.add("_" + this.toDisplayValue(value));

pre

Nothing changed. But when use displayValues.add(this.toDisplayValue(value) + "_"); post 1am/pm rendered properly.

So, finally displayValues.add(" " + this.toDisplayValue(value) + " "); both fixed my issue, but definitely not a good solution.

Is there any code like labelText.endsWith(numberValue)?

1reaction
henninghallcommented, Feb 14, 2022

A fix for this is released in v4.1.5

Read more comments on GitHub >

github_iconTop Results From Across the Web

TimePickerDialog and AM or PM - Stack Overflow
TimePickerDialog and AM or PM ... I have a TimePickerDialog with is24Hour set to false since I want to present the end-user with...
Read more >
How to Add TimePicker in Android to Set Time By Hour, Minute
In today's Android app tutorial, we'll see how to add time picker in Android app to allow users pick time by hour, minute,...
Read more >
Untitled
Calories in 1/4 sweet potato, Freelancer discovery 4.87 map, ... Free tips on resume writing, #Micro center friday hours, Eminem mom quotes.
Read more >
onTimeChanged callback is not invoked for AM/PM changes ...
Found a problem where the onTimeChanged callback is not invoked for the time picker widget. This only seems to happen on tablets. Steps...
Read more >
Diff - platform/system/core.git - Google Git
Merge "init: Fix get_hardware_name() to cope with long /proc/cpuinfo output" diff --git a/adb/Android.mk b/adb/Android.mk index bc8315e..a803978 100644 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found