A basic UI design system for mobile applications.
To install the package, use one of the following commands:
npm install @herujest/rn-mob-common-ui
# or
yarn add @herujest/rn-mob-common-ui
Wrap your application (or a specific section) with the ThemeProvider
component. This ensures theme data are available to all child components.
import React from 'react';
import ReactDOM from 'react-dom';
import { ThemeProvider } from '@herujest/rn-mob-common-ui';
import App from './App';
ReactDOM.render(
<ThemeProvider>
<App />
</ThemeProvider>,
document.getElementById('root')
);
A customizable button component.
import { Buttons } from 'rn-mob-common-ui';
<Buttons
type="primary"
title="Click Me"
onPress={() => console.log('Button Pressed!')}
/>;
Render SVG icons easily.
import { Icon } from 'rn-mob-common-ui';
<Icon name="settings" size={24} color="#000" />;
- Use IcoMoon App to generate a JSON file.
- Upload your SVGs and download the JSON.
"@herujest/rn-mob-common-ui": {
"icon-json-path": "path-to-your-json/customicon.json",
"output-types-path": "desired-path-to-your-json/IconTypes.ts"
}
yarn generate-icon-types
Styled text component with multiple variants.
import { Text } from 'rn-mob-common-ui';
<Text variant="headline1">Hello World!</Text>;
You can use your own icon vector by following this
Place font files in assets/fonts/
:
π your-project
β£ π assets
β β π fonts
β β£ π· CustomFont-Regular.ttf
β β£ π· CustomFont-Bold.ttf
β β π· CustomFont-Italic.ttf
Modify react-native.config.js
:
module.exports = {
assets: ['./assets/fonts/'],
};
Run the following command:
npx react-native-asset
import { ThemeProvider, type FontConfig } from '@herujest/rn-mob-common-ui';
const customTheme: FontConfig = {
bold: 'CustomFont-Bold',
semibold: 'CustomFont-Regular',
regular: 'CustomFont-Bold',
};
const App = () => (
<ThemeProvider theme={customTheme}>
<Text variant="headline1">Hello, Custom Font!</Text>
</ThemeProvider>
);
export default App;
import { Text } from '@herujest/rn-mob-common-ui';
const App = () => <Text variant="headline1">Hello, Custom Font!</Text>;
export default App;
A base component that wraps content inside a SafeAreaView
, ensuring proper layout and spacing.
import { Container } from 'rn-mob-common-ui';
<Container>
<Text>Safe and sound!</Text>
</Container>;
A scrollable content area that ensures the keyboard does not overlap input fields.
import { Content } from 'rn-mob-common-ui';
<Content>
<Text>Scrollable Content Here</Text>
</Content>;
A labeled input field with validation styles.
import { InputField } from 'rn-mob-common-ui';
<InputField
label="Username"
value={username}
onChangeText={setUsername}
error={!!error}
placeholder="Enter your username"
/>;
Reusable modal and popup components.
import { Modal, Popups } from 'rn-mob-common-ui';
// Example usage
Displays empty states with an image and description.
import { EmptyView } from 'rn-mob-common-ui';
<EmptyView
description="No Data Found"
imageSource={require('./path/to/image.png')}
/>;
Use the theme context to access and switch between light and dark themes dynamically.
import { ThemeProvider, useTheme } from 'rn-mob-common-ui';
const App = () => {
const { toggleTheme, colors } = useTheme();
return (
<ThemeProvider>
<Text style={{ color: colors.basic1 }}>Theme-based Text</Text>
</ThemeProvider>
);
};
To contribute, please check the Contributing Guide for setup instructions and best practices.
This project is licensed under the MIT License.