npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-message-router

v1.1.2

Published

React component that routes to messaging apps

Downloads

26

Readme

react-message-router

React component that routes to messaging apps such as iMessage, Whatsapp, and Facebook Messenger.

There are four react components:

  • TextMessage: Routes to the default messaging app on the device, such as iMessage in iOS
  • WhatsappMessage: Routes to Whatsapp
  • FacebookMessage: Routes to Facebook Messenger
  • FBMessengerShareLink: Routes to Facebook Messenger and accepts only URLs/Links to be shared

Demo

Live Demo

Installation

Using npm:

npm install --save react-message-router

Usage

import React from 'react';
import { TextMessage } from 'react-message-router';
import { WhatsappMessage } from 'react-message-router';
import { FacebookMessage } from 'react-message-router';
import { FBMessengerShareLink } from 'react-message-router';

class Example extends React.Component {

  render() {
    return (
      <div>

         <TextMessage
           label='Message Me!' // Required
           number='+15556667777'
           textBody='Hello! Want to join me for lunch today?'
           style={{fontSize: '20px'}}
         />

         <WhatsappMessage
           label='Whatsapp Me!' // Required
           number='+15556667777'
           textBody='Hello! Want to join me for lunch today?'
           style={{color: '#2CA25F'}}
         />

        <FacebookMessage
          label='Facebook Message Me!' // Required
          profileName='first.last.5'
          style={{textDecoration: 'none'}}
        />

        <FBMessengerShareLink
          label='FB Messenger Link Share!' // Required
          link='https://www.github.com'
          style={{textDecoration: 'none'}}
        />

      </div>
    )
  }
}

export default Example;

TextMessage

The TextMessage component accepts the following props

Name | Type | Req/Opt | Description --- | --- | --- | --- label | string | Required | Label to be displayed number | string | Optional | Number of the person to whom the text must be sent. You may include standard phone number characters such as + ( ) . and -. If you want the user to pick one or more recipients from his/her contact list, then do not pass this prop textBody | string | Optional | Body of the text message style | object | Optional | Override the inline-styles of the root element

The TextMessage component does the following

  • Opens the default messaging app on the device
  • Pre-fills the recipient's phone number, if the number prop is provided
  • Pre-fills the body of the text message, if the textBody prop is provided
  • The user may then hit Send to send the message

WhatsappMessage

The WhatsappMessage component accepts the following props

Name | Type | Req/Opt | Description --- | --- | --- | --- label | string | Required | Label to be displayed number | string | Optional | Number of the person to whom the text must be sent. You may include standard phone number characters such as + ( ) . and -. If you want the user to pick one or more recipients from his/her contact list, then do not pass this prop textBody | string | Optional | Body of the text message style | object | Optional | Override the inline-styles of the root element

The WhatsappMessage component does the following

  • Opens the Whatsapp messaging app on the device
  • If the number prop is provided, the recipient's phone number field is pre-filled. If the number prop is not provided, the user will be first asked to pick one or more recipients from the contact list
  • Pre-fills the body of the text message, if the textBody prop is provided
  • The user may then hit Send to send the message

FacebookMessage

The FacebookMessage component accepts the following props

Name | Type | Req/Opt | Description --- | --- | --- | --- label | string | Required | Label to be displayed profileName | string | Optional | Facebook profiles/pages have a profile name that is given to them by Facebook. Facebook URLs are in the format: https://www.facebook.com/first.last.5. The profileName in this example is first.last.5 style | object | Optional | Override the inline-styles of the root element

The FacebookMessage component does the following

  • Opens the Facebook Messenger app on the device
  • If the profileName prop is provided and is valid, the conversation between the user and the recipient will be started or shown (if the conversation has already started). If the profileName prop is not provided, then nothing else happens after the Messenger app is opened
  • The user may then write the text message and hit Send to send the message.

FBMessengerShareLink

The FBMessengerShareLink component accepts the following props

Name | Type | Req/Opt | Description --- | --- | --- | --- label | string | Required | Label to be displayed link | string | Optional | URL or link to be attached in the message style | object | Optional | Override the inline-styles of the root element

The FBMessengerShareLink component does the following

  • Opens the Facebook Messenger app on the device
  • If the link prop is provided, it will be attached to the message. If the link prop is not provided, then nothing else happens after the Messenger app is opened
  • The user may then write the text message to accompany the attached link
  • The user will be asked to pick one or more recipients from the contact list to send the message

License

MIT