1.1.3 • Published 5 years ago

react-native-selfadapt-modal v1.1.3

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

react-native-selfadapt-modal

Getting started

$ npm install react-native-selfadapt-modal --save

Usage

Demo

ZedILq.gif

import SelfadaptModal from 'react-native-selfadapt-modal';

const TestData = [
    {id:10086,name:'Option 1(This is a long, long, long option.)'},
    {id:10087,name:'Option 2'},
    {id:10088,name:'Option 3'},
    {id:10089,name:'Option 4'},
];

render = () => {
    return (
        <SelfadaptModal 
            menuList={TestData} 
            containerStyle={styles.demeOneBtn}
            content={this.state.demoOneValue}
            onPress={(res)=>this.doSelect(res,'demoOneValue')}>
            <Text style={{fontSize:Size(14),color:'#fff'}}>{`click here`}</Text>
        </SelfadaptModal>
    );
}

const styles = StyleSheet.create({
    demeOneBtn: {
        padding: 10,
        borderRadius: 5,
        backgroundColor: '#58A0FF',
    },
});

更多示例见 DEMO

API

关于弹框

属性名称类型是否必须说明默认值备注
menuListarray下拉框选项列表数据源[]
labelstring用于显示的选项的labelname用于menuList的元素是对象的情况
contentstring默认选项
paddingWidthnumber按钮的padding高度0当使用LocationModal的按钮还有外层包裹时可能需要使用
privateMenuItemfunc自定义选项组件包含三个参数item,index,isSelect
modalStyleobjectmodal样式
flatListStyleobjectFlatList样式
activeMenuStyleobject选中单项选项容器样式
unActiveMenuStyleobject未选中单项选项容器样式
activeMenuTextStyleobject选中单项选项文本样式
unActiveMenuTextStyleobject未选中单项选项文本样式

关于按钮

属性名称类型是否必须说明默认值备注
childrenelement子元素
onPressfunc下拉选项点击事件
containerStyleobject按钮样式

更新日志

1.1.0

1.调整PropTypes类型,消除警告 2.修复列表元素靠右对齐时的显示异常 3.调整列表数据为空时,组件的处理方式

1.1.3

5 years ago

1.1.2

5 years ago

1.1.0

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago