expo-ui-kit - a components based React-Native UI Kit
expo-ui-kit is a React-Native UI framework based on Expo.io SDK that will help build React-Native Expo apps using predefined & customizable UI components.
UI Components:
Tools & Utils:
https://reactnative.dev/docs/view
https://reactnative.dev/docs/flexbox
Usage:
<Block>
<Text>components</Text>
</Block>
<Block flex="{0}">
<Text>flex: 0</Text>
</Block>
<Block noFlex>
<Text>flex: 0</Text>
</Block>
<Block flex="{0.5}">
<Text>flex: 0.5</Text>
</Block>
<Block row>
<Text>text 1</Text>
<Text>text 2</Text>
</Block>
<Block center>
<Text>text 1</Text>
<Text>text 2</Text>
</Block>
<Block middle>
<Text>text 1</Text>
<Text>text 2</Text>
</Block>
<Block center middle>
<Text>text 1</Text>
<Text>text 2</Text>
</Block>
Colors
<Block primary>
<Text>backgroundColor: COLORS.primary</Text>
</Block>
<Block secondary>
<Text>backgroundColor: COLORS.secondary</Text>
</Block>
<Block color="#DDDDDD">
<Text>backgroundColor: #DDDDDD</Text>
</Block>
Arrange content using justifyContent
https://reactnative.dev/docs/layout-props#justifycontent
<Block space="between">
<Text>1st text</Text>
<Text>2nd text</Text>
</Block>
<Block space="evenly">
<Text>1st text</Text>
<Text>2nd text</Text>
</Block>
<Block space="around">
<Text>1st text</Text>
<Text>2nd text</Text>
</Block>
Border radius
<Block radius="{6}">
<Text>1st text</Text>
<Text>2nd text</Text>
</Block>
Wrap content using flexWrap, default flexWrap: ‘nowrap’
https://reactnative.dev/docs/flexbox#flex-wrap
<Block wrap>
<Text>1st text</Text>
<Text>2nd text</Text>
<Text>3rd text</Text>
</Block>
For animations animate props can be use to render Animated.View component
<Block animated>
<Text>animated view</Text>
</Block>
For safe area views, safe props can be use to render SafeAreaView component
<Block safe>
<Text>safe area view</Text>
</Block>
https://reactnative.dev/docs/touchableopacity
https://reactnative.dev/docs/touchablehighlight
https://reactnative.dev/docs/touchablenativefeedback
https://reactnative.dev/docs/touchablewithoutfeedback
Default render an instance of TouchableOpacity
<button highlight>
<Text>instance of TouchableHighlight</Text>
</button>
<button nativeFeedback>
<Text>instance of TouchableNativeFeedback</Text>
</button>
<button withoutFeedback>
<Text>instance of TouchableWithoutFeedback</Text>
</button>
Colors
<button primary>
<Text>backgroundColor: COLORS.primary</Text>
</button>
<button transparent>
<Text>backgroundColor: "transparent"</Text>
</button>
<button color="#DDDDDD">
<Text>backgroundColor: #DDDDDD</Text>
</button>
Set activeOpacity using opacity prop
default activeOpacity=0.8
<button opacity="{0.5}">
<Text>opacity={0.5}</Text>
</button>
Outlined and add borderColor equal with backgroundColor
<button primary outlined>
<Text>outlined</Text>
</button>
Disabling the button
<button disabled>
<Text>disabled</Text>
</button>
<button disabled="{false}">
<Text>false</Text>
</button>
Add flex to button style
<button flex>
<Text>flex=1</Text>
</button>
<button flex="{2}">
<Text>flex=2</Text>
</button>
Add height to button style
<button height="{58}">
<Text>height=58</Text>
</button>
https://reactnative.dev/docs/view
https://reactnative.dev/docs/flexbox
Using Block component with predefined props: color, radius and padding
<Card>
<Text>default card</Text>
</Card>
Border radius using radius props
<Card radius="{8}">
<Text>radius={8}</Text>
</Card>
Padding using padding props
<Card padding="{12}">
<Text>padding={12}</Text>
</Card>
Set shadow using shadow props
<Card shadow>
<Text>shadow</Text>
</Card>
<Card shadow elevation="{2}">
<Text>shadow elevation={2}</Text>
</Card>
Set borderColor using outlined prop
<Card outlined>
<Text>outlined</Text>
</Card>
https://reactnative.dev/docs/textinput
Validation
<Input pattern="/\d/" // validate digits onValidation={isValid =>
console.log(isValid)} />
<Input pattern={[ "/\d/", "/\w/"]} // validate digits and words
onValidation={isValid => console.log(isValid)} />
Border color using color prop
<input color="red" />
Pass ref from props using internalRef reference
<Input internalRef={c => this.c} />
https://reactnative.dev/docs/text
Usage:
<Text h1>fontSize of 34 from FONTS.h1</Text>
<Text h2>fontSize of 24 from FONTS.h2</Text>
<Text h3>fontSize of 20 from FONTS.h3</Text>
<Text title>fontSize of 18 from FONTS.title</Text>
<Text subtitle>fontSize of 14 from FONTS.subtitle</Text>
<Text caption>fontSize of 12 from FONTS.caption</Text>
<Text small>fontSize of 10 from FONTS.small</Text>
<Text size="{20}">fontSize of 20</Text>
<Text margin="{4}">set margin 4 to: top, right, bottom & left</Text>
<Text padding="{6}">set margin 6 to: top, right, bottom & left</Text>
<Text transform>textTransform: capitalize, lowercase, uppercase</Text>
<Text regular>fontWeight from WEIGHTS.regular</Text>
<Text bold>fontWeight from WEIGHTS.bold</Text>
<Text semibold>fontWeight from WEIGHTS.semibold</Text>
<Text medium>fontWeight from WEIGHTS.medium</Text>
<Text light>fontWeight from WEIGHTS.light</Text>
<Text weight="700">fontWeight from user input</Text>
<Text primary>color from COLORS.primary</Text>
<Text secondary>color from COLORS.secondary</Text>
<Text tertiary>color from COLORS.tertiary</Text>
<Text black>color from COLORS.black</Text>
<Text white>color from COLORS.white</Text>
<Text gray>color from COLORS.gray</Text>
<Text info>color from COLORS.info</Text>
<Text success>color from COLORS.success</Text>
<Text warning>color from COLORS.warning</Text>
<Text error>color from COLORS.error</Text>
<Text color="#DDD">color from user input</Text>
custom theme using the src/theme.js data structure
{
COLORS: {
primary: "cyan" or "#8A00D4",
secondary: "fucsia" or "#D527B7",
tertiary: "yellow" or "#FFC46B"
},
SIZES: {
font: 15,
h1: 28
title: 17
}
}
<Text primary theme="{customTheme}">primary using new color: #8A00D4</Text>
<Text animated>will render Animated.Text</Text>