A comprehensive React Native component library with modern, customizable, and accessible components.
- ๐ฏ Modern Components - Built with the latest React Native patterns
- ๐จ Highly Customizable - Extensive theming and styling options
- โฟ Accessible - Full accessibility support with screen readers
- ๐ฎ TypeScript Ready - Complete type safety and IntelliSense
- ๐ฑ Mobile Optimized - Optimized for both iOS and Android
- ๐ช Storybook Integration - Interactive component playground
Before you install rn-base-component
, make sure you have the following prerequisites installed:
You can install these dependencies using npm or yarn (note: Current, we dont support react-native-reanimated v3 and styled-components 6.*):
npm install react-native-reanimated styled-components react-native-gesture-handler
Or
yarn add react-native-reanimated styled-components react-native-gesture-handler
Then
npm install rn-base-component
import React from 'react'
import { BaseProvider, Button, CodeInput } from 'rn-base-component'
export default function App() {
return (
<BaseProvider>
<Button onPress={() => console.log('Pressed!')}>
Click Me
</Button>
<CodeInput
length={6}
onSubmit={(code) => console.log('Code:', code)}
autoFocus
/>
</BaseProvider>
)
}
A highly customizable and accessible code input component for OTP, PIN, and verification codes.
Features:
- ๐ฏ Flexible length (1-20 digits)
- ๐ Secure text entry mode
- ๐จ Extensive styling options
- โฟ Full accessibility support
- ๐ฎ Controlled/uncontrolled modes
- ๐ฑ Mobile-optimized keyboard handling
Quick Example:
<CodeInput
length={6}
onSubmit={(code) => verifyOTP(code)}
placeholderAsDot
secureTextEntry
autoFocus
/>
๐ Full CodeInput Documentation
Customizable button component with multiple variants.
Enhanced text input with validation and styling options.
Accessible checkbox component with custom styling.
Radio button component with group support.
Flexible card component for content organization.
Collapsible content sections with smooth animations.
Progress indicators for loading states.
Interactive slider components for value selection.
Enhanced text component with typography support.
Consistent typography system.
Icon component with customizable styles.
yarn bootstrap
yarn example ios/android
To update Storybook after running it on the Simulator and adding new components or updating existing ones, run the following command.
yarn example update-stories
- CodeInput - Code input component for OTP/PIN entry
- Jest Configuration - Testing setup and configuration
- Theme System - Theming and customization guide
- Component Text - Text component guidelines
The library includes a comprehensive theming system:
import { BaseProvider, extendTheme } from 'rn-base-component'
const customTheme = extendTheme({
colors: {
primary: '#007AFF',
secondary: '#5856D6',
},
spacing: {
small: 8,
medium: 16,
large: 24,
},
})
export default function App() {
return (
<BaseProvider theme={customTheme}>
{/* Your app components */}
</BaseProvider>
)
}
All components are built with TypeScript and include comprehensive type definitions:
import { CodeInputRef, CodeInputProps } from 'rn-base-component'
const codeInputRef = useRef<CodeInputRef>(null)
const handleSubmit = (code: string) => {
// Full type safety
codeInputRef.current?.clear()
}
All components follow accessibility best practices:
- Screen reader support with proper labels
- Keyboard navigation where applicable
- Focus management with clear indicators
- ARIA attributes for complex components
- High contrast support
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT