@core_super_app/ui
v0.0.12
Published
Define common components for project
Readme
@core_super_app/ui
Thư viện UI component dùng chung cho ứng dụng React Native trong hệ sinh thái Super App.
Tinh nang
BaseView: layout khung trang + header + loading overlayHeader: header co nut back, title/subtitle, right viewLoadingOverlay: overlay loading toan man hinhTextWrapper: wrapper choTextvoi default style va accessibilityBasicButton: button gradient co trang thai disabledBasicInput: input label dong, clear button, counter, imperative ref- Export sang
ImageSrccho cac asset icon
Cai dat
npm install @core_super_app/uihoac
yarn add @core_super_app/uiYeu cau
- Node.js
v22.20.0(xem.nvmrc) - React Native
0.84.x - Peer ecosystem su dung trong source:
react-native-reanimatedreact-native-linear-gradient@react-navigation/native@core_super_app/utils
Cac export chinh
Tu root package:
import {
BaseView,
Header,
LoadingOverlay,
TextWrapper,
BasicButton,
BasicInput,
ImageSrc,
} from '@core_super_app/ui';src/index.tsx hien tai export:
- toan bo trong
components - namespace
ImageSrctuconstants/image
Vi du su dung
BasicButton
import { BasicButton } from '@core_super_app/ui';
<BasicButton onPress={() => console.log('pressed')}>Dang nhap</BasicButton>;BasicInput voi ref
import { useRef } from 'react';
import { BasicInput } from '@core_super_app/ui';
type InputRef = {
focus: () => void;
blur: () => void;
};
const inputRef = useRef<InputRef>(null);
<BasicInput
ref={inputRef}
label="So dien thoai"
value={phone}
onChange={setPhone}
showClearButton
/>;BaseView
import { BaseView } from '@core_super_app/ui';
<BaseView isLoading={loading} back title="Thong tin ca nhan">
{/* Screen content */}
</BaseView>;API tong quan
Components
BaseView- Props gom:
background- toan bo
HeaderProps - toan bo
LoadingOverlayProps
- Props gom:
Header- Props chinh:
back,leftIcon,onPressLeftIcontitle,subTitle,titleStyle,titleMaxLinesrightViewdisabledBackHandler
- Props chinh:
LoadingOverlayisLoading?: booleanindicatorColor?: string
TextWrapperchildren,style,numberOfLines,ellipsizeMode,onPress,testID
BasicButtononPress,disabled,colors,style,textStyle,children
BasicInput- Ho tro label animation, clear icon, char counter, regex replace input
- Ho tro imperative ref:
focus()vablur()
Scripts
Trong package.json:
yarn clean- xoa build artifactsyarn prepare- build package bangreact-native-builder-bobyarn typecheck- kiem tra TypeScriptyarn lint- lint sourceyarn test- chay Jestyarn release- bump version/publish quarelease-it
CI
GitHub Actions (.github/workflows/ci.yml) dang chay:
- lint + typecheck
- unit test (coverage)
- build library
- build Android example (co turbo cache)
- build iOS example (co turbo cache)
Publishing
Package publish public len npm:
publishConfig.access = public- release command:
yarn releaseRelease flow su dung release-it + conventional changelog + git tag v<version>.
Contributing
Commit message convention theo Conventional Commits.
License
MIT
