{"id":21768279,"url":"https://github.com/hoaphantn7604/react-native-element-timer","last_synced_at":"2025-07-17T17:38:48.027Z","repository":{"id":57336733,"uuid":"380087072","full_name":"hoaphantn7604/react-native-element-timer","owner":"hoaphantn7604","description":"A component that displays a timer and countdown for React Native.","archived":false,"fork":false,"pushed_at":"2022-11-21T13:25:36.000Z","size":502,"stargazers_count":31,"open_issues_count":8,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T20:38:07.510Z","etag":null,"topics":["clock","components","countdown","elements","react","react-native","react-native-countdown","react-native-timer","timer"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hoaphantn7604.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-25T00:59:30.000Z","updated_at":"2025-01-13T16:33:43.000Z","dependencies_parsed_at":"2023-01-22T01:53:11.478Z","dependency_job_id":null,"html_url":"https://github.com/hoaphantn7604/react-native-element-timer","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoaphantn7604%2Freact-native-element-timer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoaphantn7604%2Freact-native-element-timer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoaphantn7604%2Freact-native-element-timer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoaphantn7604%2Freact-native-element-timer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoaphantn7604","download_url":"https://codeload.github.com/hoaphantn7604/react-native-element-timer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248739911,"owners_count":21154247,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clock","components","countdown","elements","react","react-native","react-native-countdown","react-native-timer","timer"],"created_at":"2024-11-26T13:35:12.488Z","updated_at":"2025-04-13T15:41:28.620Z","avatar_url":"https://github.com/hoaphantn7604.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/hoaphantn"],"categories":[],"sub_categories":[],"readme":"# react-native-element-timer\nA component that displays a timer and countdown for React Native.\nImplemented using [react-native-background-timer](https://github.com/ocetnik/react-native-background-timer)\n## Getting started\n```js\n    npm install react-native-element-timer --save\n```\nor\n```js\n    yarn add react-native-element-timer\n```\n\n#### Demo\n![](https://github.com/hoaphantn7604/file-upload/blob/master/document/timer/timer.gif)\n![](https://github.com/hoaphantn7604/file-upload/blob/master/document/timer/countdown.gif)\n\n#### Timer Props\n| Props              | Type                 | isRequire | Description                             |\n| ------------------ | -------------------- | --------- | --------------------------------------- |\n| initialSeconds     | Number               | No        | Initial seconds, defalut is 0           |\n| autoStart          | Boolean              | No        | Auto start timer                        |\n| start              | ref.start()          | Yes       | Start timer                             |\n| pause              | ref.pause()          | Yes       | Pause timer                             |\n| resume             | ref.resume()         | Yes       | Resume timer                            |\n| stop               | ref.stop()           | Yes       | Stop timer                              |\n| style              | ViewStyle            | No        | Styling container view                  |\n| fontFamily         | String               | No        | Customize font style                    |\n| textStyle          | TextStyle            | No        | Styling text                            |\n| formatTime         | hh:mm:ss or ss       | No        | Format time                             |\n| onTimes            | (seconds) =\u003e void    | No        | callback when running time              |\n| onPause            | (seconds) =\u003e void    | No        | Callback when the pause event is called |\n| onEnd              | (seconds) =\u003e void    | No        | Callback when the stop event is called  |\n\n\n#### Countdown Props\n| Props              | Type                 | isRequire | default                                 |\n| ------------------ | -------------------- | --------- | --------------------------------------- |\n| initialSeconds     | Number               | Yes       | Initial seconds                         |\n| autoStart          | Boolean              | No        | Auto start timer                        |\n| start              | ref.start()          | Yes       | Start timer                             |\n| pause              | ref.pause()          | Yes       | Pause timer                             |\n| resume             | ref.resume()         | Yes       | Resume timer                            |\n| stop               | ref.stop()           | Yes       | Stop timer                              |\n| style              | ViewStyle            | No        | Styling container view                  |\n| fontFamily         | String               | No        | Customize font style                    |\n| textStyle          | TextStyle            | No        | Styling text                            |\n| formatTime         | hh:mm:ss or ss       | No        | Format time                             |\n| onTimes            | (seconds) =\u003e void    | No        | callback when running time              |\n| onPause            | (seconds) =\u003e void    | No        | Callback when the pause event is called |\n| onEnd              | (seconds) =\u003e void    | No        | Callback when the stop event is called  |\n\n## Usage\n```javascript\n    import React, {useRef} from 'react';\n    import {StyleSheet, Button, Text, SafeAreaView} from 'react-native';\n    import {Timer, Countdown} from 'react-native-element-timer';\n\n    const TimerScreen = _props =\u003e {\n        const timerRef = useRef(null);\n        const countdownRef = useRef(null);\n\n        return (\n            \u003cSafeAreaView style={styles.container}\u003e\n                \u003cText style={styles.text}\u003eTimer:\u003c/Text\u003e\n                \u003cTimer\n                    ref={timerRef}\n                    style={styles.timer}\n                    textStyle={styles.timerText}\n                    onTimes={e =\u003e {}}\n                    onPause={e =\u003e {}}\n                    onEnd={e =\u003e {}}\n                /\u003e\n                \u003cButton\n                    style={styles.button}\n                    title={'Start'}\n                    onPress={() =\u003e {\n                        timerRef.current.start();\n                    }}\n                /\u003e\n                \u003cButton\n                    style={styles.button}\n                    title={'Pause'}\n                    onPress={() =\u003e {\n                        timerRef.current.pause();\n                    }}\n                /\u003e\n                \u003cButton\n                    style={styles.button}\n                    title={'Resume'}\n                    onPress={() =\u003e {\n                        timerRef.current.resume();\n                    }}\n                /\u003e\n                \u003cButton\n                    style={styles.button}\n                    title={'Stop'}\n                    onPress={() =\u003e {\n                        timerRef.current.stop();\n                    }}\n                /\u003e\n\n                \u003cText style={styles.text}\u003eCountdown:\u003c/Text\u003e\n                \u003cCountdown\n                    ref={countdownRef}\n                    style={styles.timer}\n                    textStyle={styles.timerText}\n                    initialSeconds={5}\n                    onTimes={e =\u003e {}}\n                    onPause={e =\u003e {}}\n                    onEnd={(e) =\u003e {}}\n                /\u003e\n                \u003cButton\n                    style={styles.button}\n                    title={'Start'}\n                    onPress={() =\u003e {\n                        countdownRef.current.start();\n                    }}\n                /\u003e\n                \u003cButton\n                    style={styles.button}\n                    title={'Pause'}\n                    onPress={() =\u003e {\n                        countdownRef.current.pause();\n                    }}\n                /\u003e\n                \u003cButton\n                    style={styles.button}\n                    title={'Resume'}\n                    onPress={() =\u003e {\n                        countdownRef.current.resume();\n                    }}\n                /\u003e\n                \u003cButton\n                    style={styles.button}\n                    title={'Stop'}\n                    onPress={() =\u003e {\n                        countdownRef.current.stop();\n                    }}\n                /\u003e\n            \u003c/SafeAreaView\u003e\n        );\n    };\n\n    export default TimerScreen;\n\n    const styles = StyleSheet.create({\n        container: {\n            flex: 1,\n            alignItems: 'center',\n            padding: 20,\n        },\n        text: {\n            fontWeight: 'bold',\n            fontSize: 16,\n            marginTop: 40,\n        },\n        timer: {\n            marginVertical: 10,\n        },\n        timerText: {\n            fontSize: 20,\n        },\n        button: {\n            marginVertical: 5,\n            backgroundColor: 'white',\n            borderRadius: 24,\n            width: 100,\n        },\n    });\n```\n\n## Donate\n\nSupport maintainers with a donation and help them continue with activities.\n\n\u003cbr\u003e\u003cp\u003e\u003ca href=\"https://www.buymeacoffee.com/hoaphantn\"\u003e \u003cimg align=\"left\" src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" height=\"50\" width=\"210\" alt=\"fateh999\" /\u003e\u003c/a\u003e\u003c/p\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoaphantn7604%2Freact-native-element-timer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoaphantn7604%2Freact-native-element-timer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoaphantn7604%2Freact-native-element-timer/lists"}