{"id":15395550,"url":"https://github.com/platane/react-propstransition","last_synced_at":"2025-08-03T13:30:49.034Z","repository":{"id":57342866,"uuid":"78004286","full_name":"Platane/react-propsTransition","owner":"Platane","description":"allows component to transition from a state to another","archived":false,"fork":false,"pushed_at":"2017-10-11T09:09:07.000Z","size":80,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-24T16:56:12.328Z","etag":null,"topics":["animation","react","transition"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Platane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-04T10:05:29.000Z","updated_at":"2017-09-22T09:08:17.000Z","dependencies_parsed_at":"2022-09-16T02:50:17.928Z","dependency_job_id":null,"html_url":"https://github.com/Platane/react-propsTransition","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Platane%2Freact-propsTransition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Platane%2Freact-propsTransition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Platane%2Freact-propsTransition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Platane%2Freact-propsTransition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Platane","download_url":"https://codeload.github.com/Platane/react-propsTransition/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228544880,"owners_count":17934654,"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":["animation","react","transition"],"created_at":"2024-10-01T15:28:47.396Z","updated_at":"2024-12-07T01:17:42.877Z","avatar_url":"https://github.com/Platane.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"react-propsTransition\n===\n\n[![wercker status](https://app.wercker.com/status/390b3b425f0799a5084092760048901a/s/master \"wercker status\")](https://app.wercker.com/project/byKey/390b3b425f0799a5084092760048901a)\n[![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n[![npm](https://img.shields.io/npm/v/react-propstransition.svg)](https://www.npmjs.com/package/react-propstransition)\n\nDeclare a property to transition. Whenever this props change, the component render is called with ( previous, next ) so you can hook whatever animation.\n\n```\n  Flow diagram :\n\n    k = 'a'             k change to 'b'\n                             |\n                             |\u003c------------delay----------------\u003e|\n    . . . -------------------|-----------------------------------|----------------------\u003e\n        next     : a         |       next     : b                |   next     : b\n        previous : null              previous : a                    previous : null\n\n        transition : false           transition : true               transition : false\n```\n\n# Usage\n\n```javascript\n\nimport {Transition} from 'react-propsTransition'\n\nconst Component = ({ value }) =\u003e\n  \u003cTransition toTransition={value} delay={300}\u003e\n    {\n      ({ next, previous, transition }) =\u003e\n        \u003cspan\u003e{\n          transition\n            ? `The value was ${previous}, it will be ${next}`\n            : `The value is ${next}`\n        }\u003c/span\u003e\n    }\n  \u003c/Transition\u003e\n\n```\n\n## Options\n\n- _toTransition_    the value to transition, can be a primitive or an object\n- _delay_           delay of the transition, in ms \n- _equal_           check for value change, ( default is == )\n\n## IndirectTransition\n\nThe indirect transition have the same api, but transition only from a value to null and from null to a value.\n\nWhen the direct transition goes A -\u003e B, the indirect goes A -\u003e null -\u003e B ( with A != null and B != null )\n\n```\n  Flow diagram :\n\n  k = 'a'             k change to 'b'\n                               |\n                               |\u003c------------delay----------------\u003e|\u003c------------delay----------------\u003e|\n      . . . -------------------|-----------------------------------|-----------------------------------|--------------------------\u003e\n          next     : a         |       next     : null             |        next     : b               |      next     : b\n          previous : null              previous : a                         previous : null                   previous : null\n  \n         transition : false            transition : true                    transition : true                 transition : false\n  \n                                       indirectNext: b                      indirectNext: null\n                                       transitionIndirect: true             transitionIndirect: false\n```\n\n# Example\n\nAnimate the fadeIn, fadeOff of a drawer\n\n```javascript\n\nconst Drawer = ({ opened }) =\u003e\n  \u003cTransition toTransition={opened} delay={300}\u003e\n    {\n      ({ next, previous, transition }) =\u003e\n        (next || previous) \u0026\u0026\n          \u003cdiv className={'drawer' + (transition ? (next ? 'drawer--fadeIn' : 'drawer--fadeOut') : '')}\u003e\n            \u003cContent /\u003e\n          \u003c/div\u003e\n    }\n  \u003c/Transition\u003e\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplatane%2Freact-propstransition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplatane%2Freact-propstransition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplatane%2Freact-propstransition/lists"}