Passing Navigation props to screen : Part 14

Open ViewVideo.js file and get props video id . so our code should be to get value

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

so add

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

<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

<WebView
  		source={{ uri: 'https://www.youtube.com/embed/' + videoId }}
/>

 

© Copyrights 2014 by STW Services LLP