1.1.0 • Published 5 years ago

react-native-modern-fab v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

react-native-modern-fab

react-native-modern-fab is a button component built with Typescript for React Native CLI and React Native Expo.

Screenshot

Installation

Use the package manager npm or yarn to install react-native-modern-fab.

npm i react-native-modern-fab

or

yarn add react-native-modern-fab

Post-installation (Dependencies)

You need to install react-native-gesture-handler to use react-native-modern-fab.

npm i react-native-gesture-handler

or

yarn add react-native-gesture-handler

Usage

import React, { useMemo } from 'react';
import {
  View,
  Image,
  Text
} from 'react-native';
import FAB from 'react-native-modern-fab';

import plusImg from './assets/plus.png';

const App = () => {
  const list = useMemo(()=>([
    {key: '1', component: <Text>Item 1</Text>},
    {key: '2', component: <Text>Item 2</Text>},
    {key: '3', component: <Text>Item 3</Text>},
    {key: '4', component: <Text>Item 4</Text>},
  ]),[]);

  return (
    <>
      <View style={{flex: 1}}>
        <Image source={backgroundImg} />
      </View>
      <FAB list={list} icon={<Image source={plusImg} />} />} />
    </>
  );
};

export default App;

Properties

PropDescriptionTypeRequiredDefault
listList of items to be shown.{ key: string; component: JSX.Element }[]trueNone
iconIcon inside the floating button.JSX.ElementfalseNone
backgroundColorBackground color that appears when you press the button.stringfalse#ffffffee
buttonColorfloating button color.stringfalse#ff8a62

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT