Gathering detailed insights and metrics for react-native-floating-action-menu
Gathering detailed insights and metrics for react-native-floating-action-menu
Gathering detailed insights and metrics for react-native-floating-action-menu
Gathering detailed insights and metrics for react-native-floating-action-menu
Simple floating action menu for react-native
npm install react-native-floating-action-menu
Typescript
Module System
Node Version
NPM Version
TypeScript (70.04%)
JavaScript (29.96%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
28 Stars
74 Commits
4 Forks
2 Watchers
13 Branches
2 Contributors
Updated on Feb 14, 2025
Latest Version
2.0.0
Package Id
react-native-floating-action-menu@2.0.0
Unpacked Size
85.26 kB
Size
22.74 kB
File Count
24
NPM Version
9.6.7
Node Version
18.17.1
Published on
Jan 29, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
25
npm install --save react-native-floating-action-menu
1import { FloatingMenu } from 'react-native-floating-action-menu'; 2 3const items = [ 4 { label: 'Do a little dance' }, 5 { label: 'Make a lil love' }, 6 { label: 'Get down tonight' }, 7]; 8 9<FloatingMenu 10 items={items} 11 isOpen={this.state.isMenuOpen} 12 onMenuToggle={this.handleMenuToggle} 13 onItemPress={this.handleItemPress} 14/>
FloatingItem
Prop | description | type | required |
---|---|---|---|
label | Text to display alongside button | string | ✔︎ |
labelStyle | Style for the Text element | object | |
isPending | Will display ActivityIndicator in place of icon when isPending is true | boolean | |
isDisabled | Will disable the item when isDisabled is true | boolean | |
onPress | Callback function called when this item is pressed. This will override the default onItemPress callback given to FloatingMenu | function |
Example:
1{ 2 label: 'Hello world', 3 isPending: false, 4 isDisabled: false, 5 onPress: (item, index) => {}, // (optional, can also be handled via `onItemPress`) 6 // Anything else you want goes here 7}
Prop | description | type | default |
---|---|---|---|
items | Array of Item s (See above). Items are positioned by their order in this array and start closest to the menu button. | FloatingItem[] | [] |
isOpen | Control the menu open/closed state | boolean | false |
position | "top-left" | "top-right" | "bottom-left" | "bottom-right" | string | "bottom-right" |
top | Position in px away from top edge | number | 38 |
left | Position in px away from left edge | number | 38 |
right | Position in px away from right edge | number | 38 |
bottom | Position in px away from bottom edge | number | 38 |
primaryColor | Hex color string used for backgrounds, borders, and icons | string | "#213A77" |
backgroundUpColor | Override background color for menu and items UP state. Defaults to #ffffff . | string (hex) | - |
backgroundDownColor | Override background color for menu and items DOWN state. Defaults to primaryColor value. | string (hex) | - |
borderColor | Override border color for menu and items. Defaults to primaryColor value. | string (hex) | - |
iconColor | Override icon color for menu and items. Defaults to primaryColor value. | string (hex) | - |
buttonWidth | Width (and also height) of the button | number | 50 |
innerWidth | Width (and also height) of the inner element of the button | number | - |
dimmerStyle | Style the background dimmer element | object | - |
openEase | Easing function used for the opening animation (see js easing functions) | function |
|
closeEase | Easing function used for the closing animation (see js easing functions) | function | t => t _ t _ t |
renderMenuIcon | Function used to render the icon for menu button. Receives current menu state as an argument. (see below example) | function | - |
renderItemIcon | Function used to render the icon for the items. Receives item, index, and current menu state as arguments. (see below example) | function | - |
onMenuToggle | Callback function called when the menu has been toggled open or closed. Receives a boolean value | function | - |
onItemPress | Callback function called when a menu item has been pressed. Receives item and index. If an item specifies its own onPress function, it will take priority, and this function will be ignored | function | - |
Positions ![]() |
FontAwesome ![]() |
Colors ![]() |
List lengths ![]() |
1import React from 'react'; 2import { StyleSheet } from 'react-native'; 3import { FloatingMenu } from 'react-native-floating-action-menu'; 4 5const items = [ 6 { label: 'Do a little dance' }, 7 { label: 'Make a lil love' }, 8 { label: 'Get down tonight' }, 9]; 10 11class MyScreen extends React.Component { 12 state = { 13 isMenuOpen: false, 14 }; 15 16 handleMenuToggle = isMenuOpen => 17 this.setState({ isMenuOpen }); 18 19 handleItemPress = (item, index) => 20 console.log('pressed item', item); 21 22 render() { 23 return ( 24 <View style={styles.container}> 25 <FloatingMenu 26 isOpen={this.state.isMenuOpen} 27 items={items} 28 onMenuToggle={this.handleMenuToggle} 29 onItemPress={this.handleItemPress} 30 /> 31 </View> 32 ); 33 } 34}; 35 36const styles = StyleSheet.create({ 37 container: { 38 width: '100%', 39 height: '100%', 40 position: 'relative', 41 }, 42}); 43 44export default MyScreen; 45
1import { Image } from 'react-native'; 2import { FloatingMenu } from 'react-native-floating-action-menu'; 3import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome'; 4import { faBars, faTimes, faUserPlus } from '@fortawesome/free-solid-svg-icons'; 5 6// Specify data required to render the icon 7const items = [ 8 { 9 label: 'First is an icon', 10 fa: faUserPlus 11 }, 12 { 13 label: 'Second is an image', 14 image: require('../assets/img-0.png') 15 }, 16]; 17// Optional color to be silly 18const primaryColor = '#09f'; 19 20class MyScreen extends React.Component { 21 state = {}; 22 23 renderMenuIcon = (menuState) => { 24 const { menuButtonDown } = menuState; 25 26 return menuButtonDown 27 ? <Image source={require('./btn-down.png')} /> 28 : <Image source={require('./btn-up.png')} />; 29 } 30 31 renderItemIcon = (item, index, menuState) => { 32 const { itemsDown, dimmerActive } = menuState; 33 34 const isItemPressed = itemsDown[index]; 35 const color = isItemPressed ? '#fff' : primaryColor; 36 37 // Icons can be rendered however you like. 38 // Here are some examples, using data from the item object: 39 40 if (item.fa) { 41 return ( 42 <FontAwesomeIcon 43 icon={item.fa} 44 size={25} 45 color={color} 46 /> 47 ); 48 } 49 else if (item.image) { 50 return ( 51 <Image 52 source={item.image} 53 style={{ tintColor: color }} 54 resizeMode="contain" 55 /> 56 ); 57 } 58 59 return null; 60 }; 61 62 ... 63
git clone https://github.com/nicotroia/react-native-floating-action-menu
cd react-native-floating-action-menu/example
npm install
npm run ios
# or androidnpm pack
cd example
npm install ../react-native-floating-action-menu.tgz --save
npm run ios
# or androidMIT © 2019-2024 internet-nico
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 1/29 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
29 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More