System Variables

A System Variable is a variable with a pre-defined value. Draftbit exposes different types of System Variables. Each variable has an existing value of a boolean type (true or false) and cannot be overwritten.

Types of System VariablesTypes of System Variables

Types of System Variables

Types of System Variables

There are four types of System Variables:

Name

Description

Is Online

Returns a true or false depending on the device's network state. If the device is online, it will return true and vice versa.

Uses React Native Netinfo API.

Is iOS

Returns a true or false depending on whether the app is running on an iOS device or not.

Is Android

Returns a true or false depending on whether the app is running on an Android device or not.

Is Web

Is Web - Returns a true or false depending on whether the app is running in a Web browser or not.

Note: All three variables, Is Android, Is iOS, and Is Web, use React Native's Platform module.

Usage

You may want to use a System variable when:

  • Each platform (iOS, Android, and Web) has its own limitations. You can use a System Variable like Is Android, Is iOS, or Is Web when you want to handle platform-specific restrictions.
  • You want to tweak the UI based on a specific platform. You will have to use Is Android, Is iOS, and Is Web based on the platform you want to customize the UI.
  • The Is Online variable is used to determine if the device is online or not. It is helpful to use it with a Custom Component to display an in-app notification when the device is online or offline. Here is an example of how to use the Is Online variable used in a Custom Component:
Example of an in-app notification based on the value of the **Is Online** variable.Example of an in-app notification based on the value of the **Is Online** variable.

Example of an in-app notification based on the value of the Is Online variable.


Did this page help you?