@freakycoder/react-native-helpers

中文文档
2.5.1发布于 2025/02/26MITTypeScriptCommonJS零依赖近 30 天下载 2651

All helpers in one; iPhone series support, dimensions helper, hasNotch helper, normalize text helper and text helpers for React Native with very easy use

原始使用文档
文档目录15 节
  1. Installation
  2. React Native
  3. DeviceInfo Usage
  4. Notch & DynamicIsland Usage
  5. Open Applications or Stores by Linking
  6. Normalize Text Usage
  7. Native Number Format Usage
  8. DeviceInfo Props
  9. DeviceInfo Props
  10. Utils Props
  11. Normalize Text Props
  12. Custom Text Props
  13. Roadmap
  14. Author
  15. License
React Native Helpers

Battle Tested ✅

All helpers in one; iPhone series support, dimensions helper, hasNotch helper, normalize text helper and text helpers for React Native with very easy use

npm version npm expo-compatible Platform - Android and iOS License: MIT

React Native Helpers

Installation

Add the dependency:

React Native

npm i @freakycoder/react-native-helpers

DeviceInfo Usage

import {
  Screen,
  ScreenWidth,
  ScreenHeight,
  isIOS,
  isAndroid,
  isTablet
} from "@freakycoder/react-native-helpers";

<View>
  <Container title="Device OS" subtitle={isIOS ? "iOS" : "Android"} />
  <Container title="Screen Height" subtitle={ScreenHeight} />
  <Container title="Screen Width" subtitle={ScreenWidth} />
  <Container title="Tablet?: " subtitle={isTablet ? "Tablet" : "Phone"} />
</View>;

Notch & DynamicIsland Usage

import {
  getStatusBarHeight,
  hasNotch,
  hasNotchOnly,
  hasDynamicIsland,
  getStatusBarHeight,
} from "@freakycoder/react-native-helpers";

<View>
  <Container
    title="hasNotch?"
    subtitle={hasNotch() ? "Has Notch" : "NOT notch"}
  />
  <Container
    title="hasDynamicIsland?"
    subtitle={
      hasDynamicIsland(Screen) ? "Has Dynamic Island" : "NOT Dynamic Island"
    }
  />
  <Container title="getStatusBarHeight?" subtitle={getStatusBarHeight()} />
</View>;

Open Applications or Stores by Linking

import { openAppInPlayStore, openAppInAppStore, openExternalApp } from "@freakycoder/react-native-helpers";

openAppInPlayStore('com.example.android');
openAppInAppStore('123456789');
openExternalApp('com.example.android', '123456789');

Normalize Text Usage

Method to normalize size of fonts across devices

import { normalizeText } from "@freakycoder/react-native-helpers";

fontSize: normalizeText(24),

Native Number Format Usage

Method to format the number of your texted number. You can change each options.

import { numberFormat } from "@freakycoder/react-native-helpers";

<Text>{numberFormat(50319341)</Text> // Output: 50.319.341
<Text>
  {numberFormat(1093495, "en", {
    style: "currency",
    currency: "GBP"
  })}
</Text>// Output: £ 50.319.341

Configuration - Props

DeviceInfo Props

PropertyTypeDescription
isIOSbooleanreturns if it is an iOS device or not
isAndroidbooleanreturns if it is an Android device or not
isTabletbooleanreturns if it is a tablet or phone
ScreenWidthnumberget the device's screen width
ScreenHeightnumberget the device's screen height
ScreenScalenumberget the device's screen scale ratio
ScreenFontScalenumberget the device's screen font scale ratio (depends on the user's device font scale setting)
WindowWidthnumberget the device's window width
WindowHeightnumberget the device's window height
WindowScalenumberget the device's window scale ratio
WindowFontScalenumberget the device's window font scale ratio (depends on the user's device font scale setting)
PlatformVersionnumberreturns the platform version
ScreenMinnumberget the device's screen width/height which are minimum depend on the landscape or portrait mode
ScreenMaxnumberget the device's screen width/height which are maximum depend on the landscape or portrait mode
vhnumberget the device's height but as a viewport unit
vwnumberget the device's width but as a viewport unit
vminnumberget the device's screen width/height as a viewport unit which are minimum depend on the landscape or portrait mode
vmaxnumberget the device's screen width/height as a viewport unit which are maximum depend on the landscape or portrait mode
getDeviceLanguagestringget the device's language (en_US)

DeviceInfo Props

getStatusBarHeight, hasNotch, hasNotchOnly, hasDynamicIsland

PropertyTypeDescription
hasNotchfunctionreturns if the device has notch (returns true for dynamic island!)
hasNotchOnlyfunctionreturns if the device has notch only, it does not detect if the device has dynamic island
hasDynamicIslandfunctionreturns if the device has dynamic island
getStatusBarHeightnumberreturns status bar height of the device

Utils Props

PropertyTypeDescription
openAppInPlayStorefunction(appPackageName)opens the app on android or Google Play
openAppInAppStorefunction(appStoreId)opens the app on ios or App Store
openExternalAppfunction(appPackageName, appStoreId)opens the app on ios or android - handles the platform

Normalize Text Props

PropertyTypeDescription
normalizefunction(number)returns the normalized font size

Custom Text Props

PropertyTypeDescription
numberFormatfunction(value, locale, options)returns the number formatted font with its given parameters

Roadmap

  • LICENSE
  • Typescript
  • iPhone Series Support
  • Dynamic Island
  • Separate the style helpers from device
  • More custom text helpers
  • Write an article about the lib on Medium

Author

FreakyCoder, [email protected]

License

React Native Helpers Library is available under the MIT license. See the LICENSE file for more info.

版本与发布记录

@freakycoder/react-native-helpers 共发布 22 个版本,首次发布于 2019/05/12;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.5.1latest2025/02/261.7 年前
2.5.02025/02/051.8 年前
2.4.02024/09/132 年前
2.3.02023/11/302 年前
2.2.22023/09/173 年前
2.2.12023/09/093 年前

关于 @freakycoder/react-native-helpers 的常见问题

@freakycoder/react-native-helpers 是什么?

All helpers in one; iPhone series support, dimensions helper, hasNotch helper, normalize text helper and text helpers for React Native with very easy use

如何安装 @freakycoder/react-native-helpers?

在项目目录运行 npm install @freakycoder/react-native-helpers,或使用 pnpm add / yarn add / bun add。

@freakycoder/react-native-helpers 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@freakycoder/react-native-helpers 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@freakycoder/react-native-helpers 可以商用吗?

@freakycoder/react-native-helpers 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@freakycoder/react-native-helpers 的下载量有多少?

根据 npm 官方下载统计,@freakycoder/react-native-helpers 在 2026/10/16 – 2026/11/14 这 30 天内被下载 2,651 次,日均约 88 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@freakycoder/react-native-helpers 还在维护吗?

最新版本 2.5.1 发布于 2025/02/26(1.7 年前);至今共发布 22 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/05/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。