0.9.0 • Published 6 months ago

react-native-countup-component v0.9.0

Weekly downloads
5
License
MIT
Repository
github
Last release
6 months ago

react-native-countup

React Native Countup Component

Installation

Install via npm:

npm install react-native-countup-component --save

Or using yarn:

yarn add react-native-countup-component --save
NameDescriptionTypeDefault Value
idCounter id, used to determine reset behaviorstring | undefinedundefined
styleCustom styles for the componentStyleProp{}
digitStyleStyle for the digitsStyleProp{backgroundColor: '#FFFFFF'}
digitTxtStyleStyle for the digit textStyleProp{color: '#000'}
timeLabelStyleStyle for the time labelStyleProp{color: '#000'}
separatorStyleStyle for the separatorStyleProp{color: '#000'}
sizeSize of the countup componentnumber15
currentInitial count in secondsnumber0
maxMaximum count in secondsnumber0
onFinishFunction to call when count reaches max(() => void) | undefinedundefined
onChangeFunction to call when count changes((count: number) => void) | undefinedundefined
onPressFunction to call when component is pressed(() => void) | undefinedundefined
timeToShowArray specifying which digits to displaystring[]'D', 'H', 'M', 'S'
timeLabelsLabels for each time unit{ d?: string, h?: string, m?: string, s?: string }{ d: 'Days', h: 'Hours', m: 'Minutes', s: 'Seconds' }
showSeparatorWhether to display separators between digitsbooleanfalse
runningControls whether the component is runningbooleantrue

Explanation:

  1. TypeScript Types: Props are annotated with TypeScript types (StyleProp<ViewStyle>, StyleProp<TextStyle>, etc.) to indicate the expected structure and types.

  2. Optional Props: Props like id, onFinish, onChange, and onPress are marked as optional (undefined in TypeScript) if not always required.

  3. Default Values: Default values are specified for each prop where applicable, providing clarity on what values are used if not provided.

  4. Enhanced Descriptions: Descriptions are concise yet clear, ensuring developers understand the purpose and usage of each prop.

This TypeScript-enhanced README will help developers integrate and use react-native-countup effectively in their TypeScript projects, ensuring type safety and clarity in prop usage.