0.1.2 • Published 5 years ago

react-native-master-ui v0.1.2

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

react-native-master-ui

UI for using in your react native projects (Android and IOS).

Install

npm i react-native-master-ui

or

yarn add react-native-master-ui

Then

npm i react-native-vector-icons
react-native link

or

yarn add react-native-vector-icons
react-native link

Simple Usage

import React, {Component} from 'react';
import {View,} from 'react-native';
import {CardView, ListItem, Accordion, StarsRate, Button} from 'react-native-master-ui'

export default class App extends Component {
    
    render() {
        return (
            <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
                <Button title={'Sample Button'}/>
            </View>
        )
    }
}

Accordion

Accordion Props

PropTypeDefaultDescription
titlestringnullTitle of the accordion.
titleStyleobject{}Add your custom style for the title.
headerStyleobject{}Add your custom style for the header.
containerStyleobject{}You can change style accordion.
isRtlbooleanfalseFor the languges are right to left (like: farsi,arabic).
isCardbooleanfalseYou have two style of accordion (flat,card) .
iconColorstring"gray"Color of arrow icon.

Example

import React, {Component} from 'react';
import {View,} from 'react-native';
import {Accordion} from 'react-native-master-ui'

export default class App extends Component {

    render() {
        return (
            <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
                <Accordion
                    title={"Headline"}
                    titleStyle={{
                        color: 'red'
                    }}
                    headerStyle={{
                        backgroundColor: 'blue'
                    }}
                    containerStyle={{
                        marginTop: 20
                    }}
                    iconColor={"red"}
                    isCard={true}
                    isRtl={false}
                >
                    <View>
                        .... whatever can be here
                    </View>
                </Accordion>
            </View>
        )
    }
}

Buttons

Button Props

PropTypeDefaultDescription
onPressfunction()undefineThe job you want to happen after click.
titlestringnullTitle on the Button.
textStyleobject{}Add your custom style for title.
statusstringnullCan be one of: "info","info2","success","warning","danger","aqua"
styleobject{}Add your custom style for button.
isLinearisLinearfalseShow button with border and opacity background color.
disablebooleanfalseButton not working when click if disable is true.
isLoadingbooleanfalseIt shows an indicator instead of title until it's true.
indicatorColorstring"white"Color of indicator.

Example

import React, {Component} from 'react';
import {View,} from 'react-native';
import {Button} from 'react-native-master-ui'

export default class App extends Component {

    render() {
        return (
            <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
                <Button
                    onPress={() => alert("Clicked!")}
                    title={'Sample Button'}
                    textStyle={{fontSize: 16}}
                    status={"info"} /// "info","info2","success","warning","danger"
                    style={{
                        marginTop: 5
                    }}
                    isLinear={true}
                    disable={false}
                    isLoading={false}
                    indicatorColor={"black"}
                />
            </View>
        )
    }
}

CardView

CardView Props

PropTypeDefaultDescription
onPressfunction()undefineThe job you want to happen after click on card. (Do'nt use this props if you're card is not clickable!)
avatarImagestringnullThe image top of card. (Does not show if not used)
avatarImageStyleobject{}Add your custom style for avatar image.
avatarTitlestringnullLike names or user name ... . (Does not show if not used)
avatarTitleStyleobject{}Add your custom style for avatar title.
imagestringnullThe image you want to show. (Does not show if not used)
imageStyleobject{}Add your custom style for image.
resizeModestringnullChange the resize mode of image for custom purpose.
titlestringnullTitle of what ever you want to show. (Does not show if not used)
titleStyleobject{}Add your custom style for title.
contentstringnullDescription of what ever you want to show. (Does not show if not used)
contentStyleobject{}Add your custom style for Description.
numberOfLinesnumbernullNumber of "content" line you want to show.
isFlatbooleanfalseThere is two style "Card" if it's false and "Flat" if it's true.
styleobject{}Add your custom style for CardView.
isRtlTextbooleanfalseFor the languges are right to left (like: farsi,arabic).
isRtlAvatarbooleanfalseFor the languges are right to left (like: farsi,arabic).

Example

import React, {Component} from 'react';
import {View,} from 'react-native';
import {CardView} from 'react-native-master-ui'

export default class App extends Component {

    render() {
        return (
            <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
                <CardView
                    onPress={() => alert('clicked!')}
                    avatarImage={{uri:'image link address'}}
                    avatarImageStyle={{width:20,height:20}}
                    avatarTitle={'UserName'}
                    avatarTitleStyle={{fontSize:10}}
                    image={{uri:'image link address'}}
                    imageStyle={{borderRadius: 5}}
                    resizeMode={'cover'}
                    title={"Title text"}
                    titleStyle={{fontFamily: 'my custom font'}}
                    content={'here is the description'}
                    contentStyle={{fontFamily: 'my custom font'}}
                    numberOfLines={2}
                    isFlat={false}
                    style={{backgroundColor: 'red'}}
                    isRtlText={false}
                    isRtlAvatar={false}
                >
                    <View>whatever can be here(like: buttons, links, texts...)</View>
                </CardView>
            </View>
        )
    }
}

ListItem

ListItem Props

PropTypeDefaultDescription
onPressfunction()undefineThe job you want to happen after click on card.(Do'nt use this props if you're card is not clickable!)
imagestringnullThe image you want to show.
imageStyleobject{}Add your custom style for image.
titlestringnullTitle of what ever you want to show.
titleStyleobject{}Add your custom style for title.
contentstringnullDescription of what ever you want to show.
contentStyleobject{}Add your custom style for Description.
numberOfLinesnumbernullNumber of "content" line you want to show.
isCardbooleanfalseThere is two style "Card" if it's true and "Flat" if it's false.
styleobject{}Add your custom style for ListItem.
isRtlbooleanfalseFor the languges are right to left (like: farsi,arabic).

Example

import React, {Component} from 'react';
import {View,} from 'react-native';
import {ListItem} from 'react-native-master-ui'

export default class App extends Component {

    render() {
        return (
            <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
                <ListItem
                    onPress={() => alert('clicked!')}
                    image={{uri:''}}
                    imageStyle={{
                        borderRadius:5
                    }}
                    title={"Title text"}
                    titleStyle={{
                        fontFamily:'my custom font'
                    }}
                    content={'here is the description'}
                    contentStyle={{
                        fontFamily:'my custom font'
                    }}
                    numberOfLines={2}
                    isCard={false}
                    style={{
                        backgroundColor:'red'
                    }}
                    isRtl={false}
                />
            </View>
        )
    }
}

StarRate

StarsRate Props

PropTypeDefaultDescription
onPressfunction()undefineIt will update the star count. if you don't want user able to change count of stars just remove this porps.
starSelectednumber0Count of selected stars.
starStyleobject{}Add your custom style for each star.
starColorstring"gold"Color of stars or hearts.
starSizenumber14Size of stars or hearts.
isHeartbooleanfalseFalse will show "Stars" and true will show "Hearts"

Example

import React, {Component} from 'react';
import {View,} from 'react-native';
import {StarsRate} from 'react-native-master-ui'

export default class App extends Component {

    constructor(props) {
        super(props)
        this.state = {
            starCount: 3
        }
    }

    render() {
        return (
            <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
                <StarsRate
                    onPress={(starCount) => this.setState({starCount})}
                    starSelected={this.state.starCount}
                    starStyle={{
                        margin: 10,
                        backgroundColor: 'white'
                    }}
                    starColor={'red'}
                    starSize={20}
                    isHeart={false}
                />
            </View>
        )
    }
}

MIT Licensed

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.6

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago