1.1.3 • Published 4 months ago

react-native-scroll-menu v1.1.3

Weekly downloads
3
License
MIT
Repository
github
Last release
4 months ago

platforms npm npm

@sekizlipenguen/react-native-scroll-menu

React Native horizontal scrolling button menu.
This package has been moved to the @sekizlipenguen scope for better organization.


Installation

Install the package using npm or yarn:

npm install @sekizlipenguen/react-native-scroll-menu
yarn add @sekizlipenguen/react-native-scroll-menu

Example

Example
npm.io
npm.io

Usage

Here’s a simple example of how to use the @sekizlipenguen/react-native-scroll-menu:

Class Component Example

import React, { Component } from 'react';
import { View } from 'react-native';

// Import the component
import ScrollingButtonMenu from '@sekizlipenguen/react-native-scroll-menu';

export default class Example extends Component {
  render() {
    return (
      <ScrollingButtonMenu
        items={[
          { id: "1", name: 'Life' },
          { id: "2", name: 'Time' },
          { id: "3", name: 'Faith' },
          { id: "4", name: 'Cosmos' },
          { id: "5", name: 'Fall' },
        ]}
        onPress={(e) => console.log(e)}
        selected={"1"}
      />
    );
  }
}

Functional Component with Hook Example

import React, { useState } from 'react';
import { View, Text } from 'react-native';

// Import the component
import ScrollingButtonMenu from '@sekizlipenguen/react-native-scroll-menu';

const ExampleWithHook = () => {
  const [selectedItem, setSelectedItem] = useState("1");

  const handlePress = (item) => {
    console.log(item);
    setSelectedItem(item.id);
  };

  return (
    <View>
      <ScrollingButtonMenu
        items={[
          { id: "1", name: 'Life' },
          { id: "2", name: 'Time' },
          { id: "3", name: 'Faith' },
          { id: "4", name: 'Cosmos' },
          { id: "5", name: 'Fall' },
        ]}
        onPress={handlePress}
        selected={selectedItem}
      />
      <Text>Selected Item: {selectedItem}</Text>
    </View>
  );
};

export default ExampleWithHook;

Props

KeyTypeDescription
itemsArrayArray for button menu (required).
onPressFunction(menu)Function triggered on button press (required).
upperCaseBooleanConvert text to uppercase. Default: false.
selectedOpacityNumberOpacity when button is pressed. Default: 0.7.
containerStyleObjectStyle for the container.
contentContainerStyleObjectStyle for the content container.
scrollStyleObjectStyle for the scroll view.
textStyleObjectStyle for the text.
buttonStyleObjectStyle for the button.
activeButtonStyleObjectStyle for the active button.
firstButtonStyleObjectStyle for the first button.
lastButtonStyleObjectStyle for the last button.
activeTextStyleObjectStyle for the active text.
activeColorStringActive button text color. Default: "#ffffff".
activeBackgroundColorStringActive button background color. Default: "#ffffff".
selectedString or NumberSelected item id. Default: 1.
keyboardShouldPersistTapsStringDefault: "always".

Thank You!

We appreciate your support and feedback! If you encounter any issues, feel free to open an issue.

1.1.3

4 months ago

1.1.2

1 year ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.3

4 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago