react-native-event-button

1.0.2 • Public • Published

react-native-event-button

A react native event button component to trigger custom event.

Installation

Run npm install react-native-event-button in your project directory.

Usage

This snippet would produce the output shown in the above gif

import React from 'react';
import { SafeAreaView, View, StyleSheet } from 'react-native';
import {EventButton} from 'react-native-event-button';

const Home = () => {
  return (
    <SafeAreaView style={styles.flex1}>
      <View style={styles.center}>
        <EventButton
          title={'welcome'}
          event={{
            eventType: 'button_press',
            eventName: 'welcome_button',
            eventData: { userID: 1 },
          }}
          onPress={() => alert('welcome press')} />
      </View>
    </SafeAreaView >
  );
};

const styles = StyleSheet.create({
  flex1: {
    flex: 1
  },
  center: {
    flex: 1,
    justifyContent: 'center', 
    alignItems: 'center' 
  }
});

export default Home;

Props

It accepts all the Button props and extra props you need to pass like event to trigger event.

Attributes Type Default Description
event Object {} Button Event information

Contributing

This is project is still in beta at the moment, but is still very basic, so if you want to work on the above mention tasks, or you find a bug just open a PR or an issue and ping me!

Package Sidebar

Install

npm i react-native-event-button

Weekly Downloads

2

Version

1.0.2

License

ISC

Unpacked Size

2.5 kB

Total Files

4

Last publish

Collaborators

  • himanshipatel