react-native-dj-alertselected
v1.0.15
Published
daojia react-native-dj-alertselected
Downloads
10
Readme
AlertSelected
Install
npm i --save react-native-dj-alertselected
Usage
Using an Accordion in your app will usually look like this:
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
import AlertSelected from 'react-native-dj-alertselected';
export default class NPMTest extends Component {
testAlertSelected(){
let array = ["男","女"];
/**
* 弹出控件,最多支持3个选项
* title: 标题
* entityList:选择项数据 数组
* field:操作字段
* parent:父对象
* callback:回调方法
*/
this.refs.as.show("选择性别", array,"sex",this,(field,i)=>{alert(array[i])});
}
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome} onPress={this.testAlertSelected.bind(this)}>
Welcome to React Native!
</Text>
{/*初始化组件*/}
<AlertSelected ref="as" isRnNav={true}/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
});
AppRegistry.registerComponent('xxx', () => NPMTest);
Props
The following props can be used to modify the style and/or behaviour:
| Prop | Type | Opt/Required | Default | Note |
|---|---|---|---|---|
|isRnNav
|Boolean|Required|false
|是否正在使用RN导航,默认为false.
Methods
The following methods can be used to open and close the accordion:
| Method | Parameters | Note |
|---|---|---|
|show
|title: 标题、entityList:选择项数据数组、field:操作字段、parent:父对象、callback:回调方法
|调起控件.