tipsi-ui-kit
React Native Tipsi custom UI elements
Components
<Counter />
Component to change the number by press "+" or "-".
Counter Props
Name | Desc | Type | Default |
---|---|---|---|
step |
Step of counting. | Number | 1 |
defaultValue |
Uncontrolled value of counter. | Number | 0 |
minValue |
Max value of counter. | Number | -Infinity |
maxValue |
Min value of counter. | Number | Infinity |
value |
Controlled value of counter | Number | undefined |
onValueChange |
Handle value changes. | Function | () => {} |
Example
console { <Counter step=5 defaultValue=25 onValueChange=thishandleValueChange /> }
Counter Themes
Theme structure:
container: <View /> button: <TouchableOpacity /> leftButton: <TouchableOpacity /> rightButton: <TouchableOpacity /> buttonText: <Text /> valueWrapper: <View /> value: <Text />
Preview
<Dash />
Component to draw customisable dashed lines
Dash Props
Name | Desc | Type | Default |
---|---|---|---|
style |
Dash container style as for View component |
Object | {flexDirection = 'row'} |
dashGap |
Gap between two dashes | Number | 3.5 |
dashLength |
Length of each dash | Number | 3 |
dashThickness |
Thickness of each dash | Number | 1 |
dashColor |
Color of each dash | String | #c7d1dc |
Example
const Example = <Dash dashGap=5 dashLength=10 dashThickness=2 dashColor="black" />
Preview
<Carousel />
Carousel component
Carousel Props
Name | Desc | Type | Default |
---|---|---|---|
spacer |
Space between last item and right side | Number | 0 |
...rest |
All other props for ScrollView component except horizontal |
- | - |
Carousel.Item Props
Name | Desc | Type | Default |
---|---|---|---|
active |
Show item as active | Boolean | false |
onPress |
Handle press action | Function | undefined |
onRemove |
Handle remove action | Function | undefined |
Example
const Example = <Carousel spacer=10> <CarouselItem active> <Text>Facebook</Text> </CarouselItem> <CarouselItem> <Text>Twitter</Text> </CarouselItem> <CarouselItem active> <Text>Instagram</Text> </CarouselItem> <CarouselItem> <Text>YouTube</Text> </CarouselItem> <CarouselItem active> <Text>Tumblr</Text> </CarouselItem> </Carousel>
Carousel Themes
theme structure:
container: <ScrollView />
<Carousel.Item /> theme structure:
container: onPress ? <TouchableOpacity /> : <View /> active: <View /> remove: <TouchableOpacity /> removeIcon: <Icon /> removeCircle: <View /> gap: <View />
Preview
<LabelRating />
LabelRating Props
Name | Desc | Type | Default |
---|---|---|---|
title |
[isRequired] Title of rating, which is shown on the left side | String | - |
rating |
Rating, which is shown on the right side | Number | 0 |
Example
const Example = <LabelRating title="WS" rating="92" />
LabelRating Themes
Theme structure:
container: <View /> titleWrapper: <View /> titleText: <Text /> ratingWrapper: <View /> ratingText: <Text />
Default themes: primary, success, warning, alert
Preview
<Label />
Label Props
Name | Desc | Type | Default |
---|---|---|---|
title |
[isRequired] Title of label | String | - |
Example
const Example = <View style= flexDirection: 'row' > <Label title="On Sale" /> </View>
Label Themes
Theme structure:
container: <View /> title: <Text />
Default themes: primary, success, warning, alert, black
Preview
<RangeSlider />
Multi handle slider with text labels
RangeSlider Props
Name | Desc | Type | Default |
---|---|---|---|
style |
RangeSlider container style as for View component |
Object | {flexDirection = 'row'} |
startValues |
Array of one or two numbers. Start values for slider handles positions. | Array of Numbers | [2, 8] |
sliderLength |
Length of slider | Number | 280 |
min |
The minimum acceptable value of slider | Number | 0 |
max |
The maximum acceptable value of slider | Number | 10 |
step |
Min step of dash scale | Number | 1 |
onValuesChangeStart |
Call when handle start motion | Function | - |
onValuesChange |
Calling while handle do motion | Function | - |
onValuesChangeEnd |
Call when handle end motion | Function | - |
customMarker |
Custom marker to slider handle | Function | - |
valueRenderer |
Function which change slider text if need. | Function | - |
Example
const Example = <RangeSlider min=10 max=100 step=5 values=25 75 valueRenderer= `$` />
RangeSlider Themes
Theme structure:
container: <View /> fullTrack: <View /> track: <View /> selectedTrack: <View /> valueContainer: <View /> twoMarkersValueContainer: <View /> valueWrapper: <View /> valueText: <Text /> markerContainer: <View /> topMarkerContainer: <View /> marker: <View /> pressedMarker: <View /> touch: <View />
Default themes: primary, success, warning, alert
Preview
<Expand />
Expand component
Expand Props
Name | Desc | Type | Default |
---|---|---|---|
title |
Always visible. | String | - |
description |
In close state cropped to one line. | String | - |
defaultExpanded |
Default state of component. If it true component will be rendered in open state | Bool | false |
icon |
Disclosure indicator for close state \n name - icon name for FontAwesome |
Object | { name: 'chevron-down', color: ThemeConstants.LIGHT_GRAY, size: 12 } |
expandedIcon |
Disclosure indicator for close state \n name - icon name for FontAwesome |
Object | { name: 'chevron-up', color: ThemeConstants.LIGHT_GRAY, size: 12 } |
children |
Child element will be shown only in open state | Node | - |
Example
<Expand title="Winemakers Notes:" description="The 2012 vintage in Napa Valley was about as close to ‘normal’ as it gets! "/>
Theme structure:
container: <View /> titleWrapper: <View /> descriptionWrapper: <View /> childrenWrapper: <View /> titleText: <Text /> descriptionText: <Text />
Preview
Utils
ThemeRegister
To customize components themes or add your own you can use ThemeRegister
manager:
ThemeRegister
UIExplorer
To open UIExplorer
just start mobile app with the react-native
command:
react-native run-ios# OR react-native run-android
How to add new UI component
For example let's create Button
component:
- Create a new directory called
Button
insrc
directory and create an entry file (index.js) and component file (Button.js) as given below.
// src/Button/Button.js static propTypes = title: PropTypesstringisRequired onPress: PropTypesfunc { return <RNButton title=thispropstitle onPress=thispropsonPress /> } // src/Button/index.js
- Update
src
entry file (index.js) to export our new component:
// src/index.js// ...
- Then write your example in
uiexplorer/examples
directory like this:
// uiexplorer/examples/Button.js register
-
Update
uiexplorer/examples
entry file (index.js) to export example for our new component:// uiexplorer/examples/index.js// ... -
Now you can open
UIExplorer
and click on<Button />
item to see a result.