Add capability to style the currently selected time unit #71
+32
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces the ability to customize the style of the currently selected item (hour, minute, second, or day) in the
TimerPicker. Previously, all items shared the same styling, making it difficult to visually distinguish the exact selected value beyond its central position.
Key Changes
Styling System: Added a new selectedPickerItem property to
CustomTimerPickerStyles in styles.ts
Logic Flow: Updated TimerPicker.tsx to track and pass the current selected state down to the individual scroll components.
Component Update: Modified DurationScroll.tsx and PickerItem.tsx to receive the selectedValue and apply the selectedPickerItem style conditionally when an item is selected.
How to use
Users can now pass a selectedPickerItem object within the styles prop to highlight the active selection:
Verification
Automated tests: All 275 tests passed successfully (npm test).
Manual verification: Confirmed that the style is correctly applied to the center item and updates during scrolling.
This is my first PR for an open-source project, so thank you for your patience; I’m happy to make any changes or improvements based on your feedback!