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
Syntax
{% codetabs name="React Native", type="js" -%}
import React, { Component } from 'react';
import { Container, Header, View, Button, Icon, Fab } from 'native-base';
export default class FABExample extends Component {
constructor() {
this.state = {
active: 'true'
};
}
render() {
return (
{%- endcodetabs %}
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 |
Syntax
{% codetabs name="React Native", type="js" -%} import React, { Component } from 'react'; import { Container, Header, View, Fab, Button, Icon } from 'native-base'; export default class FABMultipleExample extends Component { constructor() { this.state = { active: 'true' }; } render() { return (
{% raw %}<View style={{ flex: 1 }}>{% endraw %} <Fab active={this.state.active} direction="up" {% raw %}containerStyle={{ }}{% endraw %} {% raw %}style={{ backgroundColor: '#5067FF' }}{% endraw %} position="bottomRight" onPress={() => this.setState({ active: !this.state.active })}> .... .... .... .... ); } } {%- language name="Vue Native", type="vue" -%} . . . . . . . . . . . . <script> export default { data: function() { return { isFabIconActive1: true, }; } }; </script>{%- endcodetabs %}
Note: Always prefer to place FAB inside NativeBase <Container/>. Placing FAB inside <Content/> is not encouraged, as <Content/> is an implementation of <ScrollView/>.



