1.0.2 • Published 2 years ago

react-native-event-button v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

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.

AttributesTypeDefaultDescription
eventObject{}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!