Edward Jackson

Edward Jackson


Create a Youtube-integrated application using React Native


While building certain types of mobile apps, you might need to have media files displayed in the app. In this tutorial, we will see how to integrate media from YouTube into our mobile apps.

What we’ll build

We will build a simple mobile app using React Native called OurTube which will pull videos from the new trailers on Rotten Tomato YouTube channel via the Youtube API and display them to the user. After displaying, we should also be able to tap on a video and have it play inside the app.


A basic understanding of React and React Native is required for this tutorial.

Getting started

Youtube is a video sharing website and it allows users to upload, rate, like, dislike, comment on videos and a lot more. Youtube also allows users to live stream videos. Youtube is also used widely for video blogging, educational purposes, movies, and trailers, and so on. With the Youtube API, users can find, watch, and manage content on YouTube. It also allows you to add YouTube functionality to your website and mobile apps.

Obtaining your YouTube API key

To get started, the first step is to obtain our developer API key from the developer console. If you prefer a video tutorial, you can find a detailed video tutorial on how to obtain your developer API keys for YouTube here.

After obtaining your API key that should look like AIzaSy****DjoCmWdzH*****cZYjOVg8o******, we require the playlist ID we would like to fetch. To get the playlist ID:

  • Go to Rotten Tomatoes TV channel YouTube page -> New Trailers Playlist
  • Copy the URL from the address bar e.g <a href="https://www.youtube.com/playlist?list=PLTovKDoAy18KZ6sUQcmK2RDQeYkm2xUNt" target="_blank">https://www.youtube.com/playlist?list=PLTovKDoAy18KZ6sUQcmK2RDQeYkm2xUNt</a> and the playlist ID will be the string after the list query in the URL which is PLTovKDoAy18KZ6sUQcmK2RDQeYkm2xUNt

Setting up our React Native project

To get started, follow the official documentation on how to set up your computer for React Native development. If you already have your computer set up, you need to initiate and create the application project.

    $ react-native init OurTube

Once that is completed, we need to compile and build the application to make sure everything is working fine.

    // For ios
    $ react-native run-ios

    // For Android
    $ react-native run-android

Configure routing using react-native-router-flux

React-native-router-flux is a simple navigation API on top of React Navigation and it allows you to declare all application routes in stack and scenes for easy management and configuration. To get started with react-native-router-flux:

    $ npm install react-native-router-flux --save

Go ahead and create a route file and configure all application routing.

    $ touch Route.js

Route.js should be in the root directory of our OurTube App and the contents will look like:

    // Route.js
    import React, { Component } from 'react';
    import {Platform} from 'react-native';
    // import components from react-native-router-flux
    import {Router, Stack, Scene} from 'react-native-router-flux';
    // import our screens as components 
    import Home from './screens/Home';
    import WatchVideo from './screens/Video';
    export default class Routes extends Component<{}> {
      render() {
              <Stack key="root">
                <Scene key="home" component={Home} title="Playlist Videos" />
                <Scene key="watchvideo" component={WatchVideo} title="View Video"/>

The Router is the main routing component while a Stack is a group of Scenes with it’s own navigator, so you can have multiple stacks for navigating. A Scene is the basic routing component for the main router and all Scene components require a key prop that must be unique and a key prop is used to call the screen transition and must be unique to all screens. We have created two scenes called home and watchvideo. The scenes will be called as actions in our Home and Video screens. More information can be found in the official documentation of React Native Router Flux. Update App.js file to look like:

    // App.js
    import React, { Component } from 'react';
    import {
    } from 'react-native';
    import Routes from './Route';
    export default class App extends Component<{}> {
      render() {
        return (
          <View style={styles.container}>
    const styles = StyleSheet.create({
      container : {
        flex: 1,

Creating UI components

React Native offers inbuilt UI components and we’ll be leveraging these inbuilt components. We will make use of components such as the FlatList, Text, and so on. Let’s go ahead to create our project directories and files:

    $ mkdir screens && cd screens
    $ touch Home.js Video.js

``js // screens/Home.js import React, { Component } from ‘react’; import { StyleSheet, SafeAreaView, FlatList, Text, TouchableOpacity } from ‘react-native’; import {Actions} from ‘react-native-router-flux’; const MAX_RESULT = 15; const PLAYLIST_ID = “PLScC8g4bqD47c-qHlsfhGH3j6Bg7jzFy-”; const API_KEY = “”; export default class Home extends Component<{}> {

    Actions.watchvideo({video_url: video_url});
  componentWillMount() {
  fetchPlaylistData = async () => {
    const response = await fetch(`https://www.googleapis.com/youtube/v3/playlistItems?playlistId=${PLAYLIST_ID}&maxResults=${MAX_RESULT}&part=snippet%2CcontentDetails&key=${API_KEY}`);
    const json = await response.json();
    this.setState({ videos: json['items']});
  constructor(props) {
    this.state = {
      videos: [],
  render() {
    const videos = this.state.videos;
    return (
      <SafeAreaView style={styles.safeArea}>
              keyExtractor={(_, index) => index.toString()}
                ({item}) => 
                    onPress={() => this.watchVideo(item.contentDetails.videoId)}
const styles = StyleSheet.create({
  safeArea: {
    flex: 1,
    backgroundColor: '#fff'
  demacate: {
    borderBottomColor: 'blue',
    borderBottomWidth: 2,
  item: {
    padding: 10,
    fontSize: 12,
    height: 44,

The first thing we do in the `Home.js` file is to import all the necessary components to build the home screen. Like the variable names imply, `MAX_RESULT` is the number of videos we want to return from the youtube API, `PLAYLIST_ID` is a string of the youtube playlist we want to fetch and `API_KEY` will hold our Youtube API access key.

The `home()` and `watchVideo()` functions will call navigation actions that allow us to navigate from page to page. The `fetchPlaylistData()` is an asynchronous function that allows us to fetch data from the Youtube API and `componentWillMount()` allows us to fetch the async data after the screen is rendered. 

The response data is converted to JSON and stored in the videos state and will be passed to our component during rendering. 

In the `render()` we define a prop that holds data fetched such as video id from our Youtube API and we pass it to the videos page as a `video_url` prop so we don't have to do a network fetch to get the same data on the next screen. 

Our `render()` function renders the screen and we use the SafeAreaView component to handle the screens of newer devices such as the iPhone X, XR and higher so the screen doesn't overlap. We use the `Flatlist` component to render our data from the `videos` state using the `renderItem` prop.

    // screens/Video.js
    import React, { Component } from 'react';
    import { StyleSheet, SafeAreaView, View, WebView } from 'react-native';
    import {Actions} from 'react-native-router-flux';
    export default class WatchVideo extends Component<{}> {

      constructor(props) {
      render() {
        return (
          <SafeAreaView style={styles.safeArea}>
                  source={{ uri: "https://www.youtube.com/embed/"+this.props.video_url}}
    const styles = StyleSheet.create({
      safeArea: {
        flex: 1,
        backgroundColor: '#fff'

In the Video.js file, we also import all the necessary components to build our interface and likewise, create routing actions so we can navigate back to our home screen. In the render() function, the data we stored in the video_url props is accessed and rendered using the Webview video component. The component is customizable and allows us to define the URL source, loaders, and so on.

Building our app

To build and compile our code on iOS:

    $ react-native run-ios

To build and compile our code on Android:

    $ react-native run-android

After build is successful, your application should look like:

  • Home Screen
  • Video Screen


The YouTube API is robust and allows us to watch videos, get video metadata, and so on. The data can be integrated with any mobile development framework and as seen in OurTube app using React Native. OurTube app is in a simple version right now, but you can go ahead to add some more functionalities such as liking and disliking videos, reporting comments, and so on by reading the Google Developer guide for Youtube in order to build complex and robust applications. The codebase to this tutorial is available in a public GitHub repository. Feel free to play around with it.

Thanks for reading ❤

#ios #javascript #reactjs #react-native

What is GEEK

Buddha Community

Create a Youtube-integrated application using React Native
Autumn  Blick

Autumn Blick


How native is React Native? | React Native vs Native App Development

If you are undertaking a mobile app development for your start-up or enterprise, you are likely wondering whether to use React Native. As a popular development framework, React Native helps you to develop near-native mobile apps. However, you are probably also wondering how close you can get to a native app by using React Native. How native is React Native?

In the article, we discuss the similarities between native mobile development and development using React Native. We also touch upon where they differ and how to bridge the gaps. Read on.

A brief introduction to React Native

Let’s briefly set the context first. We will briefly touch upon what React Native is and how it differs from earlier hybrid frameworks.

React Native is a popular JavaScript framework that Facebook has created. You can use this open-source framework to code natively rendering Android and iOS mobile apps. You can use it to develop web apps too.

Facebook has developed React Native based on React, its JavaScript library. The first release of React Native came in March 2015. At the time of writing this article, the latest stable release of React Native is 0.62.0, and it was released in March 2020.

Although relatively new, React Native has acquired a high degree of popularity. The “Stack Overflow Developer Survey 2019” report identifies it as the 8th most loved framework. Facebook, Walmart, and Bloomberg are some of the top companies that use React Native.

The popularity of React Native comes from its advantages. Some of its advantages are as follows:

  • Performance: It delivers optimal performance.
  • Cross-platform development: You can develop both Android and iOS apps with it. The reuse of code expedites development and reduces costs.
  • UI design: React Native enables you to design simple and responsive UI for your mobile app.
  • 3rd party plugins: This framework supports 3rd party plugins.
  • Developer community: A vibrant community of developers support React Native.

Why React Native is fundamentally different from earlier hybrid frameworks

Are you wondering whether React Native is just another of those hybrid frameworks like Ionic or Cordova? It’s not! React Native is fundamentally different from these earlier hybrid frameworks.

React Native is very close to native. Consider the following aspects as described on the React Native website:

  • Access to many native platforms features: The primitives of React Native render to native platform UI. This means that your React Native app will use many native platform APIs as native apps would do.
  • Near-native user experience: React Native provides several native components, and these are platform agnostic.
  • The ease of accessing native APIs: React Native uses a declarative UI paradigm. This enables React Native to interact easily with native platform APIs since React Native wraps existing native code.

Due to these factors, React Native offers many more advantages compared to those earlier hybrid frameworks. We now review them.

#android app #frontend #ios app #mobile app development #benefits of react native #is react native good for mobile app development #native vs #pros and cons of react native #react mobile development #react native development #react native experience #react native framework #react native ios vs android #react native pros and cons #react native vs android #react native vs native #react native vs native performance #react vs native #why react native #why use react native

Juned Ghanchi


React Native App Developers India, React Native App Development Company

Expand your user base by using react-native apps developed by our expert team for various platforms like Android, Android TV, iOS, macOS, tvOS, the Web, Windows, and UWP.

We help businesses to scale up the process and achieve greater performance by providing the best react native app development services. Our skilled and experienced team’s apps have delivered all the expected results for our clients across the world.

To achieve growth for your business, hire react native app developers in India. You can count on us for all the technical services and support.

#react native app development company india #react native app developers india #hire react native developers india #react native app development company #react native app developers #hire react native developers

Hire Dedicated React Native Developer

Have you ever thought of having your own app that runs smoothly over multiple platforms?

React Native is an open-source cross-platform mobile application framework which is a great option to create mobile apps for both Android and iOS. Hire Dedicated React Native Developer from top React Native development company, HourlyDeveloper.io to design a spectacular React Native application for your business.

Consult with experts:- https://bit.ly/2A8L4vz

#hire dedicated react native developer #react native development company #react native development services #react native development #react native developer #react native

Hire Dedicated React Native Developers - WebClues Infotech

Being one of the emerging frameworks for app development the need to develop react native apps has increased over the years.

Looking for a react native developer?

Worry not! WebClues infotech offers services to Hire React Native Developers for your app development needs. We at WebClues Infotech offer a wide range of Web & Mobile App Development services based o your business or Startup requirement for Android and iOS apps.

WebClues Infotech also has a flexible method of cost calculation for hiring react native developers such as Hourly, Weekly, or Project Basis.

Want to get your app idea into reality with a react native framework?

Get in touch with us.

Hire React Native Developer Now: https://www.webcluesinfotech.com/hire-react-native-app-developer/

For inquiry: https://www.webcluesinfotech.com/contact-us/

Email: sales@webcluesinfotech.com

#hire react native developers #hire dedicated react native developers #hire react native developer #hiring a react native developer #hire freelance react native developers #hire react native developers in 1 hour

Factors affecting the cost of hiring a React Native developer in USA - TopDevelopers.co

Want to develop app using React Native? Here are the tips that will help to reduce the cost of react native app development for you.
Cost is a major factor in helping entrepreneurs take decisions about investing in developing an app and the decision to hire react native app developers in USA can prove to be fruitful in the long run. Using react native for app development ensures a wide range of benefits to your business. Understanding your business and working on the aspects to strengthen business processes through a cost-efficient mobile app will be the key to success.

#best react native development companies from the us #top react native app development companies in usa #cost of hiring a react native developer in usa #top-notch react native developer in usa #best react native developers usa #react native