Skip to content

Latest commit

 

History

History
executable file
·
239 lines (226 loc) · 7.38 KB

FABs.md

File metadata and controls

executable file
·
239 lines (226 loc) · 7.38 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

{% 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(props) { super(props) this.state = { active: false }; } 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 })}> {% raw %}<Button style={{ backgroundColor: '#34A34F' }}>{% endraw %} {% raw %}<Button style={{ backgroundColor: '#3B5998' }}>{% endraw %} {% raw %}<Button disabled style={{ backgroundColor: '#DD5144' }}>{% endraw %} ); } } {%- language name="Vue Native", type="vue" -%}

<script> export default { data: function() { return { isFabIconActive: false, stylesObj: { fabContainer: { position: "bottomRight" } } }; }, methods: { handleFabIconPress: function() { this.isFabIconActive = !this.isFabIconActive; } } }; </script>

{%- 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


fabs-multiple-headref

Multiple FABs

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

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(props) { super(props) this.state = { active: false }; } 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/>.