Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Skip to main content

Make VideoCards focusable and pressable

Now we need to make the VideoCards focusable and pressable to enable us to interact and navigate to them. We’ll do that using a component called TouchableOpacity.
  • Open VideoCard.tsx and import TouchableOpacity from ‘react-native’.
  • Replace the View element with TouchableOpacity. Leave the style prop.
Next to make the VideoCard pressable we need to give it an onPress() handler.
  • Pass a new prop to the VideoCard called pressFunction and give it a type of Function
  • Add the onPress prop to TouchableOpacity and set its value to call the new pressFunction
Next we need to make it obvious to the user which video has been selected. We can do this by adding onFocus() and onBlur() properties to the TouchableOpacity
  • Import useState from react and initialize it with a state of focused and a function of setFocused.
  • Initialize the value of focused to false.
  • Add an onFocus prop to the TouchableOpacity, and set it to call the setFocused() function with the value true
  • Add an onBlur prop to the TouchableOpacity, and set it to call the setFocused() function with the value false
Finally we need to add styles to highlight that the Card has been focused.
  • Modify the videoCardContainer as below.
  • Create two new style props called focused and unfocused and set their styles as below.
  • Modify the TouchableOpacity to add a new style prop depending on the value of focused (focused if true and unfocused if false)
The VideoCard.tsx code should look like this:
  • Refresh the app. You should now be able to focus on a video card by pressing any of the keys on the D-pad / arrow keys on your keyboard, as seen in the video below.
Video card focus

Video card focus


Last modified on February 9, 2026