0.1.7 • Published 9 years ago

react-native-md-dialog v0.1.7

Weekly downloads
37
License
-
Repository
github
Last release
9 years ago

React Native Material Design Dialog

Description

Make beautiful material design dialogs for both Android and IOS with lots of configurations to suit your need

Installation

$ npm install react-native-md-dialog --save

Try with Exponent

Exponent Button

Screenshots

One Button Dialog

AndroidIOS
npm.ionpm.io

Code

import Dialog, { 
    DialogButton 
} from 'react-native-md-dialog';

...

<Dialog actions={[<DialogButton text='CLOSE' onPress={() => this.refs.dialog.close()} position='right'/>]} ref='dialog'>
    <View style={styles.dialogConatiner}>
        <Text >
            I'm a dialog with a close button
        </Text>
    </View>
</Dialog>

Multiple Buttons Dialog

AndroidIOS
npm.ionpm.io

Code

import Dialog, { 
    DialogButton 
} from 'react-native-md-dialog';

...

<Dialog 
    actions={[
        <DialogButton text='INCREMENT' onPress={() => this.setState({ numberOfClicks: this.state.numberOfClicks + 1})}/>,
        <DialogButton text='OK' onPress={() => this.refs.dialog.close()}/>,
        <DialogButton text='DISABLED' disabled={true} position='left' />
    ]} 
    ref='dialog'>
    <View style={styles.dialogConatiner}>
        <Text >
            I'm a dialog with multiple btns, {this.state.numberOfClicks}
        </Text>
        </View>
</Dialog>

Styles Dialog

AndroidIOS
npm.ionpm.io

Code

import Dialog, { 
    DialogButton 
} from 'react-native-md-dialog';

...

<Dialog 
    backgroundColor='#3f51b5' 
    titleColor='#d81b60'
    actions={[
        <DialogButton text='DISABLED' disabled={true} position='left' color='#ffeb3b' />,            
        <DialogButton text='OK' onPress={() => this.refs.dialog.close()} color='#d81b60'/>
    ]} 
    ref='dialog'>
    <View style={styles.dialogConatiner}>
        <Text>Dialogs with custom styles</Text>
    </View>
</Dialog>

Scrollable Content Dialog

AndroidIOS
npm.ionpm.io

Code

import Dialog, { 
    DialogButton 
} from 'react-native-md-dialog';

...

<Dialog 
    actions={[
        <DialogButton text='DONE' onPress={() => this.refs.dialog.close()} />
    ]} 
    ref='dialog'
    maxHeight={280}>
    <ScrollView>
        <View style={styles.dialogConatiner}>
            <Text style={{ color: 'rgba(0,0,0,0.8)', fontSize: 16 }}>
                ...
            </Text>
        </View>
    </ScrollView>
</Dialog>

<Dialog/> props

PropDescriptionTypeDefault
actionsArray of <DialogButton/> componentsPropTypes.arrayNone
styleReact Native style objectPropTypes.object || PropTypes.arrayNone
titleDialog's tilte.PropTypes.stringDialog
titleColorColor of dialog's tilte.PropTypes.stringrgba(0,0,0,0.8)
backgroundColorDialog's background color.PropTypes.stringwhite
dismissableDetermines if clicking outside the dialog closes the dialog or not.PropTypes.boolfalse
animationDurationDuration of closing and opening the dialog.PropTypes.number200
widthDialog's width.PropTypes.numberdeviceWidth - 48
maxHeightDialog's max height.PropTypes.number420

<DialogButton/> props

PropDescriptionTypeDefault
textButton's textPropTypes.stringNone
disabledDetermines whether the button is enabled or notPropTypes.boolfalse
onPressDetermines the action when button is pressedPropTypes.funcNone
colorText color of the buttonPropTypes.string#009688
positionDetermines where to put the buttonPropTypes.stringright

Dialog's methods

NameDescription
open()Opens the dialog
close()Closes the dialog
0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago