2.0.0 • Published 1 year ago

react-native-scrollable-menu v2.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Horizontal Scrollable Menu

Horizontal Scrollable menu is a React native library for listing the horizontal menus .

Installation

Use the package manager to install the package.

npm install react-native-scrollable-menu

Usage

import React from "react";
import { HorizontalMenu } from 'HorizontalMenu';

export default function App() {

    const data = [{key : 'Bread'}, {key : 'Piza'}, {key : 'Burgers'}, {key : 'Cafe'}, {key : 'Salad'}, {key : 'Starters'}, {key: 'Vegetarian Curries'}, {key: 'Non Vegetarian'}]
    
    const menuItemSelected = (selectedItem) => {
        // Handle the action
    }
  
    return (
      <View style={{marginTop: 30}}>
        <HorizontalMenu 
          data={data}
          displayKey='key'
          borderRadius={5} 
          borderWidth={0}
          backgroundColor='#D3D3D3'
          borderColor='#5b5b5b'
          fontSize={15}
          selectedMenuColor="#22AF44"
          selectedMenuBorderColor="red"
          fontColor="#36454F"
          selectedMenuFontColor="#ffffff"
          menuSpacing={5}
          width={100}
          textAlign='center'
          onPress={(value) => menuItemSelected(value)}
        />
      </View>
    );
  }

Release Note 2.0.0

  • More props added so that developers can customize menu as per your needs. Please refer props table for more information.
  • Active menu highlight issue fixed.

Report bug fix

Please report the bugs to shinuvs2007@outlook.com

Props

Keyvalue
datapass the menu array of objects
displayKeyset which key you need to display from the object
borderRadiusset borderRadius 0 for square shape and set another value to round shaped menu
borderWidthset borderWidth to display default border
borderColorset borderColor to display default border color
selectedMenuBorderColorset selectedMenuBorderColor to change selected menu border color
selectedMenuColorset selectedMenuColor to change selected menu color
fontSizeset fontSize to adjust font size
widthset custom menu width using width props
heightset custom menu height using height props
menuSpacinguse menuSpacing props to set spacing between menus
textAlignuse textAlign props to set text align
onPressonPress function will return selected menu object

Demo

image

License

MIT