Skip to content

ReScript bindings for react-native-device-info

License

Notifications You must be signed in to change notification settings

rescript-react-native/device-info

Repository files navigation

@rescript-react-native/device-info

Build Status Version ReScript Forum

ReScript bindings for react-native-device-info.

Exposed as ReactNativeDeviceInfo module.

@rescript-react-native/device-info X.y.* means it's compatible with react-native-device-info X.y.*

Installation

When react-native-device-info is properly installed & configured by following their installation instructions, you can install the bindings:

npm install @rescript-react-native/device-info
# or
yarn add @rescript-react-native/device-info

@rescript-react-native/device-info should be added to bs-dependencies in your bsconfig.json:

{
  //...
  "bs-dependencies": [
    "@rescript/react",
    "rescript-react-native",
    // ...
+    "@rescript-react-native/device-info"
  ],
  //...
}

Usage

Types

ReactNativeDeviceInfo.asyncHookResult('result)

{
  .
  "loading": bool,
  "result": 'result,
}

ReactNativeDeviceInfo.powerState

type powerState  = {
  batteryLevel: float,
  batteryState: string, // | "unplugged" | "charging" | "full" | "unknown"
  lowPowerMode: option(bool),
}

Methods

ReactNativeDeviceInfo.getAndroidId()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getApiLevel()

unit => Js.Promise.t(float)

ReactNativeDeviceInfo.getApplicationName()

unit => string

ReactNativeDeviceInfo.getAvailableLocationProviders()

unit => Js.Promise.t(Js.Dict.t(bool))

ReactNativeDeviceInfo.getBaseOs()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getBatteryLevel()

unit => Js.Promise.t(float)

ReactNativeDeviceInfo.getBootloader()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getBrand()

unit => string

ReactNativeDeviceInfo.getBuildId()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getBuildNumber()

unit => string

ReactNativeDeviceInfo.getBundleId()

unit => string

ReactNativeDeviceInfo.getCarrier()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getCodename()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getDevice()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getDeviceId()

unit => string

ReactNativeDeviceInfo.getDeviceName()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getDeviceType()

unit => string

ReactNativeDeviceInfo.getDisplay()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getFingerprint()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getFirstInstallTime()

unit => Js.Promise.t(float)

ReactNativeDeviceInfo.getFontScale()

unit => Js.Promise.t(float)

ReactNativeDeviceInfo.getFreeDiskStorage()

unit => Js.Promise.t(float)

ReactNativeDeviceInfo.getHardware()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getHost()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getIncremental()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getInstallReferrer()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getInstanceId()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getIpAddress()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getLastUpdateTime()

unit => Js.Promise.t(float)

ReactNativeDeviceInfo.getMacAddress()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getManufacturer()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getMaxMemory()

unit => Js.Promise.t(float)

ReactNativeDeviceInfo.getModel()

unit => string

ReactNativeDeviceInfo.getPhoneNumber()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getPowerState()

unit => Js.Promise.t(powerState)

ReactNativeDeviceInfo.getPreviewSdkInt()

unit => Js.Promise.t(float)

ReactNativeDeviceInfo.getProduct()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getReadableVersion()

unit => string

ReactNativeDeviceInfo.getSecurityPatch()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getSerialNumber()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getSystemAvailableFeatures()

unit => Js.Promise.t(Js.Array.t(string))

ReactNativeDeviceInfo.getSystemName()

unit => string

ReactNativeDeviceInfo.getSystemVersion()

unit => string

ReactNativeDeviceInfo.getTags()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getTotalDiskCapacity()

unit => Js.Promise.t(float)

ReactNativeDeviceInfo.getTotalMemory()

unit => Js.Promise.t(float)

ReactNativeDeviceInfo.getType()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getUniqueId()

unit => string

ReactNativeDeviceInfo.getUsedMemory()

unit => Js.Promise.t(float)

ReactNativeDeviceInfo.getUserAgent()

unit => Js.Promise.t(string)

ReactNativeDeviceInfo.getVersion()

unit => string

ReactNativeDeviceInfo.hasNotch()

unit => bool

ReactNativeDeviceInfo.hasSystemFeature()

unit => Js.Promise.t(bool)

ReactNativeDeviceInfo.isAirplaneMode()

unit => Js.Promise.t(bool)

ReactNativeDeviceInfo.isBatteryCharging()

unit => Js.Promise.t(bool)

ReactNativeDeviceInfo.isCameraPresent()

unit => Js.Promise.t(bool)

ReactNativeDeviceInfo.isEmulator()

unit => Js.Promise.t(bool)

ReactNativeDeviceInfo.isHeadphonesConnected()

unit => Js.Promise.t(bool)

ReactNativeDeviceInfo.isLandscape()

unit => Js.Promise.t(bool)

ReactNativeDeviceInfo.isLocationEnabled()

unit => Js.Promise.t(bool)

ReactNativeDeviceInfo.isPinOrFingerprintSet()

unit => Js.Promise.t(bool)

ReactNativeDeviceInfo.isTablet()

unit => bool

ReactNativeDeviceInfo.supported32BitAbis()

unit => Js.Promise.t(Js.Array.t(string))

ReactNativeDeviceInfo.supported64BitAbis()

unit => Js.Promise.t(Js.Array.t(string))

ReactNativeDeviceInfo.supportedAbis()

unit => Js.Promise.t(Js.Array.t(string))

ReactNativeDeviceInfo.useBatteryLevel()

unit => option(float)

ReactNativeDeviceInfo.useBatteryLevelIsLow()

unit => option(float)

ReactNativeDeviceInfo.useDeviceName()

unit => asyncHookResult(string)

ReactNativeDeviceInfo.useFirstInstallTime()

unit => asyncHookResult(float)

ReactNativeDeviceInfo.useHasSystemFeature()

string => asyncHookResult(bool)

ReactNativeDeviceInfo.useIsEmulator()

unit => asyncHookResult(bool)

ReactNativeDeviceInfo.usePowerState()

unit => powerState

Changelog

Check the changelog for more informations about recent releases.


Contribute

Read the contribution guidelines before contributing.

Code of Conduct

We want this community to be friendly and respectful to each other. Please read our full code of conduct so that you can understand what actions will and will not be tolerated.