{"_id":"5a06037134873d0010b3922b","category":{"_id":"5a06037134873d0010b39204","version":"5a06037134873d0010b391fe","project":"578c4badbd223d2000cc1441","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-08-01T23:04:12.838Z","from_sync":false,"order":5,"slug":"api-reference","title":"API Reference"},"parentDoc":null,"project":"578c4badbd223d2000cc1441","user":"57bb7defafc18c0e00529cf1","version":{"_id":"5a06037134873d0010b391fe","project":"578c4badbd223d2000cc1441","__v":1,"createdAt":"2017-11-10T19:52:17.163Z","releaseDate":"2017-11-10T19:52:17.163Z","categories":["5a06037134873d0010b391ff","5a06037134873d0010b39200","5a06037134873d0010b39201","5a06037134873d0010b39202","5a06037134873d0010b39203","5a06037134873d0010b39204"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.1.0","version":"2.1.0"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-10-18T01:19:51.345Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":26,"body":"A ViroScene is the top most component for each scene in a Viro application. Please see our [Scene Guide](doc:scenes#scene-graph) for more information.\n\n######Example use:\n```\n<ViroScene onClick={this._onClick}>\n  <ViroSphere position={[0, 0 , -1]} />\n<ViroScene/>\n```\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Props\"\n}\n[/block]\n##Optional Props \n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"**dragType**\",\n    \"8-0\": \"**onPlatformUpdate**\",\n    \"15-0\": \"**rotation**\",\n    \"16-0\": \"**style**\",\n    \"17-0\": \"**text**\",\n    \"18-0\": \"**transformBehaviors**\",\n    \"20-0\": \"**visible**\",\n    \"19-0\": \"**width**\",\n    \"h-0\": \"PropKey\",\n    \"h-1\": \"PropType\",\n    \"0-1\": \"**PropTypes.oneOf([\\\"FixedDistance\\\", \\\"FixedToWorld\\\"])**\\n\\nDetermines the behavior of drag if **onDrag** is specified.\\n\\n|Value|Description|\\n|:------|:----------:|\\n|FixedDistance| Dragging is limited to a fixed radius around the user|\\n|FixedToWorld| Dragging is based on intersection with real world objects. **Available only in AR** |\\n\\nThe default value is \\\"FixedDistance\\\".\",\n    \"8-1\": \"**React.PropTypes.func**\\n\\nCallback method set to be notified of platform specific information like headset type or controller type.\\n\\nExample Code:\\n```  \\n_onPlatformUpdate(platformInfo){\\n\\tvar platform = platformInfo.vrPlatform;\\n\\tvar headset = platformInfo.headset;\\n\\tvar controller = platformInfo.controller;\\n}\\n```\\n\\nList of supported platforms:\\n\\n| |Cardboard iOS|Cardboard Android|Daydream|GearVR\\n|:-------------------|:---------------|:---------------|:---------------|:---------------|\\n|Platform|gvr|gvr|gvr|ovr-mobile|\\n|Headset|cardboard|cardboard|daydream|gearvr|\\n|Controller|cardboard|cardboard|daydream|gearvr|\",\n    \"15-1\": \"PropTypes.arrayOf(PropTypes.number)\\n\\nPut the PropType Description here.\",\n    \"16-1\": \"stylePropType\",\n    \"17-1\": \"PropTypes.string\\n\\nPut the PropType Description here.\",\n    \"18-1\": \"PropTypes.arrayOf(PropTypes.string)\\n\\nPut the PropType Description here.\",\n    \"19-1\": \"PropTypes.number\\n\\nPut the PropType Description here.\",\n    \"20-1\": \"PropTypes.bool\\n\\nPut the PropType Description here.\",\n    \"6-0\": \"**onHover**\",\n    \"6-1\": \"**React.PropTypes.func**\\n\\nFunction to be invoked when the user hovers on on the scene. If this is defined, it is invoked **ONLY** if no other object captures the onHover event.\\n\\nFor example:\\n```  \\n_onHover(isHovering)  {\\n    if(isHovering) {\\n        // user is hovering on the scene.\\n    } else {\\n        // user is hovering on another object in the scene.\\n    }\\n}\\n```\",\n    \"3-0\": \"**onClickState**\",\n    \"3-1\": \"**React.PropTypes.func**\\n\\nCalled for each click state an object goes through as it is clicked. Supported click states and their values are the following:\\n\\n|State Value|Description|\\n|:------|:----------:|\\n|1| Click Down: Triggered when the user has performed a click down action while hovering on this control.|\\n|2| Click Up: Triggered when the user has performed a click up action while hovering on this control.|\\n|3| Clicked: Triggered when the user has performed both a click down and click up action on this control sequentially, thereby having \\\"Clicked\\\" the object.|\\n\\nExample code:\\n```  \\n_onClickState(stateValue, source)  {\\n    if(stateValue == 1) {\\n        // Click Down\\n    } else if(stateValue == 2) {\\n        // Click Up\\n    } else if(stateValue == 3) { \\n        // Clicked\\n    }\\n}\\n```\\nFor the mapping of sources to controller inputs, see the [Events](doc:events) section.\\n\\nThis is **ONLY** invoked if a click is not captured on another object within a scene.\",\n    \"10-1\": \"**React.PropTypes.func**\\n\\nNEED TO UPDATE DESCRIPTION\",\n    \"11-1\": \"**React.PropTypes.func**\\n\\nNEED TO UPDATE DESCRIPTION\",\n    \"12-1\": \"**React.PropTypes.func**\\n\\nCalled when the user performs a touch action, while hovering on the control. Provides the touch state type, and the x/y coordinate at which this touch event has occurred.\\n\\n|State Value|Description|\\n|:------|:----------:|\\n|1| Touch Down: Triggered when the user  makes physical contact with the touch pad on the controller. |\\n|2| Touch Down Move: Called when the user moves around the touch pad immediately after having performed a Touch Down action. |\\n|3| Touch Up: Triggered after the user is no longer in physical contact with the touch pad after a Touch Down action. |\\n\\nFor example:\\n```  \\n_onTouch(state, touchPos, source)  {\\n   var touchX = touchPos[0];\\n   var touchY = touchPos[1];\\n    if(state == 1) {\\n        // Touch Down\\n    } else if(state == 2) {\\n        // Touch Down Move\\n    } else if(state == 3) { \\n        // Touch Up\\n    }\\n}\\n```\\nFor the mapping of sources to controller inputs, see the [Events](doc:events) section.\\n\\nUnsupported VR Platforms: Cardboard(Android and iOS).\",\n    \"10-0\": \"**onScroll**\",\n    \"11-0\": \"**onSwipe**\",\n    \"12-0\": \"**onTouch**\",\n    \"14-0\": \"**soundRoom**\",\n    \"14-1\": \"**PropTypes.shape**\\n\\nDescribes the acoustic properties of the room around the user by allowing the developer to describe the room based on its dimensions and its surface properties.  Note: This is not supported in Cardboard iOS.\\n\\nCode Example:\\n```  \\n    soundRoom={{\\n      size: {[2,2,2]},\\n      wallMaterial: \\\"acoustic_ceiling_tiles\\\",\\n      ceilingMaterial:\\\"glass_thin\\\",\\n      floorMaterial:\\\"concrete_block_coarse\\\"\\n    }}\\n```\\nList of soundRoom properties:\\n\\n|Name|Description|\\n|:-------------------|:---------------|\\n|size|The 3D dimensions of the room.|\\n|wallMaterial|Sound Material for the four walls.|\\n|ceilingMaterial|Sound Material for the ceiling|\\n|floorMaterial|Sound Material for the floor|\\n\\nList of Supported Sound Materials:\\n\\n|Name|Description|\\n|:-------------------|:---------------|\\n|acoustic_ceiling_tiles|Acoustic ceiling tiles, absorbs most frequencies.|\\n|brick_bare|Bare brick, relatively reflective.|\\n|brick_painted|Painted brick|\\n|concrete_block_coarse|Coarse surface concrete block.|\\n|concrete_block_painted|Painted concrete block.|\\n|curtain_heavy|Heavy curtains.|\\n|fiber_glass_insulation|Fiber glass insulation.|\\n|glass_thin|Thin glass.|\\n|glass_thick|Thick glass.|\\n|grass|Grass.|\\n|linoleum_on_concrete|Linoleum on concrete.|\\n|marble|Marble.|\\n|metal|Galvanized sheet metal.|\\n|parquet_on_concrete|Wooden parquet on concrete.|\\n|plaster_rough|Rough plaster surface.|\\n|plaster_smooth|Smooth plaster surface.|\\n|plywood_panel|Plywood panel|\\n|polished_concrete_or_tile|Polished concrete or tile surface.|\\n|sheet_rock|Sheet rock|\\n|transparent|Acoustically transparent material, reflects no sound.|\\n|water_or_ice_surface|Surface of water or ice.|\\n|wood_ceiling|Wooden ceiling.|\\n|wood_panel|Wood paneling.|\",\n    \"5-0\": \"**onFuse**\",\n    \"5-1\": \"**PropTypes.oneOfType**\\n```  \\nPropTypes.oneOfType([\\n      React.PropTypes.shape({\\n        callback: React.PropTypes.func.isRequired,\\n        timeToFuse: PropTypes.number\\n      }),\\n      React.PropTypes.func,\\n])\\n```  \\nAs shown above, onFuse takes one of the types - either a callback, or a dictionary with a callback and duration. \\n\\nIt is called after the user hovers onto and remains hovered on the control for a certain duration of time, as indicated in timeToFuse that represents the duration of time in milliseconds. \\n\\nWhile hovering, the reticle will display a count down animation while fusing towards timeToFuse.\\n\\nNote that timeToFuse defaults to 2000ms.\\n\\nFor example:\\n```  \\n_onFuse(source){\\n   // User has hovered over object for timeToFuse milliseconds\\n}\\n```\\nFor the mapping of sources to controller inputs, see the [Events](doc:events) section.\",\n    \"4-0\": \"**onDrag**\",\n    \"7-0\": \"**onPinch**\",\n    \"9-0\": \"**onRotate**\",\n    \"2-0\": \"**onClick**\",\n    \"2-1\": \"**React.PropTypes.func**\\n\\nFunction to be invoked when a user clicks on a scene. This is **ONLY** invoked if a click is not captured on another object within a scene.\\n\\nDefining this can be used to register clicks for 360 Photos and videos.\",\n    \"1-0\": \"**ignoreEventHandling**\",\n    \"13-0\": \"**physicsWorld**\",\n    \"4-1\": \"**React.PropTypes.func**\\n\\nCalled when the view is currently being dragged. The dragToPos parameter provides the current 3D location of the dragged object. \\n\\nExample code:\\n```  \\n_onDrag(dragToPos, source)  {\\n    // dragtoPos[0]: x position\\n    // dragtoPos[1]: y position\\n    // dragtoPos[2]: z position\\n}\\n``` \\nFor the mapping of sources to controller inputs, see the [Events](doc:events) section. \\n\\nUnsupported VR Platforms: Cardboard iOS\",\n    \"1-1\": \"**PropTypes.bool**\\n\\nWhen set to true, this control will ignore events and not prevent controls behind it from receiving event callbacks.\\n\\nThe default value is false.\",\n    \"7-1\": \"**React.PropTypes.func**\\n\\nCalled when the user performs a pinch gesture on the control. When the pinch starts, the scale factor is set to 1 is relative to the points of the two touch points.  \\n\\nFor example:\\n```\\n  _onPinch(pinchState, scaleFactor, source) {\\n       if(pinchState == 3) {\\n      // update scale of obj by multiplying by scaleFactor  when pinch ends.\\n        return;\\n       }\\n     //set scale using native props to reflect pinch.\\n  }\\n```\\npinchState can be the following values:\\n\\n|State Value|Description|\\n|:------|:----------:|\\n|1| Pinch Start: Triggered when the user has started a pinch gesture.|\\n|2| Pinch Move: Triggered when the user has adjusted the pinch, moving both fingers. |\\n|3| Pinch End: When the user has finishes the pinch gesture and released both touch points. |\\n\\n**This event is only available in AR iOS**.\",\n    \"9-1\": \"**React.PropTypes.func**\\n\\nCalled when the user performs a rotation touch gesture on the control. Rotation factor is returned in degrees.\\n\\nWhen setting rotation, the rotation should be relative to it's current rotation, *not* set to the absolute value of the given rotationFactor.\\n\\nFor example:\\n\\n```\\n    _onRotate(rotateState, rotationFactor, source) {\\n\\n      if (rotateState == 3) {\\n        //set to current rotation - rotationFactor.\\n        return;\\n      }\\n     //update rotation using setNativeProps\\n    },\\n\\n```\\nrotationFactor can be the following values:\\n\\n|State Value|Description|\\n|:------|:----------:|\\n|1| Rotation Start: Triggered when the user has started a rotation gesture.|\\n|2| Rotation Move: Triggered when the user has adjusted the rotation, moving both fingers. |\\n|3| Rotation End: When the user has finishes the rotation gesture and released both touch points. |\\n\\n**This event is only available in AR iOS**.\",\n    \"13-1\": \"**PropTypes.shape({\\n      gravity: PropTypes.arrayOf(PropTypes.number).isRequired,\\n       drawBounds: PropTypes.bool,\\n    })**\\n\\nContains and processes the physics bodies of all viro controls that have been physics enabled in this scene. Environmental physics properties are also applied, like gravity. \\n\\n|SubPropType|Description|\\n|:------|:----------:|\\n|gravity| A constant gravitational acceleration that is applied to all physics body objects in this scene. It is a vector in the terms of meters per second. Defaults to [0, -9.81, 0].|\\n|drawBounds| If true, renders the mesh representing the shape of all physics bodies in this scene.|\"\n  },\n  \"cols\": 2,\n  \"rows\": 15\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"async findCollisionsWithRayAsync(from: arrayOf(number), to: arrayOf(number), closest: bool, viroTag: string)\",\n    \"0-0\": \"This function is used to find collisions between [physics](doc:physics) bodies and a line emanating from the given `from` position to the `to` position. Collided components have their `onCollision` callbacks invoked.\\n\\n|Parameters|Description|\\n|---|---|\\n|from|the origin position of the line|\\n|to|the end position of the line|\\n|closest| if true, only the first object intersected by the line (determined by closest distance to the origin) receives the `onCollision` callback|\\n|viroTag|the string tag passed to collided components' `onCollision` callbacks|\\n\\n|Return Values|Description|\\n|---|---|\\n|hasHit| true/false whether or not a collision was detected|\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"async findCollisionsWithShapeAsync(from:arrayOf(number), to:arrayOf(number), shapeString: string, shapeParam: object, viroTag: string)\",\n    \"0-0\": \"This function is used to find collisions between [physics](doc:physics) bodies and the given shape moving from the given `from` position to the `to` position. Collided components have their `onCollision` callbacks invoked.\\n\\nIf the `from` and `to` positions are the same, then this function invokes the `onCollision` callbacks of all components within the given shape.\\n\\n|Parameters|Description|\\n|---|---|\\n|from|the origin position of the line|\\n|to|the end position of the line|\\n|shapeString| the name of the shape to use in this test|\\n|shapeParam| the configuration of the shape used in this collision test|\\n|viroTag|the string tag passed to collided components' `onCollision` callbacks|\\n\\n|Return Value|Description|\\n|---|---|\\n|hasHit| true/false whether or not a collision was detected|\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"async getCameraOrientationAsync()\",\n    \"0-0\": \"This function is used to fetch the current Camera's orientation.\\n\\n|Return Value|Description|\\n|---|---|\\n|orientation|an object that contains the camera's `position`, `rotation`, `forward` vector and `up` vector as number arrays|\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"setNativeProps(nativeProps: object)\",\n    \"0-0\": \"A wrapper function around the native component's setNativeProps which allow users to set values on the native component without changing state/setting props and re-rendering. Refer to the React Native documentation on [Direct Manipulation](https://facebook.github.io/react-native/docs/direct-manipulation.html) for more information.\\n\\n|Parameter|Description|\\n|---|---|\\n|nativeProps | an object where the keys are the properties to set and the values are the values to set  |\\n\\nFor example, setting position natively would look like this:\\n\\n```\\ncomponentRef.setNativeProps({\\n    position : [0, 0, -1]\\n});\\n```\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]","excerpt":"","slug":"viroscene","type":"basic","title":"ViroScene"}
A ViroScene is the top most component for each scene in a Viro application. Please see our [Scene Guide](doc:scenes#scene-graph) for more information. ######Example use: ``` <ViroScene onClick={this._onClick}> <ViroSphere position={[0, 0 , -1]} /> <ViroScene/> ``` [block:api-header] { "type": "basic", "title": "Props" } [/block] ##Optional Props [block:parameters] { "data": { "0-0": "**dragType**", "8-0": "**onPlatformUpdate**", "15-0": "**rotation**", "16-0": "**style**", "17-0": "**text**", "18-0": "**transformBehaviors**", "20-0": "**visible**", "19-0": "**width**", "h-0": "PropKey", "h-1": "PropType", "0-1": "**PropTypes.oneOf([\"FixedDistance\", \"FixedToWorld\"])**\n\nDetermines the behavior of drag if **onDrag** is specified.\n\n|Value|Description|\n|:------|:----------:|\n|FixedDistance| Dragging is limited to a fixed radius around the user|\n|FixedToWorld| Dragging is based on intersection with real world objects. **Available only in AR** |\n\nThe default value is \"FixedDistance\".", "8-1": "**React.PropTypes.func**\n\nCallback method set to be notified of platform specific information like headset type or controller type.\n\nExample Code:\n``` \n_onPlatformUpdate(platformInfo){\n\tvar platform = platformInfo.vrPlatform;\n\tvar headset = platformInfo.headset;\n\tvar controller = platformInfo.controller;\n}\n```\n\nList of supported platforms:\n\n| |Cardboard iOS|Cardboard Android|Daydream|GearVR\n|:-------------------|:---------------|:---------------|:---------------|:---------------|\n|Platform|gvr|gvr|gvr|ovr-mobile|\n|Headset|cardboard|cardboard|daydream|gearvr|\n|Controller|cardboard|cardboard|daydream|gearvr|", "15-1": "PropTypes.arrayOf(PropTypes.number)\n\nPut the PropType Description here.", "16-1": "stylePropType", "17-1": "PropTypes.string\n\nPut the PropType Description here.", "18-1": "PropTypes.arrayOf(PropTypes.string)\n\nPut the PropType Description here.", "19-1": "PropTypes.number\n\nPut the PropType Description here.", "20-1": "PropTypes.bool\n\nPut the PropType Description here.", "6-0": "**onHover**", "6-1": "**React.PropTypes.func**\n\nFunction to be invoked when the user hovers on on the scene. If this is defined, it is invoked **ONLY** if no other object captures the onHover event.\n\nFor example:\n``` \n_onHover(isHovering) {\n if(isHovering) {\n // user is hovering on the scene.\n } else {\n // user is hovering on another object in the scene.\n }\n}\n```", "3-0": "**onClickState**", "3-1": "**React.PropTypes.func**\n\nCalled for each click state an object goes through as it is clicked. Supported click states and their values are the following:\n\n|State Value|Description|\n|:------|:----------:|\n|1| Click Down: Triggered when the user has performed a click down action while hovering on this control.|\n|2| Click Up: Triggered when the user has performed a click up action while hovering on this control.|\n|3| Clicked: Triggered when the user has performed both a click down and click up action on this control sequentially, thereby having \"Clicked\" the object.|\n\nExample code:\n``` \n_onClickState(stateValue, source) {\n if(stateValue == 1) {\n // Click Down\n } else if(stateValue == 2) {\n // Click Up\n } else if(stateValue == 3) { \n // Clicked\n }\n}\n```\nFor the mapping of sources to controller inputs, see the [Events](doc:events) section.\n\nThis is **ONLY** invoked if a click is not captured on another object within a scene.", "10-1": "**React.PropTypes.func**\n\nNEED TO UPDATE DESCRIPTION", "11-1": "**React.PropTypes.func**\n\nNEED TO UPDATE DESCRIPTION", "12-1": "**React.PropTypes.func**\n\nCalled when the user performs a touch action, while hovering on the control. Provides the touch state type, and the x/y coordinate at which this touch event has occurred.\n\n|State Value|Description|\n|:------|:----------:|\n|1| Touch Down: Triggered when the user makes physical contact with the touch pad on the controller. |\n|2| Touch Down Move: Called when the user moves around the touch pad immediately after having performed a Touch Down action. |\n|3| Touch Up: Triggered after the user is no longer in physical contact with the touch pad after a Touch Down action. |\n\nFor example:\n``` \n_onTouch(state, touchPos, source) {\n var touchX = touchPos[0];\n var touchY = touchPos[1];\n if(state == 1) {\n // Touch Down\n } else if(state == 2) {\n // Touch Down Move\n } else if(state == 3) { \n // Touch Up\n }\n}\n```\nFor the mapping of sources to controller inputs, see the [Events](doc:events) section.\n\nUnsupported VR Platforms: Cardboard(Android and iOS).", "10-0": "**onScroll**", "11-0": "**onSwipe**", "12-0": "**onTouch**", "14-0": "**soundRoom**", "14-1": "**PropTypes.shape**\n\nDescribes the acoustic properties of the room around the user by allowing the developer to describe the room based on its dimensions and its surface properties. Note: This is not supported in Cardboard iOS.\n\nCode Example:\n``` \n soundRoom={{\n size: {[2,2,2]},\n wallMaterial: \"acoustic_ceiling_tiles\",\n ceilingMaterial:\"glass_thin\",\n floorMaterial:\"concrete_block_coarse\"\n }}\n```\nList of soundRoom properties:\n\n|Name|Description|\n|:-------------------|:---------------|\n|size|The 3D dimensions of the room.|\n|wallMaterial|Sound Material for the four walls.|\n|ceilingMaterial|Sound Material for the ceiling|\n|floorMaterial|Sound Material for the floor|\n\nList of Supported Sound Materials:\n\n|Name|Description|\n|:-------------------|:---------------|\n|acoustic_ceiling_tiles|Acoustic ceiling tiles, absorbs most frequencies.|\n|brick_bare|Bare brick, relatively reflective.|\n|brick_painted|Painted brick|\n|concrete_block_coarse|Coarse surface concrete block.|\n|concrete_block_painted|Painted concrete block.|\n|curtain_heavy|Heavy curtains.|\n|fiber_glass_insulation|Fiber glass insulation.|\n|glass_thin|Thin glass.|\n|glass_thick|Thick glass.|\n|grass|Grass.|\n|linoleum_on_concrete|Linoleum on concrete.|\n|marble|Marble.|\n|metal|Galvanized sheet metal.|\n|parquet_on_concrete|Wooden parquet on concrete.|\n|plaster_rough|Rough plaster surface.|\n|plaster_smooth|Smooth plaster surface.|\n|plywood_panel|Plywood panel|\n|polished_concrete_or_tile|Polished concrete or tile surface.|\n|sheet_rock|Sheet rock|\n|transparent|Acoustically transparent material, reflects no sound.|\n|water_or_ice_surface|Surface of water or ice.|\n|wood_ceiling|Wooden ceiling.|\n|wood_panel|Wood paneling.|", "5-0": "**onFuse**", "5-1": "**PropTypes.oneOfType**\n``` \nPropTypes.oneOfType([\n React.PropTypes.shape({\n callback: React.PropTypes.func.isRequired,\n timeToFuse: PropTypes.number\n }),\n React.PropTypes.func,\n])\n``` \nAs shown above, onFuse takes one of the types - either a callback, or a dictionary with a callback and duration. \n\nIt is called after the user hovers onto and remains hovered on the control for a certain duration of time, as indicated in timeToFuse that represents the duration of time in milliseconds. \n\nWhile hovering, the reticle will display a count down animation while fusing towards timeToFuse.\n\nNote that timeToFuse defaults to 2000ms.\n\nFor example:\n``` \n_onFuse(source){\n // User has hovered over object for timeToFuse milliseconds\n}\n```\nFor the mapping of sources to controller inputs, see the [Events](doc:events) section.", "4-0": "**onDrag**", "7-0": "**onPinch**", "9-0": "**onRotate**", "2-0": "**onClick**", "2-1": "**React.PropTypes.func**\n\nFunction to be invoked when a user clicks on a scene. This is **ONLY** invoked if a click is not captured on another object within a scene.\n\nDefining this can be used to register clicks for 360 Photos and videos.", "1-0": "**ignoreEventHandling**", "13-0": "**physicsWorld**", "4-1": "**React.PropTypes.func**\n\nCalled when the view is currently being dragged. The dragToPos parameter provides the current 3D location of the dragged object. \n\nExample code:\n``` \n_onDrag(dragToPos, source) {\n // dragtoPos[0]: x position\n // dragtoPos[1]: y position\n // dragtoPos[2]: z position\n}\n``` \nFor the mapping of sources to controller inputs, see the [Events](doc:events) section. \n\nUnsupported VR Platforms: Cardboard iOS", "1-1": "**PropTypes.bool**\n\nWhen set to true, this control will ignore events and not prevent controls behind it from receiving event callbacks.\n\nThe default value is false.", "7-1": "**React.PropTypes.func**\n\nCalled when the user performs a pinch gesture on the control. When the pinch starts, the scale factor is set to 1 is relative to the points of the two touch points. \n\nFor example:\n```\n _onPinch(pinchState, scaleFactor, source) {\n if(pinchState == 3) {\n // update scale of obj by multiplying by scaleFactor when pinch ends.\n return;\n }\n //set scale using native props to reflect pinch.\n }\n```\npinchState can be the following values:\n\n|State Value|Description|\n|:------|:----------:|\n|1| Pinch Start: Triggered when the user has started a pinch gesture.|\n|2| Pinch Move: Triggered when the user has adjusted the pinch, moving both fingers. |\n|3| Pinch End: When the user has finishes the pinch gesture and released both touch points. |\n\n**This event is only available in AR iOS**.", "9-1": "**React.PropTypes.func**\n\nCalled when the user performs a rotation touch gesture on the control. Rotation factor is returned in degrees.\n\nWhen setting rotation, the rotation should be relative to it's current rotation, *not* set to the absolute value of the given rotationFactor.\n\nFor example:\n\n```\n _onRotate(rotateState, rotationFactor, source) {\n\n if (rotateState == 3) {\n //set to current rotation - rotationFactor.\n return;\n }\n //update rotation using setNativeProps\n },\n\n```\nrotationFactor can be the following values:\n\n|State Value|Description|\n|:------|:----------:|\n|1| Rotation Start: Triggered when the user has started a rotation gesture.|\n|2| Rotation Move: Triggered when the user has adjusted the rotation, moving both fingers. |\n|3| Rotation End: When the user has finishes the rotation gesture and released both touch points. |\n\n**This event is only available in AR iOS**.", "13-1": "**PropTypes.shape({\n gravity: PropTypes.arrayOf(PropTypes.number).isRequired,\n drawBounds: PropTypes.bool,\n })**\n\nContains and processes the physics bodies of all viro controls that have been physics enabled in this scene. Environmental physics properties are also applied, like gravity. \n\n|SubPropType|Description|\n|:------|:----------:|\n|gravity| A constant gravitational acceleration that is applied to all physics body objects in this scene. It is a vector in the terms of meters per second. Defaults to [0, -9.81, 0].|\n|drawBounds| If true, renders the mesh representing the shape of all physics bodies in this scene.|" }, "cols": 2, "rows": 15 } [/block] [block:api-header] { "title": "Methods" } [/block] [block:parameters] { "data": { "h-0": "async findCollisionsWithRayAsync(from: arrayOf(number), to: arrayOf(number), closest: bool, viroTag: string)", "0-0": "This function is used to find collisions between [physics](doc:physics) bodies and a line emanating from the given `from` position to the `to` position. Collided components have their `onCollision` callbacks invoked.\n\n|Parameters|Description|\n|---|---|\n|from|the origin position of the line|\n|to|the end position of the line|\n|closest| if true, only the first object intersected by the line (determined by closest distance to the origin) receives the `onCollision` callback|\n|viroTag|the string tag passed to collided components' `onCollision` callbacks|\n\n|Return Values|Description|\n|---|---|\n|hasHit| true/false whether or not a collision was detected|" }, "cols": 1, "rows": 1 } [/block] [block:parameters] { "data": { "h-0": "async findCollisionsWithShapeAsync(from:arrayOf(number), to:arrayOf(number), shapeString: string, shapeParam: object, viroTag: string)", "0-0": "This function is used to find collisions between [physics](doc:physics) bodies and the given shape moving from the given `from` position to the `to` position. Collided components have their `onCollision` callbacks invoked.\n\nIf the `from` and `to` positions are the same, then this function invokes the `onCollision` callbacks of all components within the given shape.\n\n|Parameters|Description|\n|---|---|\n|from|the origin position of the line|\n|to|the end position of the line|\n|shapeString| the name of the shape to use in this test|\n|shapeParam| the configuration of the shape used in this collision test|\n|viroTag|the string tag passed to collided components' `onCollision` callbacks|\n\n|Return Value|Description|\n|---|---|\n|hasHit| true/false whether or not a collision was detected|" }, "cols": 1, "rows": 1 } [/block] [block:parameters] { "data": { "h-0": "async getCameraOrientationAsync()", "0-0": "This function is used to fetch the current Camera's orientation.\n\n|Return Value|Description|\n|---|---|\n|orientation|an object that contains the camera's `position`, `rotation`, `forward` vector and `up` vector as number arrays|" }, "cols": 1, "rows": 1 } [/block] [block:parameters] { "data": { "h-0": "setNativeProps(nativeProps: object)", "0-0": "A wrapper function around the native component's setNativeProps which allow users to set values on the native component without changing state/setting props and re-rendering. Refer to the React Native documentation on [Direct Manipulation](https://facebook.github.io/react-native/docs/direct-manipulation.html) for more information.\n\n|Parameter|Description|\n|---|---|\n|nativeProps | an object where the keys are the properties to set and the values are the values to set |\n\nFor example, setting position natively would look like this:\n\n```\ncomponentRef.setNativeProps({\n position : [0, 0, -1]\n});\n```" }, "cols": 1, "rows": 1 } [/block]