Skip to content

Latest commit

 

History

History
executable file
·
142 lines (132 loc) · 4.62 KB

FABs.md

File metadata and controls

executable file
·
142 lines (132 loc) · 4.62 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, View, Button, Icon, Fab } from 'native-base';
export default class FABExample extends Component {
  constructor() {
    this.state = {
      active: 'true'
    };
  }
  render() {
    return (  
      <Container>
        <View style={{ flex: 1 }}>
          <Fab
            active={this.state.active}
            direction="up"
            containerStyle={{ }}
            style={{ backgroundColor: '#5067FF' }}
            position="bottomRight"
            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>
        </View>
      </Container>
    );
  }
}

Configuration

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

##fabs-multiple-headref

Multiple FABs

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

Syntax

import React, { Component } from 'react';
import { Container, View, Fab, Button, Icon } from 'native-base';
​export default class FABExample extends Component {
  constructor() {
    this.state = {
      active: 'true'
    };
  }
  render() {
    return (
      <Container>
        <View style={{ flex: 1 }}>
          <Fab
            active={this.state.active}
            direction="up"
            containerStyle={{ }}
            style={{ backgroundColor: '#5067FF' }}
            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>
    );
  }
}