{"id":17351438,"url":"https://github.com/frostney/react-scenedirector","last_synced_at":"2025-04-14T21:21:49.470Z","repository":{"id":57344043,"uuid":"47931603","full_name":"frostney/react-scenedirector","owner":"frostney","description":"Managing scenes in React projects","archived":false,"fork":false,"pushed_at":"2016-09-01T18:54:28.000Z","size":19,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T21:21:26.786Z","etag":null,"topics":["react","scene","scenes"],"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/frostney.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":"2015-12-13T18:43:34.000Z","updated_at":"2022-12-02T20:36:41.000Z","dependencies_parsed_at":"2022-09-12T06:30:33.949Z","dependency_job_id":null,"html_url":"https://github.com/frostney/react-scenedirector","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frostney%2Freact-scenedirector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frostney%2Freact-scenedirector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frostney%2Freact-scenedirector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frostney%2Freact-scenedirector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frostney","download_url":"https://codeload.github.com/frostney/react-scenedirector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248961286,"owners_count":21190001,"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":["react","scene","scenes"],"created_at":"2024-10-15T17:09:56.696Z","updated_at":"2025-04-14T21:21:49.451Z","avatar_url":"https://github.com/frostney.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-scenedirector\nManaging scenes/screens in React projects\n\n[![Build Status](https://travis-ci.org/frostney/react-scenedirector.svg?branch=master)](https://travis-ci.org/frostney/react-scenedirector) [![Dependency Status](https://david-dm.org/frostney/react-scenedirector.svg)](https://david-dm.org/frostney/react-scenedirector) [![devDependency Status](https://david-dm.org/frostney/react-scenedirector/dev-status.svg)](https://david-dm.org/frostney/react-scenedirector#info=devDependencies) [![codecov.io](https://codecov.io/github/frostney/react-scenedirector/coverage.svg?branch=master)](https://codecov.io/github/frostney/react-scenedirector?branch=master)\n\n\nModeled after [https://github.com/freezedev/lyria](freezedev/lyria).\nThe API is in the \"figuring things out\" mode.\n\n## Usage\n```javascript\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport SceneDirector from 'react-scenedirector';\n\nconst Scene1 = ({ switchToScene }) =\u003e {\n  const onClick = () =\u003e switchToScene('Scene2');\n\n  return (\n    \u003cdiv\u003e\n      \u003cbutton onClick={onClick}\u003eSwitch to Scene 2\u003c/button\u003e\n    \u003c/div\u003e\n  );\n};\n\nconst Scene2 = ({ switchToScene }) =\u003e {\n  const onClick = () =\u003e switchToScene('Scene1');\n\n  return (\n    \u003cdiv\u003e\n      \u003cbutton onClick={onClick}\u003eSwitch to Scene 1\u003c/button\u003e\n    \u003c/div\u003e\n  );\n}\n\nconst App = () =\u003e (\n  \u003cSceneDirector\n    scenes={{ Scene1, Scene2 }}\n    initialScene=\"Scene1\" /\u003e\n);\n\nReactDOM.render(App, document.getElementBy('content'));\n```\n\n## Props\n### `scenes`\n#### Type: `Object`\nRequires an object in the from `{ [String]: ReactNode }`.\n\n### `initialScene`\n#### Type: `String`\nThe name of the initial scene that will be shown\n\nSwitch through scenes is possible either with `props.switchToScene` or `this.context.switchToScene`. Switching between scenes using `props` will be deprecated in the future.\n\n### `onSwitchScene`\n#### Type: `Function`\nThis function will be called once we switch to a scene. It will also be called for the initial scene.\n\n#### Will this be available for React Native?\nYes, at some point... maybe. Not right now. But if you a pull request for that, I'd be eternally grateful.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrostney%2Freact-scenedirector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrostney%2Freact-scenedirector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrostney%2Freact-scenedirector/lists"}