April 2020
Intermediate to advanced
716 pages
18h 55m
English
The VrButton component in React 360 will help us to implement a simple, button-style onClick behavior for the objects and Text buttons that will be added to the game. A VrButton component is not visible in the view by default and will only act as a wrapper to capture events, but it can be styled in the same way as a View component, as shown in the following code:
<VrButton onClick={this.clickHandler}> <View> <Text>Click me to make something happen!</Text> </View> </VrButton>
This component is a helper for managing click-type interactions from the user across different input devices. Input events that will trigger the click event include a spacebar press on the keyboard, a left-click on the mouse, and a touch on the screen.
The
Read now
Unlock full access