as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
跳转到主要内容

Define the VideoDetailScreen

Before we can add the Navigation packages we need somewhere to Navigate to, so we need to create the Video Detail Screen. It will have a background image, video title, video description and eventually a play & back button.
  • Create a new file under the screens folder called VideoDetailScreen.tsx.
  • Open the file and import React, and the necessary components from ‘react-native’. In this case we’ll need ImageBackground, Text, View, and StyleSheet.
  • Create an arrow function called VideoDetailScreen and export it.
  • Add a return statement to VideoDetailScreen that contains ImageBackground tags, which will be the parent element.
  • Add a source prop to ImageBackground and hard code it to {uri: 'placeholder'},
  • Add two Text elements inside ImageBackground, one for title and one for description. Add the text, “Video Title”, to the first element, and “Video Description”, to the other.

Add Styling

Let’s add some styling.
  • Create a StyleSheet called styles and add it after the VideoDetailScreen arrow function.
  • Add image, screenContainer, videoTitle, videoDescription styles to the StyleSheet with the following values.
  • Add the styles to their respective elements.
Here is what the VideoDetailScreen.tsx code should look like:

Update Index File in Screens Folder

The last step is to add this screen to the index.ts file in the screens folder.
  • Open index.ts in the screens folder.
  • Add VideoDetailScreen to the import and export statements.
The updated index.ts file should look like this:
最后修改于 2026年10月30日