1 Minute React Native Onboarding Screen

Dec 2022 · Tech

I’ve been thinking about writing down what I’ve learned for a long time now. Although I’ve written freelance articles in the past, getting around to this took a while. Today, I’m introducing you to a React Native package I recently released: React Native Flatboard.

React Native Flatboard is a super lightweight, FlatList-based onboarding screen for React Native apps. With this article, you will be able to set up a fully functional onboarding screen for your React Native app in less than a minute.

First things first, set up a React Native project or open your existing React Native app where you want to set up the onboarding screen.

Inside the project, we will need to install the react-native-flatboard package using npm or Yarn with the command below.

npm i react-native-flatboard

Once the package is added, create a new screen where we will render our complete onboarding flow.

In your screen file, import the FlatBoard component from react-native-flatboard and use it as shown in the code snippet below.

import { View } from "react-native";
import FlatBoard from "react-native-flatboard";

export default function App() {
  const onComplete = () => {
    console.log("Onboarding Completed");
  };

  const data = [];

  return (
    <View style={{ flex: 1 }}>
      <FlatBoard
        data={data}
        onFinish={onComplete}
        accentColor="#93c01f"
        buttonTitle="Lets Go"
        hideIndicator
      />
    </View>
  );
}

When using the component, it is recommended to give the FlatBoard component the entire screen, which you can achieve by setting the flex value of the parent container to 1.

That’s pretty much it. Now pass your slide details in an object using the format below, and FlatBoard will start running immediately. By default, the FlatBoard theme is set to “Standard”, which you can stick with, or you can use the “Modern” theme for a different look and feel.

const data = [
  {
    id: 1,
    title: "Screen One",
    description: "Description One",
    icon: require("image-path.jpg"),
  },
  {
    id: 2,
    title: "Screen Two",
    description: "Description Two",
    icon: require("image-path.jpg"),
  },
];

For further customizations, FlatBoard also provides a number of optional props that you can play with. Finally, for complete documentation, contributions or issues, you can visit the source on my GitHub.