@core_super_app/utils
v0.0.6
Published
Define utils function for project
Readme
@core_super_app/utils
Utility helpers for React Native projects in the Super App ecosystem.
Features
- Responsive helpers:
scaleWidth,scaleHeight,scaleFont - Status bar/device detection helpers for iOS notch and Dynamic Island devices
- TypeScript declarations included
Installation
npm install @core_super_app/utilsor
yarn add @core_super_app/utilsRequirements
- Node.js
v22.20.0(see.nvmrc) - React Native app environment
Usage
Import from package root:
import {
scaleWidth,
scaleHeight,
scaleFont,
getStatusBarHeight,
isIPhoneWithMonobrow,
isIPhoneWithDynamicIsland,
} from '@core_super_app/utils';
const buttonWidth = scaleWidth(48);
const imageHeight = scaleHeight(28);
const titleSize = scaleFont(16);
const statusBarHeight = getStatusBarHeight();API
Dimension helpers
scaleWidth(size: number): number- Scale width based on current screen width.
scaleHeight(size: number): number- Scale height based on current screen height.
scaleFont(size: number): number- Scale and round font size by current pixel ratio.
Status bar & device helpers
getStatusBarHeight(skipAndroid?: boolean): number | undefined- Returns status bar height for iOS and Android.
- When
skipAndroid = true, Android returns0.
isIPhoneX(): booleanisIPhoneXMax(): booleanisIPhone12(): booleanisIPhone12Max(): booleanisIPhoneWithMonobrow(): booleanisIPhoneWithDynamicIsland(): boolean
Package exports
Root exports:
@core_super_app/utils
Subpath exports (as configured in package.json):
@core_super_app/utils/dimension@core_super_app/utils/status-bar
Development
Install dependencies:
yarnAvailable scripts:
yarn clean- remove build output (lib)yarn prepare- build package with bobyarn typecheck- run TypeScript checksyarn lint- run ESLintyarn test- run Jest testsyarn release- release version usingrelease-it
CI
GitHub Actions workflow runs on push/PR to main with:
- Lint
- Typecheck
- Tests (with coverage)
- Build verification
Publishing
This package is published publicly to npm (publishConfig.access = public).
Release command:
yarn releaseThe release process uses:
release-it- Conventional Changelog
- Git tags in format
v<version>
Contributing
Contributions are welcome. Please read:
CONTRIBUTING.mdCODE_OF_CONDUCT.md
Commit messages follow Conventional Commits.
License
MIT
