{"_id":"59bc03d31d2d8d001a34459f","category":{"_id":"59bc03d31d2d8d001a344583","version":"59bc03d31d2d8d001a34457d","project":"578c4badbd223d2000cc1441","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-08-01T23:04:12.838Z","from_sync":false,"order":6,"slug":"api-reference","title":"API Reference"},"project":"578c4badbd223d2000cc1441","user":"57bb7defafc18c0e00529cf1","parentDoc":null,"version":{"_id":"59bc03d31d2d8d001a34457d","project":"578c4badbd223d2000cc1441","__v":2,"createdAt":"2017-09-15T16:46:11.721Z","releaseDate":"2017-09-15T16:46:11.721Z","categories":["59bc03d31d2d8d001a34457e","59bc03d31d2d8d001a34457f","59bc03d31d2d8d001a344580","59bc03d31d2d8d001a344581","59bc03d31d2d8d001a344582","59bc03d31d2d8d001a344583","59bc284b7c3f420010f965e6"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2.0.0"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-10-18T01:00:11.634Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":36,"body":"A component that provides 2D Text functionality. \n\n######Example use:\n```\n<ViroText\n    text=\"Hello World\"\n    textAlign=\"left\"\n    textAlignVertical=\"top\"\n    textLineBreakMode=\"justify\"\n    textClipMode=\"clipToBounds\"\n    color=\"#ff0000\"\n    width={2} height={2}\n    style={{fontFamily:\"Arial\", fontSize:20, color:\"#0000FF\"}}\n    position={[0,0,-5]}\n />\n```\n\n######Typefaces\n\nThe typeface to use for text is determined by the ```fontFamily``` in its ```style``` property. Not all platforms support all font families. If a font family is not supported on a given device, the system will fall back to using that platform's default system font.\n\n######Sizing\n\nUse the ```fontSize``` in the text's ```style``` property to size the text. The actual size of text in a scene is determined by three things:\n\n1. The fontSize property: this determines the size of the font textures used. Increasing fontSize creates bigger, sharper fonts, but uses much more memory. Using too small fontSize will make the text appear blurry.\n\n2. The scale of the text. Scaling the text can increase text size, but will make the fonts more blurry. Try to avoid scaling fonts where possible.\n\n3. The distance of the text from the user. We are in 3D space, so the further away text is from the camera, the smaller it will appear. Use trial and error with your headset to discover the correct font sizes.\n\nIn general, try to use the smallest ```fontSize``` possible that reaches the sharpness desired at the given distance from the camera.\n\n######Bounding Box\n\nText is contained within a bounding box defined by its ```width``` and ```height``` properties. This bounding box is invisible, but determines how the text *wraps*, *aligns*, and *clips*. Note that ```width``` and ```height``` have **no bearing** on the size of the text.\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\": \"**animation**\",\n    \"6-0\": \"**maxLines**\",\n    \"12-0\": \"**onHover**\",\n    \"17-0\": \"**onTouch**\",\n    \"20-0\": \"**position**\",\n    \"21-0\": \"**rotation**\",\n    \"24-0\": \"**style**\",\n    \"25-0\": \"**text**\",\n    \"30-0\": \"**transformBehaviors**\",\n    \"33-0\": \"**visible**\",\n    \"31-0\": \"**width**\",\n    \"h-0\": \"PropKey\",\n    \"h-1\": \"PropType\",\n    \"0-1\": \"**PropTypes.shape({\\n      name: PropTypes.string,\\n      delay: PropTypes.number,\\n      loop: PropTypes.bool,\\n      onStart: PropTypes.func,\\n      onFinish: PropTypes.func,\\n      run: PropTypes.bool,\\n    })**\\n\\nA collection of parameters that determine if this component should animate. For more information on animated components please see our [Animation](doc:animation) Guide.\",\n    \"6-1\": \"**PropTypes.number**\\n\\nThe maximum number of lines the text should take. The text will automatically be truncated if it exceeds the maxLines specified.\",\n    \"12-1\": \"**React.PropTypes.func**\\n\\nCalled when the user hovers on or off the control.\\n\\nFor example:\\n```  \\n_onHover(isHovering, source)  {\\n    if(isHovering) {\\n        // user is hovering over the box\\n    } else {\\n        // user is no longer hovering over the box\\n    }\\n}\\n```\\nFor the mapping of sources to controller inputs, see the [Events](doc:events) section.\",\n    \"17-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    \"20-1\": \"**PropTypes.arrayOf(PropTypes.number)**\\n\\nCartesian position of the text in 3D world space, specified as [x, y, z].\",\n    \"21-1\": \"**PropTypes.arrayOf(PropTypes.number)**\\n\\nThe rotation of the text around it's local axis specified as Euler angles [x, y, z]. Units for each angle are specified in degrees.\",\n    \"24-1\": \"**stylePropType** \\n\\nRefers to style property that is only used if the ViroText is within a ViroFlexView. Style properties determine the position and scale of the button within a ViroText. Please see our guide on styles for more information.\",\n    \"25-1\": \"**PropTypes.string**\\n\\nThe text that should be displayed.\",\n    \"30-1\": \"**PropTypes.arrayOf(PropTypes.string)**\\n\\nAn array of transform constraints that affect the transform of the object. For example, putting the value \\\"billboard\\\" will ensure the box is facing the user as the user rotates their head on any axis. This is useful for icons or text where you'd like the box to always face the user at a particular rotation.\\n\\nAllowed values(values are case sensitive):\\n\\n|Value|Description|\\n|:------|:----------:|\\n|billboard| Billboard object on x,y,z axis |\\n|billboardX| Billboard object on the x axis|\\n|billboardY| Billboard object on the y axis|\",\n    \"31-1\": \"**PropTypes.number**\\n\\nThe width of the the text in 3D world space. If not in a ViroFlexView the default is set to 1.\",\n    \"33-1\": \"**PropTypes.bool**\\n\\nFalse if the text should be hidden. By default the text is visible and this value is true.\",\n    \"3-0\": \"**height**\",\n    \"3-1\": \"**PropTypes.number**\\n\\nThe width of the the text in 3D world space. If not in a ViroFlexView the default is set to 1.\",\n    \"28-0\": \"**textClipMode**\",\n    \"29-0\": \"**textLineBreakMode**\",\n    \"28-1\": \"**PropTypes.oneOf(['none', 'clipToBounds'])**\\n\\nSet to ```clipToBounds``` to clip this text to its bounding box defined by ```width``` and ```height```. If set to ```none```, the text will overrun its bounds if's larger than them.\",\n    \"29-1\": \"**PropTypes.oneOf(['wordwrap','charwrap','justify','none'])**\\n\\nThe line break mode to use for text wrapping. We process line breaks against the ```width``` of the text. \\n\\nSet to ```wordwrap``` to introduce line breaks only at word boundaries, whenever the next word overruns the width. \\n\\nSet to ```charwrap``` to introduce line breaks whenever the next *character* overruns the width. This mode may break words in half across lines.\\n\\nSet to ```justify``` to introduce breaks at word boundaries, and add variable internal spacing between words, at the optimal points in the text to reduce the 'raggedness' of the text edges.\",\n    \"7-0\": \"**onClick**\",\n    \"7-1\": \"**React.PropTypes.func**\\n\\nCalled when an object has been clicked.\\n\\nExample code:\\n```  \\n_onClick(source)  {\\n    // user has clicked the object\\n}\\n```\",\n    \"8-0\": \"**onClickState**\",\n    \"10-0\": \"**onDrag**\",\n    \"15-0\": \"**onScroll**\",\n    \"16-0\": \"**onSwipe**\",\n    \"15-1\": \"**React.PropTypes.func**\\n\\nCalled when the user performs a scroll action, while hovering on the control.\\n\\nFor example:\\n```  \\n_onScroll(scrollPos, source)  {\\n    // scrollPos[0]: x scroll position from 0.0 to 1.0. \\n    // scrollPos[1]: y scroll position from 0.0 to 1.0.\\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    \"16-1\": \"**React.PropTypes.func**\\n\\nCalled when the user performs a swipe gesture on the physical controller, while hovering on this control. \\n\\nFor example:\\n```  \\n_onSwipe(state, source)  {\\n    if(state == 1) {\\n        // Swiped up\\n    } else if(state == 2) {\\n        // Swiped down\\n    } else if(state == 3) { \\n       // Swiped left\\n    } else if(state == 4) { \\n       // Swiped right\\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    \"8-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    \"10-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    \"26-0\": \"**textAlign**\",\n    \"27-0\": \"**textAlignVertical**\",\n    \"26-1\": \"**PropTypes.oneOf(['left', 'right', 'center'])**\\n\\nHorizontal alignment of the text. Aligns with respect to the bounding box of this text defined by ```width``` and ```height```. Supported values are ```left```, ```right```, and ```center```.\",\n    \"27-1\": \"**PropTypes.oneOf(['top', 'bottom', 'center'])**\\n\\nVertical alignment of the text. Aligns with respect to the bounding box of this text defined by ```width``` and ```height```. Supported values are ```top```, ```bottom```, and ```center```.\",\n    \"11-0\": \"**onFuse**\",\n    \"11-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    \"22-0\": \"**rotationPivot**\",\n    \"1-0\": \"**color**\",\n    \"1-1\": \"**ColorPropType**\\n\\nThe color of the text. The default text color is white.\\n\\nValid color formats are:\\n\\n  * '#f0f' (#rgb)\\n  * '#f0fc' (#rgba)\\n  * '#ff00ff' (#rrggbb)\\n  * '#ff00ff00' (#rrggbbaa)\\n  * 'rgb(255, 255, 255)'\\n  * 'rgba(255, 255, 255, 1.0)'\\n  * 'hsl(360, 100%, 100%)'\\n  * 'hsla(360, 100%, 100%, 1.0)'\\n  * 'transparent'\\n  * 'red'\\n  * 0xff00ff00 (0xrrggbbaa)\",\n    \"5-0\": \"**lightReceivingBitMask**\",\n    \"23-0\": \"**shadowCastingBitMask**\",\n    \"4-0\": \"**ignoreEventHandling**\",\n    \"2-0\": \"**dragType**\",\n    \"18-0\": \"**onTransformUpdate**\",\n    \"13-0\": \"**onPinch**\",\n    \"14-0\": \"**onRotate**\",\n    \"19-0\": \"**physicsBody**\",\n    \"32-0\": \"**viroTag**\",\n    \"9-0\": \"**onCollision**\",\n    \"2-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    \"4-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    \"5-1\": \"**PropTypes.number**\\n\\nA bit mask that is bitwise and-ed (&) with each light's influenceBitMask. If the result is > 0, then the light will illuminate this object. For more information please see the [Lighting and Materials](doc:3d-scene-lighting) Guide.\",\n    \"13-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    \"14-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    \"22-1\": \"**PropTypes.arrayOf(PropTypes.number) **\\n\\nCartesian position in [x,y,z] about which rotation is applied relative to the component's position.\",\n    \"23-1\": \"**PropTypes.number**\\n\\nA bit mask that is bitwise and-ed (&) with each light's influenceBitMask. If the result is > 0, then this object will cast shadows from the light. For more information please see the [Lighting and Materials](doc:3d-scene-lighting) Guide.\",\n    \"9-1\": \"**React.PropTypes.func**\\n\\nCalled when this component's physics body collides with another component's physics body. Also invoked by [ViroScene](doc:viroscene)/[ViroARScene](doc:viroarscene)'s `findCollisions...` functions.\\n\\n|Return Value | Description |\\n|---|---|\\n|viroTag | the given viroTag (string) of the collided component |\\n|collidedPoint | an array of numbers representing the position, in world coordinates, of the point of collision|\\n|collidedNormal | an array representing the normal of the collision in world coordinates. |\",\n    \"18-1\": \"**PropTypes.func**\\n\\nA function that is invoked when the component moves and provides an array of numbers representing the component's position in world coordinates.\",\n    \"19-1\": \"**PropTypes.shape({..[physics.api](http://docs.viromedia.com/v2.0.0/docs/physics#physicsbody-api)..}),**\\n\\nCreates and binds a physics body that is configured with the provided collection of physics properties associated with this control.\\n\\nFor more information on physics components, please see the [physics.api](http://docs.viromedia.com/v2.0.0/docs/physics#physicsbody-api).\",\n    \"32-1\": \"**PropTypes.string**\\n\\nA tag given to other components when their physics body collides with this component's physics body. Refer to [physics](doc:physics) for more information.\"\n  },\n  \"cols\": 2,\n  \"rows\": 34\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 getTransformAsync()\",\n    \"0-0\": \"[Async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) function that returns the component's transform (position, scale and rotation).\\n\\n|Return value | Description|\\n|---|---|\\n| transform | an object that contains \\\"position\\\", \\\"scale\\\" and \\\"rotation\\\" keys which point to number arrays |\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"applyImpulse(force: arrayOf(number), position: arrayOf(number))\",\n    \"0-0\": \"A function used with [physics](doc:physics) to apply an impulse (instantaneous) force to an object with a physics body.\\n\\n|Parameter|Description|\\n|---|---|\\n|force |an array of magnitudes to be applied as force (N) to the object in the positive x, y and z directions|\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"applyTorqueImpulse(torque: arrayOf(number), position: arrayOf(number))\",\n    \"0-0\": \"A function used with [physics](doc:physics) to apply an impulse (instantaneous) torque to an object with a physics body.\\n\\n|Parameter|Description|\\n|---|---|\\n|torque |an array of magnitudes to be applied as a torque (N * m) to the object in the positive x, y and z directions at the given position|\\n|position | a position relative to the object from which to apply the given torque|\"\n  },\n  \"cols\": 1,\n  \"rows\": 1\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"setVelocity(velocity: arrayOf(number))\",\n    \"0-0\": \"A function used with [physics](doc:physics) to set the velocity of an object with a physics body.\\n\\n|Parameter|Description|\\n|---|---|\\n|velocity | an array of numbers corresponding to x, y, and z velocity |\"\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":"virotext2","type":"basic","title":"ViroText"}
A component that provides 2D Text functionality. ######Example use: ``` <ViroText text="Hello World" textAlign="left" textAlignVertical="top" textLineBreakMode="justify" textClipMode="clipToBounds" color="#ff0000" width={2} height={2} style={{fontFamily:"Arial", fontSize:20, color:"#0000FF"}} position={[0,0,-5]} /> ``` ######Typefaces The typeface to use for text is determined by the ```fontFamily``` in its ```style``` property. Not all platforms support all font families. If a font family is not supported on a given device, the system will fall back to using that platform's default system font. ######Sizing Use the ```fontSize``` in the text's ```style``` property to size the text. The actual size of text in a scene is determined by three things: 1. The fontSize property: this determines the size of the font textures used. Increasing fontSize creates bigger, sharper fonts, but uses much more memory. Using too small fontSize will make the text appear blurry. 2. The scale of the text. Scaling the text can increase text size, but will make the fonts more blurry. Try to avoid scaling fonts where possible. 3. The distance of the text from the user. We are in 3D space, so the further away text is from the camera, the smaller it will appear. Use trial and error with your headset to discover the correct font sizes. In general, try to use the smallest ```fontSize``` possible that reaches the sharpness desired at the given distance from the camera. ######Bounding Box Text is contained within a bounding box defined by its ```width``` and ```height``` properties. This bounding box is invisible, but determines how the text *wraps*, *aligns*, and *clips*. Note that ```width``` and ```height``` have **no bearing** on the size of the text. [block:api-header] { "type": "basic", "title": "Props" } [/block] ##Optional Props [block:parameters] { "data": { "0-0": "**animation**", "6-0": "**maxLines**", "12-0": "**onHover**", "17-0": "**onTouch**", "20-0": "**position**", "21-0": "**rotation**", "24-0": "**style**", "25-0": "**text**", "30-0": "**transformBehaviors**", "33-0": "**visible**", "31-0": "**width**", "h-0": "PropKey", "h-1": "PropType", "0-1": "**PropTypes.shape({\n name: PropTypes.string,\n delay: PropTypes.number,\n loop: PropTypes.bool,\n onStart: PropTypes.func,\n onFinish: PropTypes.func,\n run: PropTypes.bool,\n })**\n\nA collection of parameters that determine if this component should animate. For more information on animated components please see our [Animation](doc:animation) Guide.", "6-1": "**PropTypes.number**\n\nThe maximum number of lines the text should take. The text will automatically be truncated if it exceeds the maxLines specified.", "12-1": "**React.PropTypes.func**\n\nCalled when the user hovers on or off the control.\n\nFor example:\n``` \n_onHover(isHovering, source) {\n if(isHovering) {\n // user is hovering over the box\n } else {\n // user is no longer hovering over the box\n }\n}\n```\nFor the mapping of sources to controller inputs, see the [Events](doc:events) section.", "17-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).", "20-1": "**PropTypes.arrayOf(PropTypes.number)**\n\nCartesian position of the text in 3D world space, specified as [x, y, z].", "21-1": "**PropTypes.arrayOf(PropTypes.number)**\n\nThe rotation of the text around it's local axis specified as Euler angles [x, y, z]. Units for each angle are specified in degrees.", "24-1": "**stylePropType** \n\nRefers to style property that is only used if the ViroText is within a ViroFlexView. Style properties determine the position and scale of the button within a ViroText. Please see our guide on styles for more information.", "25-1": "**PropTypes.string**\n\nThe text that should be displayed.", "30-1": "**PropTypes.arrayOf(PropTypes.string)**\n\nAn array of transform constraints that affect the transform of the object. For example, putting the value \"billboard\" will ensure the box is facing the user as the user rotates their head on any axis. This is useful for icons or text where you'd like the box to always face the user at a particular rotation.\n\nAllowed values(values are case sensitive):\n\n|Value|Description|\n|:------|:----------:|\n|billboard| Billboard object on x,y,z axis |\n|billboardX| Billboard object on the x axis|\n|billboardY| Billboard object on the y axis|", "31-1": "**PropTypes.number**\n\nThe width of the the text in 3D world space. If not in a ViroFlexView the default is set to 1.", "33-1": "**PropTypes.bool**\n\nFalse if the text should be hidden. By default the text is visible and this value is true.", "3-0": "**height**", "3-1": "**PropTypes.number**\n\nThe width of the the text in 3D world space. If not in a ViroFlexView the default is set to 1.", "28-0": "**textClipMode**", "29-0": "**textLineBreakMode**", "28-1": "**PropTypes.oneOf(['none', 'clipToBounds'])**\n\nSet to ```clipToBounds``` to clip this text to its bounding box defined by ```width``` and ```height```. If set to ```none```, the text will overrun its bounds if's larger than them.", "29-1": "**PropTypes.oneOf(['wordwrap','charwrap','justify','none'])**\n\nThe line break mode to use for text wrapping. We process line breaks against the ```width``` of the text. \n\nSet to ```wordwrap``` to introduce line breaks only at word boundaries, whenever the next word overruns the width. \n\nSet to ```charwrap``` to introduce line breaks whenever the next *character* overruns the width. This mode may break words in half across lines.\n\nSet to ```justify``` to introduce breaks at word boundaries, and add variable internal spacing between words, at the optimal points in the text to reduce the 'raggedness' of the text edges.", "7-0": "**onClick**", "7-1": "**React.PropTypes.func**\n\nCalled when an object has been clicked.\n\nExample code:\n``` \n_onClick(source) {\n // user has clicked the object\n}\n```", "8-0": "**onClickState**", "10-0": "**onDrag**", "15-0": "**onScroll**", "16-0": "**onSwipe**", "15-1": "**React.PropTypes.func**\n\nCalled when the user performs a scroll action, while hovering on the control.\n\nFor example:\n``` \n_onScroll(scrollPos, source) {\n // scrollPos[0]: x scroll position from 0.0 to 1.0. \n // scrollPos[1]: y scroll position from 0.0 to 1.0.\n}\n```\nFor the mapping of sources to controller inputs, see the [Events](doc:events) section.\n\nUnsupported VR Platforms: Cardboard(Android and iOS)", "16-1": "**React.PropTypes.func**\n\nCalled when the user performs a swipe gesture on the physical controller, while hovering on this control. \n\nFor example:\n``` \n_onSwipe(state, source) {\n if(state == 1) {\n // Swiped up\n } else if(state == 2) {\n // Swiped down\n } else if(state == 3) { \n // Swiped left\n } else if(state == 4) { \n // Swiped right\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)", "8-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.", "10-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", "26-0": "**textAlign**", "27-0": "**textAlignVertical**", "26-1": "**PropTypes.oneOf(['left', 'right', 'center'])**\n\nHorizontal alignment of the text. Aligns with respect to the bounding box of this text defined by ```width``` and ```height```. Supported values are ```left```, ```right```, and ```center```.", "27-1": "**PropTypes.oneOf(['top', 'bottom', 'center'])**\n\nVertical alignment of the text. Aligns with respect to the bounding box of this text defined by ```width``` and ```height```. Supported values are ```top```, ```bottom```, and ```center```.", "11-0": "**onFuse**", "11-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.", "22-0": "**rotationPivot**", "1-0": "**color**", "1-1": "**ColorPropType**\n\nThe color of the text. The default text color is white.\n\nValid color formats are:\n\n * '#f0f' (#rgb)\n * '#f0fc' (#rgba)\n * '#ff00ff' (#rrggbb)\n * '#ff00ff00' (#rrggbbaa)\n * 'rgb(255, 255, 255)'\n * 'rgba(255, 255, 255, 1.0)'\n * 'hsl(360, 100%, 100%)'\n * 'hsla(360, 100%, 100%, 1.0)'\n * 'transparent'\n * 'red'\n * 0xff00ff00 (0xrrggbbaa)", "5-0": "**lightReceivingBitMask**", "23-0": "**shadowCastingBitMask**", "4-0": "**ignoreEventHandling**", "2-0": "**dragType**", "18-0": "**onTransformUpdate**", "13-0": "**onPinch**", "14-0": "**onRotate**", "19-0": "**physicsBody**", "32-0": "**viroTag**", "9-0": "**onCollision**", "2-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\".", "4-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.", "5-1": "**PropTypes.number**\n\nA bit mask that is bitwise and-ed (&) with each light's influenceBitMask. If the result is > 0, then the light will illuminate this object. For more information please see the [Lighting and Materials](doc:3d-scene-lighting) Guide.", "13-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**.", "14-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**.", "22-1": "**PropTypes.arrayOf(PropTypes.number) **\n\nCartesian position in [x,y,z] about which rotation is applied relative to the component's position.", "23-1": "**PropTypes.number**\n\nA bit mask that is bitwise and-ed (&) with each light's influenceBitMask. If the result is > 0, then this object will cast shadows from the light. For more information please see the [Lighting and Materials](doc:3d-scene-lighting) Guide.", "9-1": "**React.PropTypes.func**\n\nCalled when this component's physics body collides with another component's physics body. Also invoked by [ViroScene](doc:viroscene)/[ViroARScene](doc:viroarscene)'s `findCollisions...` functions.\n\n|Return Value | Description |\n|---|---|\n|viroTag | the given viroTag (string) of the collided component |\n|collidedPoint | an array of numbers representing the position, in world coordinates, of the point of collision|\n|collidedNormal | an array representing the normal of the collision in world coordinates. |", "18-1": "**PropTypes.func**\n\nA function that is invoked when the component moves and provides an array of numbers representing the component's position in world coordinates.", "19-1": "**PropTypes.shape({..[physics.api](http://docs.viromedia.com/v2.0.0/docs/physics#physicsbody-api)..}),**\n\nCreates and binds a physics body that is configured with the provided collection of physics properties associated with this control.\n\nFor more information on physics components, please see the [physics.api](http://docs.viromedia.com/v2.0.0/docs/physics#physicsbody-api).", "32-1": "**PropTypes.string**\n\nA tag given to other components when their physics body collides with this component's physics body. Refer to [physics](doc:physics) for more information." }, "cols": 2, "rows": 34 } [/block] [block:api-header] { "title": "Methods" } [/block] [block:parameters] { "data": { "h-0": "async getTransformAsync()", "0-0": "[Async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) function that returns the component's transform (position, scale and rotation).\n\n|Return value | Description|\n|---|---|\n| transform | an object that contains \"position\", \"scale\" and \"rotation\" keys which point to number arrays |" }, "cols": 1, "rows": 1 } [/block] [block:parameters] { "data": { "h-0": "applyImpulse(force: arrayOf(number), position: arrayOf(number))", "0-0": "A function used with [physics](doc:physics) to apply an impulse (instantaneous) force to an object with a physics body.\n\n|Parameter|Description|\n|---|---|\n|force |an array of magnitudes to be applied as force (N) to the object in the positive x, y and z directions|" }, "cols": 1, "rows": 1 } [/block] [block:parameters] { "data": { "h-0": "applyTorqueImpulse(torque: arrayOf(number), position: arrayOf(number))", "0-0": "A function used with [physics](doc:physics) to apply an impulse (instantaneous) torque to an object with a physics body.\n\n|Parameter|Description|\n|---|---|\n|torque |an array of magnitudes to be applied as a torque (N * m) to the object in the positive x, y and z directions at the given position|\n|position | a position relative to the object from which to apply the given torque|" }, "cols": 1, "rows": 1 } [/block] [block:parameters] { "data": { "h-0": "setVelocity(velocity: arrayOf(number))", "0-0": "A function used with [physics](doc:physics) to set the velocity of an object with a physics body.\n\n|Parameter|Description|\n|---|---|\n|velocity | an array of numbers corresponding to x, y, and z velocity |" }, "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]