react-native-timer-picker: I dont see the time values in the dialog

Since I updated in my expo to a newer react version I have issues with the selection of the time. Once I scroll I see numbers but before they are blank.

Bildschirmfoto vom 2024-12-01 15-38-27

<TimerPickerModal
       visible={showPickerExecution}
       setIsVisible={setShowPickerExecution}
       onConfirm={(pickedDuration) => {
         timeAsana.set(getTotalSecondsOfTimeSelection(pickedDuration), 0);
         setShowPickerExecution(false);
         setShowPickerObserving(true);
       }}
       styles={{
         theme: "light",
       }}
       initialValue={{
         hours: executionTime.hours ? parseInt(executionTime.hours) : 0,
         minutes: executionTime.minutes ? parseInt(executionTime.minutes) : 0,
         seconds: executionTime.seconds ? parseInt(executionTime.seconds) : 0,
       }}
       modalTitle="Set Execution Time"
       closeOnOverlayPress
       LinearGradient={LinearGradient}
       modalProps={{
         overlayOpacity: 0.2,
       }}
     />

“react”: “18.3.1”, “react-dom”: “18.3.1”, “react-native”: “0.76.3”,

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 29 (17 by maintainers)

Commits related to this issue

Most upvoted comments

This should now be fixed in the recently-released v2.0.2 🎊

It was another manifestation of the issue I solved for iOS in v2.0.1 where the FlatList in each picker wasn’t always able to calculate its layout (this became a problem in React Native v0.76+).

Please upgrade to v2.0.2 and let me know if you encounter any issues 🙌

@troberts-28 bug is still there for me 😔

I had no time yet to look further into this. However I needed a date input on another view so I used this lib @react-native-community/datetimepicker which basically does the same input behaviour for dates. Works great no vanishing values and feels great but they do not support time input 🙈

It’s a pitty there is no generic working lib for all selectable inputs in this form so they all look the same.

I need to look into this further once I have released a first version of my app but right now I need to focus on other topics.

Thanks, I cannot reproduce the issue anymore with v2.1.0 on the simulator. Not sure if it’s just coincidence.

I can give an update on a real device once I pushed the next release.

Hey @ssachtleben, just a heads up that the ability to use the picker fade-out on a transparent background has been added in the recently-released v2.1.0

I downloaded the Snack , run it locally and also cannot reproduce the issue. I guess it’s either related to the stack or another dependency causing the issue. I will try to do some more tests as well.

@ssachtleben thanks for the investigative work! Will take a look today and see if I can get to the bottom of this. Will keep you updated on my progress.

On your other points:

  1. This is an interesting point! You’re right that it currently relies on the background colour so it isn’t currently possibly to have it fade out with a transparent background. I have just figured out how to make this work using a MaskedView (see below). I don’t want to add it as a dependency for the project, but will make it possible to supply it as a prop (like LinearGradient).
  1. I’ve had this thought too! It does turn it into a different project but it could well be worth doing. I think my plan would be:
  • Create a new library (e.g. react-native-infinite-picker), which only contains a generic version of the core infinite picker component (currently called DurationScroll in this project).
  • That library will fulfill the need for any type of picker (e.g. date and height inputs) as it will be up to the user to supply the list of items for each picker.
  • Adjust this library to use the new generic picker library.

What do you think? Let me know if you’d like to get involved in it.

Hey @ssachtleben, looking into this now. Could you just share the props you’re providing to the TimerPickerModal to help me reproduce it?

@troberts-28 sure here you go:

<TimerPickerModal
    visible={showPicker}
    setIsVisible={setShowPicker}
    onConfirm={async (pickedDuration) => {
        console.log(pickedDuration);
        workoutExerciseSet.time = pickedDuration.hours * 3600 + pickedDuration.minutes * 60 + pickedDuration.seconds;
        await WorkoutExerciseSet.update(workoutExerciseSet);
        setShowPicker(false);

        const newWorkoutExerciseSets = await WorkoutExerciseSet.findByWorkoutId(workout.id);
        setWorkoutExerciseSets(newWorkoutExerciseSets);
    }}
    initialValue={parseTime(workoutExerciseSet.time?.toString())}
    //modalTitle="Set Time"
    onCancel={() => setShowPicker(false)}
    //disableInfiniteScroll
    closeOnOverlayPress
    Audio={Audio}
    LinearGradient={LinearGradient}
    Haptics={Haptics}
    styles={{
        theme: "dark",
        pickerContainer: {
            width: 240, // set this to your desired width
            justifyContent: "center",
            alignItems: "center",
        },
    }}
    modalProps={{
        overlayOpacity: 0.2,
    }}
/>

I updated yesterday as well from expo 51 to 52 and all dependencies reported by the expo doctor. But the problem is still there.

Not sure if this could be the issue but I’m currently using the picker modal within a react-native-draglist draglist.

Later today I want to implement the picker in the user settings as well. It will be way easer setup without a million nested components. I will report if the issue exists there as well.

Yes, I’m using “expo”: “^52.0.11”, and “react-native-timer-picker”: “^2.0.0”, are in my package.json 😃. I run into this issue because I have updated my expo sdk. Thanks for the quick answer