@spryrocks/rn-components-ui v0.4.0-alpha.0
This library help developer create UI in react native apps. Components have not default look, otherwise developer can setup themes and styles, but library should give usual functionality and components should be open to modifications as well.
Installation
yarn add @spryrocks/rn-components-theme @spryrocks/rn-components-ui
Optionally you may install next dependencies:
yarn add react-native-floating-label-inputto useTextInputcomponent withvisualStyle="material"prop (Cnilton/react-native-floating-label-input)yarn add react-native-modalto useModalcomponent (react-native-modal/react-native-modal)yarn add react-native-ratingsto useRatingcomponent (Monte9/react-native-ratings)yarn add react-native-reanimatedto useTextcomponent withanimated={true}prop (software-mansion/react-native-reanimated)yarn add react-native-status-bar-heightto useSafeAreaViewcomponent (ovr/react-native-status-bar-height)yarn add react-native-switch-proto useSwitchcomponent (poberwong/react-native-switch-pro)yarn add react-native-modal-dropdownto useDropdowncomponent (sohobloo/react-native-modal-dropdown)
Supported components
- ActivityIndicator
- Button
- CheckBox
- Dropdown
- HorizontalPicker
- KeyboardAvoidingView
- Modal
- Rating
- SafeAreaView
- StatusBar
- SwiperIndicator
- Switch
- Text
- TextInput
- TitleBar
Themes
App should declare root theme and helper functions, for example you can add these lines to the theme/Theme.ts file:
import {
useTheme as useThemeBase,
createTheme as createThemeBase,
Theme as BaseTheme,
} from '@spryrocks/rn-components-theme';
import {ComponentsTheme} from '@spryrocks/rn-components-ui';
export interface Theme extends BaseTheme, ComponentsTheme {}
export const useTheme = <T extends RootTheme>() => useThemeBase<T>();
export const createTheme = <T extends RootTheme>(theme: T) => createThemeBase<T>(theme);You can apply the root theme, for example in the RootTheme.ts:
import {createTheme} from './Theme';
import {RootTheme} from 'routes';
export const rootTheme = createTheme<RootTheme>({
statusBar: {
barStyle: 'light-content',
},
button: {
default: {
container: {
backgroundColor: 'red',
},
},
...
},
...
});And then theme should be applied at the root level:
import {rootTheme} from 'theme/RootTheme';
<ThemeProvider theme={rootTheme}>
{the app's content}
</ThemeProvider>Then any component can be used and the theme will be applied to the components.
<Button text="Hello workd!" />Anytime theme can be overwritten in this way:
import {anotherTheme} from 'theme/AnotherTheme';
<...>
<ThemeProvider override={anotherTheme}>
{applied another theme on top of root theme}
</ThemeProvider>
</...>2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago