Skip to content

Latest commit

 

History

History
executable file
·
82 lines (78 loc) · 2.61 KB

ActionButton.md

File metadata and controls

executable file
·
82 lines (78 loc) · 2.61 KB

Usage

...
import { ActionButton } from 'react-native-material-ui';
...
render() {
    <View>
        <ActionButton /> // default with icon (default icon is +)
        <ActionButton icon="done" /> // with done icon
    </View>
}

API

const propTypes = {
    /**
    * Array of names of icons (or elements) that will be shown after the main button is pressed
    * Remember, you should specify key for each element, if you use array of elements
    */
    actions: PropTypes.oneOfType([
        PropTypes.arrayOf(PropTypes.string),
        PropTypes.arrayOf(PropTypes.element),
        PropTypes.arrayOf(PropTypes.shape({
            icon: PropTypes.oneOfType([
                PropTypes.string,
                PropTypes.element,
            ]),
            label: PropTypes.string,
            name:  PropTypes.string,
        })),
    ]),
    /**
    * Called when button is pressed. Text is passed as param
    */
    onPress: PropTypes.func,
    /**
     * Called when button is long pressed. Text is passed as param
     */
    onLongPress: PropTypes.func,
    /**
     * Set true if you want to hide action button
     */
    hidden: PropTypes.bool,
    /**
     * If specified it'll be shown before text
     */
    icon: PropTypes.oneOfType([
        PropTypes.element,
        PropTypes.string
    ]),
    /**
    * Leave it empty if you don't want any transition after press. Otherwise, it will be transformed
    * to another view - depends on transition value.
    */
    transition: PropTypes.oneOf(['toolbar', 'speedDial']),
    /**
    * You can override any style for this button
    */
    style: PropTypes.shape({
        container: View.propTypes.style,
        icon: Text.propTypes.style,
        positionContainer: View.propTypes.style,
        // Toolbar styles
        toolbarContainer: View.propTypes.style,
        toolbarActionContainer: View.propTypes.style,
        // Speed Dial styles
        speedDialActionIcon: View.propTypes.style,
        speedDialActionLabel: Text.propTypes.style,
        speedDialActionLabelContainer: View.propTypes.style
    }),
};
TODO
  • Improve animations