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-native-telegraph

v2.1.3

Published

[![Test](https://github.com/robertherber/react-native-telegraph/actions/workflows/test.yml/badge.svg)](https://github.com/robertherber/react-native-telegraph/actions/workflows/test.yml) [![react-native-telegraph on NPM](https://img.shields.io/npm/v/react-

Downloads

40

Readme

react-native-telegraph!

Test react-native-telegraph on NPM

Example screen recording

This library aims to simplify in-app message orchestration in React-Native (iOS, Android and web supported). More specifically dealing with messages that makes sense to show across views and where multiple messages could appear to the user at once. It all revolves around three main types of messages:

Snackbars

You can choose whether you want multiple Snackbars to stack (default is showing one at a time, as recommended) and whether they should be persistent (default is a timeout of 5s). You can choose whether you want the Snackbars to appear on the bottom or top of the screen. You can easily override the animation with any of the ones available here, provide a custom Snackbar component to the <SnackbarProvider /> and send custom data to your custom component.

import { useSnackbar, useUpdateSnackbarInsets, useShowsnackbar } from 'react-native-telegraph';

// simply use useShowsnackbar

const showSnackbar = useShowsnackbar();

const onPressHandler = () => {
  showSnackbar('Something happened');
}

// if you want more control, there is useSnackbar
const [showSnackbar, hideSnackbar] = useSnackbar();

const onPress = useCallback(async () => {
  showSnackbar('Simple snack');
  const { buttonId, status } = await showSnackbar('Some new information is available', {
    persistent: true,
    actions: [{
      buttonId: 'reload',
      label: 'Reload'
    }, {
      buttonId: 'hide',
      label: 'Hide'
    }]
  }).response
}, [])


// Hide somewhere else in the code
const snackbarId = showSnackbar('lets hide this in another way');

// ...
hideSnackbar(snackbarId)

// control insets of the Snackbar in a specific view
useSetSnackbarInsetOffset({ bottom: 50 })

Snackbar

Dialogs (based on react-native-paper)

Dialogs take up the entire focus of the user - requesting action to continue. They'll always show up one at a time - but just as with the Banners and Snackbars - if more are presented they'll show when the user has interacted with the previous ones.

import { useDialog } from 'react-native-telegraph';

const [showDialog] = useDialog();

const onPress = useCallback(async () => {
  const { buttonId } = await showDialog('We need your approval to continue', {
    actions: [{
      buttonId: 'maybe-later',
      label: 'Maybe later'
    }, {
      buttonId: 'ok',
      label: 'OK'
    }]
  }).response

  console.log('You pressed button: ' + buttonId)
}, []);

Dialog

Provider

The easiest way to get started is to use a single TelegraphProvider wrapping your app. For more options and flexibility you could use and configure DialogProvider, SnackbarProvider and BannerProvider independently.

import { TelegraphProvider } from 'react-native-telegraph';


const App = ({ children }) => {
  return <TelegraphProvider>
    { children }
  </TelegraphProvider>
}

Customizability

Theming is applied automatically through react-native-paper (read more).

Made by Kingstinct AB