react-native-ruler-picker
react-native-ruler-picker copied to clipboard
feat: add showValueText prop to control value text display
Feature: Add showValueText Prop
This PR adds a new showValueText prop to the RulerPicker component that allows developers to control whether the value text display (number + unit) is shown above the ruler indicator.
What's New:
- New prop: showValueText?: boolean (default: rue)
- Backward compatible: Existing code continues to work unchanged
- Conditional rendering: Value text is only rendered when showValueText is rue
- Optimized performance: Text input updates are skipped when value text is hidden
Changes Made:
- Core Component: Added showValueText prop to RulerPickerProps interface
- Conditional Rendering: Value text display is now conditionally rendered
- Performance Optimization: Value callback only updates text input when needed
- Example App: Updated to demonstrate both with and without value text
- Documentation: Updated README with new prop documentation and usage examples
Usage Examples:
\\jsx // Default behavior (shows value text) <RulerPicker min={0} max={100} showValueText={true} />
// Hide value text <RulerPicker min={0} max={100} showValueText={false} /> \\
Testing:
- Backward compatibility maintained
- TypeScript types updated
- Example app demonstrates both modes
- Documentation updated
This enhancement provides more flexibility for developers who want to use the ruler picker without the built-in value display, allowing them to implement their own custom value display logic.