README
Dialog
Install
npm i --save react-native-dj-dialog
Usage
Using in your app will usually look like this:
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
import Dialog from 'react-native-dj-dialog';
export default class NPMTest extends Component {
testDialog(){
//测试一
// this.refs.dialog.show("确定删除吗");
// <Dialog ref="dialog" callback={()=>{alert('I am deleted!')}} isRnNav='true'/>
//测试二
this.refs.dialog.show("我们都可以自定义样式,\n你了解了吗?","我是左边按钮","我是右边按钮");
// <Dialog ref="dialog" callback={()=>{alert('I am deleted!')}} titleStyle={{fontSize: 14, color: "#333333", textAlign: 'center',lineHeight:20}} isRnNav='true'/>
}
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome} onPress={this.testDialog.bind(this)}>
TestDialog press me!
</Text>
<Dialog ref="dialog" callback={()=>{alert('I am deleted!')}} titleStyle={{fontSize: 14, color: "#333333", textAlign: 'center',lineHeight:20}} 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 |
titleStyle |
Object | Option | {} |
标题样式 |
leftStyle |
Object | Option | {} |
左边按钮样式 |
rightStyle |
Object | Option | {} |
右边按钮样式 |
callback |
function | Required | ()=>{} |
右边按钮点击回调函数 |
Methods
The following methods can be used to open and close the Dialog:
Method | Parameters | Note |
---|---|---|
show |
title: 标题、left:左边按钮文案、right:右边按钮文案 |
调起控件. |