Back to Blog

Passing Navigation props to screen : Part 14

Passing Navigation props to screen – Open View Video.js file and get props video id . so our code should be to get value.

this.props.navigation.state.params.vidid;

so add

  1. const videoId = this.props.navigation.state.params.vidid;

Now we can call { vidid } and use to display videoid which is clicked on VideoList page. So to check it 

Now in return we will call vidid in Text

So change Text like this

  1. <Text>{vidid}</Text>

Now refresh simulator and click on button of any video you will see that video id on that page

Now import WebView from react-native

WebView use to embed any url on page . It is same like we use iframe in normal html code. So we will use youtube embed url to embed video here using this component

Now in return add this code

  1. <WebView
  2. source={{ uri: ‘https://www.youtube.com/embed/’ + videoId }}
  3. />
Back to Blog
top