{"id":17134524,"url":"https://github.com/tiagocavalcante/r3f-native-orbitcontrols","last_synced_at":"2025-04-09T13:08:16.425Z","repository":{"id":44349666,"uuid":"482641802","full_name":"TiagoCavalcante/r3f-native-orbitcontrols","owner":"TiagoCavalcante","description":"OrbitControls for React Three Fiber in React Native","archived":false,"fork":false,"pushed_at":"2024-08-16T10:40:23.000Z","size":91,"stargazers_count":77,"open_issues_count":9,"forks_count":10,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-02T10:13:33.137Z","etag":null,"topics":["orbitcontrols","r3f","react-native"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/TiagoCavalcante.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["TiagoCavalcante"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2022-04-17T21:55:05.000Z","updated_at":"2025-02-22T03:54:09.000Z","dependencies_parsed_at":"2024-04-03T21:43:19.860Z","dependency_job_id":"5041c297-1a4e-498c-bc0b-1f8d793d0a31","html_url":"https://github.com/TiagoCavalcante/r3f-native-orbitcontrols","commit_stats":{"total_commits":40,"total_committers":2,"mean_commits":20.0,"dds":"0.025000000000000022","last_synced_commit":"9f9b73e6612359c16082ccdee3281d11257b70d8"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":"TiagoCavalcante/react-library-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TiagoCavalcante%2Fr3f-native-orbitcontrols","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TiagoCavalcante%2Fr3f-native-orbitcontrols/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TiagoCavalcante%2Fr3f-native-orbitcontrols/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TiagoCavalcante%2Fr3f-native-orbitcontrols/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TiagoCavalcante","download_url":"https://codeload.github.com/TiagoCavalcante/r3f-native-orbitcontrols/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045233,"owners_count":21038553,"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":["orbitcontrols","r3f","react-native"],"created_at":"2024-10-14T19:45:01.242Z","updated_at":"2025-04-09T13:08:16.404Z","avatar_url":"https://github.com/TiagoCavalcante.png","language":"JavaScript","funding_links":["https://github.com/sponsors/TiagoCavalcante"],"categories":[],"sub_categories":[],"readme":"# r3f-native-orbitcontrols\n\n\u003ca href=\"https://github.com/TiagoCavalcante/r3f-native-orbitcontrols/releases\"\u003e\u003cimg alt=\"Version\" src=\"https://img.shields.io/npm/v/r3f-native-orbitcontrols\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://npmjs.com/package/r3f-native-orbitcontrols\"\u003e\u003cimg alt=\"Downloads\" src=\"https://img.shields.io/npm/dt/r3f-native-orbitcontrols.svg\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/TiagoCavalcante/r3f-native-orbitcontrols/blob/main/LICENSE\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/npm/l/r3f-native-orbitcontrols.svg\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://bundlephobia.com/package/r3f-native-orbitcontrols\"\u003e\u003cimg alt=\"Ziped size\" src=\"https://img.shields.io/bundlephobia/minzip/r3f-native-orbitcontrols\" /\u003e\u003c/a\u003e\n\nOrbitControls for [React Three Fiber](https://github.com/pmndrs/react-three-fiber) in React Native\n\n## Install\n\nr3f-native-orbitcontrols is distributed as a [npm package](https://www.npmjs.com/package/r3f-native-orbitcontrols) and can be installed as follows:\n\n```\n// with npm\nnpm install r3f-native-orbitcontrols\n// with yarn\nyarn add r3f-native-orbitcontrols\n```\n\n## Example\n\n```jsx\nimport useControls from \"r3f-native-orbitcontrols\"\n\nimport { Canvas } from \"@react-three/fiber/native\"\nimport { View } from \"react-native\"\n// The import below is used only in Canvases:\nimport { PerspectiveCamera } from \"three\"\n\nfunction SingleCanvas() {\n  const [OrbitControls, events] = useControls()\n\n  return (\n    // If this isn't working check if you have set the size of the View.\n    // The easiest way to do it is to use the full size, e.g.:\n    //   \u003cView style={{ flex: 1 }} /\u003e\n    \u003cView {...events}\u003e\n      \u003cCanvas\u003e\n        \u003cOrbitControls /\u003e\n\n        {/* Place the scene elements here as usual */}\n      \u003c/Canvas\u003e\n    \u003c/View\u003e\n  )\n}\n\nfunction Canvases() {\n  // You also can use the same OrbitControls for multiple canvases\n  // creating an effect like the game\n  // The Medium (https://store.steampowered.com/app/1293160)\n  const [OrbitControls, events] = useControls()\n\n  // In this case the same camera must be used in all the canvases\n  const camera = new PerspectiveCamera()\n  // You need to configure the camera too. Follow three.js' documentation.\n  // Default configuration:\n  //   camera.position.set(10, 10, 10)\n  //   camera.lookAt(0, 0, 0)\n\n  return (\n    \u003cView {...events}\u003e\n      \u003cCanvas camera={camera}\u003e\n        \u003cOrbitControls /\u003e\n      \u003c/Canvas\u003e\n      \u003cCanvas camera={camera}\u003e\n        \u003cOrbitControls /\u003e\n      \u003c/Canvas\u003e\n    \u003c/View\u003e\n  )\n}\n```\n\nYou can find an example app [here](https://github.com/TiagoCavalcante/r3f-orbitcontrols-example).\n\n## Options\n\nThe `\u003cOrbitControls /\u003e` element _may_ receive the following properties:\n\n| Property         |      Type       |                                     Description |\n| :--------------- | :-------------: | ----------------------------------------------: |\n| camera           |     Camera      |                read-only, available to onChange |\n| enabled          |     boolean     |                                                 |\n| target           |     Vector3     |                                                 |\n| minPolarAngle    |     number      |              how close you can orbit vertically |\n| maxPolarAngle    |     number      |                how far you can orbit vertically |\n| minAzimuthAngle  |     number      |            how close you can orbit horizontally |\n| maxAzimuthAngle  |     number      |              how far you can orbit horizontally |\n| dampingFactor    |     number      |                                  inertia factor |\n| enableZoom       |     boolean     |                                                 |\n| zoomSpeed        |     number      |                                                 |\n| minZoom          |     number      |                                                 |\n| maxZoom          |     number      |                                                 |\n| enableRotate     |     boolean     |                                                 |\n| rotateSpeed      |     number      |                                                 |\n| enablePan        |     boolean     |                                                 |\n| panSpeed         |     number      |                                                 |\n| ignoreQuickPress |     boolean     |                   may cause bugs when enabled\\* |\n| onChange         | (event) =\u003e void | receives an event with all the properties above |\n\nYou can find the defaults for each option [here](https://github.com/TiagoCavalcante/r3f-native-orbitcontrols/blob/7468e516a17c279f65b2f6a681d1aa6e655b6746/src/OrbitControls.tsx#L21-L55).\n\n\\*: This option is **not** recommended in modern devices. It's only useful in older devices, which don't propagate touch events to prevent \"bubbling\". You can find more information about this [here](https://github.com/TiagoCavalcante/r3f-native-orbitcontrols/blob/7468e516a17c279f65b2f6a681d1aa6e655b6746/src/OrbitControls.tsx#L87-L120).\n\n## Why not use [drei](https://github.com/pmndrs/drei)'s OrbitControls?\n\nThe answer is very simple: they don't work on native, only on the web and (much) older versions of [React Three Fiber](https://github.com/pmndrs/react-three-fiber).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiagocavalcante%2Fr3f-native-orbitcontrols","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiagocavalcante%2Fr3f-native-orbitcontrols","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiagocavalcante%2Fr3f-native-orbitcontrols/lists"}