1.0.4 • Published 6 years ago

react-native-allui v1.0.4

Weekly downloads
22
License
-
Repository
github
Last release
6 years ago

介绍

ReactNative UI框架

安装

npm install --save react-native-allui

连接

node_modules/react-native-allui/android/app/src/main/assets 目录完整拷贝到您的 android/app/src/main 下面

组件

工具条(ToolBar)

支持阴影、沉浸式、自定义背景、自定义图标、图标标签等内容

DefaultToolBar

import {DefaultToolBar, Icon} from "AllUI";
<DefaultToolBar
                title="Welcome"
                left={<Icon type="&#xeb0a;" size={28}/>}
                rightBadge={{text: "1"}}
                right={<Icon type="&#xea93;" size={28}/>}
                onPress={(type) => {
                    console.log(type)
                }}
/>

静态属性

namedescvalues
BUTTON_CLICK_TYPE点击事件返回类型LEFT (左侧菜单按钮)
BUTTON_CLICK_TYPERIGHT (右侧菜单按钮)

参数说明:

namedesctypemustdefault
height工具条高度number/string70
width工具条宽度number/string100%
shadow是否开启阴影booleanfalse
backgroundColor工具条背景颜色string#009688
immerse是否开启沉浸式booleanfalse
full是否全屏booleanfalse
titleAlign标题位置string(flex-start、center、flex-end)flex-start
title显示标题string
titleStyle标题样式Object{color: "#FFF", fontSize: 18, fontWeight: 'bold'}
left左侧内容string or <Text\/>
leftStyle左侧内容样式Object{color: "#FFF", fontSize: 18}
leftBadge左侧标签Object
right右侧标签string or <Text\/>
rightStyle右侧内容样式Object{color: "#FFF", fontSize: 18}
rightBadge右侧标签Object
onPress点击回调function(BUTTON_CLICK_TYPE)
margin左右最小边距number20

图标(Icon)

基本图标、表情等

Icon

import {Icon} from "AllUI";
<Icon type="&#xeb0a;" size={28}/>

图标列表

参数说明

namedesctypemustdefault
size图标大小number20
color图标颜色string
type图标类型(应参见图标列表)string
weight字重number/string

按钮(Button)

普通按钮,悬浮按钮等

Button

import {Button} from "AllUI";
<Button color="#009688" backgroundColor={null} width={null} onPress={() => {console.log("1");}}>GO TO GITHUB</Button>

静态属性

namedescvalues
BUTTON_TOUCHABLE_TYPE按钮触摸回馈类型WithoutFeedback (无效果)
BUTTON_TOUCHABLE_TYPEHighlight (高亮)
BUTTON_TOUCHABLE_TYPENativeFeedback (波浪)
BUTTON_TOUCHABLE_TYPEOpacity (透明度改变)

参数说明

namedesctypemustdefault
width按钮宽度number/string120
height按钮高度number/string50
backgroundColor背景颜色string#009688
color字体颜色string#FFF
fontSize字体大小number16
radius圆角大小number1
style自定义样式Object
touchableType按钮反馈效果BUTTON_TOUCHABLE_TYPEBUTTON_TOUCHABLE_TYPE.NativeFeedback
feedbackColor波浪效果反馈颜色(touchableType == BUTTON_TOUCHABLE_TYPE.NativeFeedback)string
onPress按钮点击回调Function
enable按钮是否可用booleanfalse
borderless无边界的动画(touchableType == BUTTON_TOUCHABLE_TYPE.NativeFeedback)booleantrueObject

卡片(Card)

内容卡片、定制卡片等

Card

import {Card,Mode,Button} from "AllUI";
<Card shadow={false} padding={0}>
    <View style={{height: 180}}>
        <Mode height={null} bottom={0} inner={
            <View style={{padding: 10}}>
                <Text style={{color: "#FFF", fontSize: 25}}>Welcome</Text>
                <Text style={{color: "#ddd"}}>React Native Android UI</Text>
            </View>
        }>
            <Image style={{flex: 1}} source={{
                uri: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1523896655165&di=a55604748d39bf8685894b0c5793f34e&imgtype=0&src=http%3A%2F%2Ff0.topitme.com%2F0%2F94%2F9a%2F11245229048229a940o.jpg"
            }}/>
        </Mode>
    </View>
    <View>
        <Text style={{padding: 10, color: "#aaaaaa"}}>
            Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions
            (width
            and height) of the image will be equal to or larger than the corresponding dimension of
            the
            view (minus padding).
        </Text>
        <View style={{alignItems: "flex-end", marginRight: 10}}>
            <Button color="#009688" backgroundColor={null} width={null} onPress={() => {
                console.log("1");
                this.setState({visible: !this.state.visible});
            }}>GO TO GITHUB</Button>
        </View>
    </View>
</Card>

参数说明

namedesctypemustdefault
padding内边距number20
margin外边距number5
borderWidth边框宽度,没有阴影时生效number1
borderColor边框颜色,没有阴影时生效string#eee
borderRadius圆角number3
backgroundColor背景颜色string#FFF
shadow阴影booleantrue
width宽度number/string
height高度number/string
style自定义样式Object

模态框(Mode)

遮罩层、模态框

Mode

import {Mode} from "AllUI";
<Mode height={null} bottom={0} inner={
    <View style={{padding: 10}}>
        <Text style={{color: "#FFF", fontSize: 25}}>Welcome</Text>
        <Text style={{color: "#ddd"}}>React Native Android UI</Text>
    </View>
}>
    <Image style={{flex: 1}} source={{
        uri: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1523896655165&di=a55604748d39bf8685894b0c5793f34e&imgtype=0&src=http%3A%2F%2Ff0.topitme.com%2F0%2F94%2F9a%2F11245229048229a940o.jpg"
    }}/>
</Mode>

参数说明

namedesctypemustdefault
width宽度number/string100%
height高度number/string100%
backgroundColor填充颜色string#000
opacity透明度number(0-1)0.3
top顶部距离number
left左边距离number
right右边距离number
bottom下面距离number
visible是否可见booleantrue
inner模态框中的组件Component
onPress模态框点击事件Function

标签(Badge)

标签、小红点、消息数目

Badge

import {Badge} from "AllUI";
<Badge>
    <Text>12345</Text>
</Badge>

参数说明

namedesctypemustdefault
backgroundColor背景颜色string#de4d3b
color内容颜色string#fff
top顶部距离number
left左边距离number
right右边距离number
bottom下面距离number
text标签文本string
size标签大小number12
poitDisplay当text为空时是否显示小红点booleanfalse
weighttext字重number/stringbold
style自定义样式Object

动画(Animation)

组件进入动画、组件更新动画

Animation

import {Animation} from "AllUI";
<Animation>
    ...Component
</Animation>

静态属性

namedescvalues
BUILT内置动画

参数说明

namedesctypemustdefault
duration动画持续时间number700
create创建时动画BUILTSpring
update更新时动画BUILTSpring

结尾