React Native App Intro Slider using AppIntroSlider

React Native Intro Slider is used to introduce your App. It is used to showcase the attractive features of your App for an Example, if you are making an E-commerce App then you can showcase the features like best deals and offers, Fast Delivery, vast variety.

To make an Intro Slider we are going to use react-native-app-intro-slider library. It will provide a AppIntroSlider component which is very easy to integrate.

With the help of react-native-app-intro-slider library you can create 3 different type of intro slider:

1. Simple Intro Slider

You have a choice to provide your custom screen to render similar as FlatList

 

2. Intro Slider with Button in Centre

All the things will be same as simple intro slider but with the addition of bottomButton prop you can centre the next button like below

 

3. Intro Slider with Custom Buttons

Here you have a choice to make the next and done button custom if you want

In this example, we will see how to add an intro slider to your app where the user can swipe through a few slides before getting into the app. Have a look at 3 different type of examples below that contain a few intro slides with next and skip options. The user can navigate through each slide using a swipe gesture or using the next button. So let’s get started.

To Make a React Native App

Getting started with React Native will help you to know more about the way you can make a React Native project. We are going to use react-native init to make our React Native App. Assuming that you have node installed, you can use npm to install the react-native-cli command line utility. Open the terminal and go to the workspace and run

npm install -g react-native-cli

Run the following commands to create a new React Native project

react-native init ProjectName

If you want to start a new project with a specific React Native version, you can use the --version argument:

react-native init ProjectName --version X.XX.X
react-native init ProjectName --version react-native@next

This will make a project structure with an index file named App.js in your project directory.

Installation of Dependency

To use AppIntroSlider you need to install react-native-app-intro-slider package. To install this open the terminal and jump into your project

Run the following command to install the dependency

This command will copy all the dependencies into your node_module directory.

Now below are the code and screenshots of the each type of Intro slider.

1. Simple intro slider

For the simple intro slider open App.js in any code editor and replace the code with the following code.

App.js

To Run the React Native App

Open the terminal again and jump into your project using.
cd ProjectName
To run the project on an Android Virtual Device or on real debugging device
react-native run-android
or on the iOS Simulator by running
react-native run-ios (macOS only).

 

2. Intro slider with button in centre

For the intro slider with button in centre open App.js in any code editor and replace the code with the following code. It is same as above code just the addition of bottomButton prop.

To Run the React Native App

Open the terminal again and jump into your project using.
cd ProjectName
To run the project on an Android Virtual Device or on real debugging device
react-native run-android
or on the iOS Simulator by running
react-native run-ios (macOS only).

 

3. Intro slider with custom buttons

For the Intro slider with custom buttons we need some custom buttons with icon so we need vector icons or the Ionicons so as per your wish you can choose any of them, for now I am using Ionicons.

If you want to know more about Ionicons then you can visit Example to Use Ionicons in React Native using react-native-ionicons.

So to use Ionicons we have to install react-native-ionicons dependency and to do that run the following command

After the updation of React Native 0.60, they have introduced autolinking feature means we do not require to link the library but they have also mentioned that some libraries need linking and react-native-ionicons is one of those cases. So for that we need to link the library using

Now we need to install pods

Now Open App.js in any code editor and replace the code with the following code.

To Run the React Native App

Open the terminal again and jump into your project using.
cd ProjectName
To run the project on an Android Virtual Device or on real debugging device
react-native run-android
or on the iOS Simulator by running
react-native run-ios (macOS only).

 

That was the React Native Intro Slider. If you have any doubt or you want to share something about the topic you can comment below or contact us here. There will be more posts coming soon. Stay tuned!

Hope you liked it. 🙂

29 thoughts on “React Native App Intro Slider using AppIntroSlider”

  1. Hi,
    really nice work.
    I just have one question/comment.
    When you this intro-slider in a real device, you’ll find that the user can scroll all slides with just one fast touch. I know that paging is used in the scroller, but it is very easy to reach the end of the scroller with one fast touch across the screen. Have you noticed that? any workaround?

  2. …I have placed my images in the ./src/assets/…jpg folder
    also in ./src/assets/images/…jpg folder
    also same images in .\android\app\src\main\res\drawable-hdpi folder
    even from https://web.facebook.com/photo.php?fbid

    I tried using require(“../assets/images/image.jpg”)
    {uri: ‘image’}
    {uri: ‘https:/…’}
    but none works.

    I’m new to this…Thanks

    • Don’t worry about the image loading I will solve it for you.
      An image component that we have used in the example can load the image from the live server or from the local directory but passing the image path has some differences.

      Please have a look on the following example and try to load the image from local directory.

      https://aboutreact.com/react-native-image/

      If you are still stucked then please share your directory structure and the image component with URL to load the image.
      A screenshot will help me alot to solve it. Please send me the screenshot on snehalagrawal1701@gmail.com

      • Thanks for your assistance.
        I don’t have any background in programming I’m just trying to switch, so it’s kind of distracting, but with your aboutreact.com site, it boost my confidence to carry on.
        I’m trying to develop a business directory app, which has to do a lot with images, that’s why I wanted to get a good experience with images.
        Regarding this introslide, do i have to configure and import render the image props using a constructor(parent & child component) export default class.
        Please, don’t mind my terms if they are not correct, I’m trying to get familiar with them.
        I can’t express how glad I am, talking to you, I’m very grateful.

  3. I tried it, still having the same image issue I had in appintroslider.
    it is not loading the image in my asset folder ‘drawer.png’
    I have also placed the image in the root directory image folder, yet, nothing…
    How do I load the images…Thanks

      • Thanks for your assistance. I really appreciate. After some workarounds, I have been able to get it right. But I still need your help. There is this component the slides at the bottom Tab position which I wish to apply to my project, find attached the image in the mail send to you (@snehalagrawal1701@gmail.com) and see if you can help me with it, I don’t if the feature exists in react native.
        Like I said earlier, my project is a business directory app, so I wish to slide logos of business at the bottom tap position.
        Thanks. You are doing a really great job.

          • Greetings
            Thanks a lot. You are one in million.
            The align view to bottom tab is close to what I need, but it has to have autoplay to keep swiping repeatedly non stop.
            I appreciate your assistance. I’m very grateful.

          • Thanx for the appreciation 🙂 it means a lot to me.
            As per my understanding, you need something like Google ad banner which changes time to time right?

            For that, we have 2 options
            1. You can make an array of images and make a view in the bottom with 5 image view component.
            Make a state to manage those images.
            Now in the constructor or in componentDidMount method setInterval of 5-10 sec and change the state and try to change those images.

            2. You can use auto-swipe menu/slider which swipes the images in a particular interval. I can help you in that if you want me to do it as I have planned to post a related post on that.

    • You have to store a flag in AsyncStorage and then you have to check for the flag. For example When you launch the activity you have to check for the value 1 in AsyncStorage if it is not set then show the screen, after showing the Intro Slider set the AsyncStorage with the value 1 and next time it will skip the Intro Slider.
      You can visit the below Example to store the flag in AsyncStorage
      https://aboutreact.com/react-native-asyncstorage/

  4. How to add custom buttons and how to change size of this slider?
    For example this slider cover all of the screen but I want to just 70% of height and 30% of remaining screen will be use for buttons.

    • Hello Sander,
      Just wrap the IntroSlider with a View and give it a height and with the help of other view make a space for you button

      <View style={{ flex: 1 }}>
          <View style={{ height: ‘80%’ }}>
              <AppIntroSlider
               slides={slides}
               onDone={this._onDone}
               showSkipButton={true}
               onSkip={this._onSkip}
              />
          </View>
          <View style={{ height: ‘20%’, justifyContent: ‘center’ }}>
              <Button title=”Click me” onPress={this.handlerFunc.bind(this)}         />
          </View>
      </View>

      Here is the screenshot after changes:

  5. Hello,
    How to change length between title and image? It is always constant and I can’t find how to change it.
    I want to change length between title and image and it should be just 16 px.

  6. hello,
    in my project i have 3 screens such as profile,linked in,education.i had applied app intro slider for that but it is applied only in profile page rather than 3 pages.could you tell me how to apply for 3 screens.its just only showing to starting page. please will you help from this

  7. Hello,

    thanks a lot for this page, it’s really well explained and work very well.
    Do you know if it’s possible to insert translation code in it thanks to i18n ? I have this kind of code : {i18n.t(“world”)} and I want to put the translation in the title and text items of my slides :

    for example :
    {
    key: ‘s2’,
    title: ‘Share your adventures !’,
    text: ‘Share with your friends\nAnd take part to the biggest distance done on 2019’,
    image: require(‘../assets/images/bg_mobile_portrait.jpg’),
    titleStyle: styles.title,
    textStyle: styles.text,
    imageStyle: styles.image,
    },

    Do you have an idea of how can i do it ?
    Thank you!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.