Skip to content

Latest commit

 

History

History
executable file
·
164 lines (154 loc) · 5.79 KB

FABs.md

File metadata and controls

executable file
·
164 lines (154 loc) · 5.79 KB

##fabs-def-headref

FABs

FABs (Floating Action Buttons) are used for a special type of promoted action. They are distinguished by a circled icon floating above the UI in a fixed position and have special motion behaviors. When clicked, it may contain more related actions.
Replacing Component: React Native <Animated>

Preview ios fabs-def-headref Preview android fabs-def-headref

Syntax

import React, { Component } from 'react';
import { Container, Content, Button, Icon, Fab } from 'native-base';
export default class FABExample extends Component {
    constructor() {
        this.state = {
            active: 'true'
        };
    }
      render() {
        return (  
                      <Container>
                <Content>
                    <Fab
                        active={this.state.active}
                        direction="right"
                        containerStyle={{ marginLeft: 10 }}
                        style={{ backgroundColor: '#5067FF' }}
                        position="topLeft"
                        onPress={() => this.setState({ active: !this.state.active })}>
                        <Icon name="share" />
                        <Button style={{ backgroundColor: '#34A34F' }}>
                            <Icon name="logo-whatsapp" />
                        </Button>
                        <Button style={{ backgroundColor: '#3B5998' }}>
                            <Icon name="logo-facebook" />
                        </Button>
                        <Button disabled style={{ backgroundColor: '#DD5144' }}>
                            <Icon name="mail" />
                        </Button>
                    </Fab>
                </Content>
            </Container>
        );
    }
}

Configuration

Property Default Option Description
active - true
false
Toggle status of FAB (initial status)
direction up up, down, left, right Direction of Buttons that popup on click of FAB.
containerStyle - user-defined Padding options to render FAB.
style - user-defined User defined styles.
position bottomRight topLeft, topRight
bottomLeft, bottomRight
Position of FAB on screen.
onPress - user-defined Toggle status of FAB (negated value of initial status)

##fabs-multiple-headref

Multiple FABs

Preview ios fabs-multiple-headref Preview android fabs-multiple-headref

Syntax

import React, { Component } from 'react';
import { Container, Content, Button, Icon, Fab, Text, View } from 'native-base';
​export default class FABExample extends Component {
    constructor() {
        this.state = {
            active: 'true'
        };
    }
    render() {
        return (
            <Container>
                <View>
                    <Fab
                        active={this.state.active}
                        direction="up"
                        containerStyle=�{ marginLeft: 10 }
                        position="bottomRight"
                        onPress={() => this.setState({ active: !this.state.active })}>
                      ....
                    </Fab>
                    <Fab direction="left" position="topRight">
                      ....
                    </Fab>
                    <Fab direction="down" position="topLeft">
                      ....
                    </Fab>
                    <Fab direction="right" position="bottomLeft">
                      ....
                    </Fab>
                </View>
            </Container>
        );
    }
}