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-audio-player-button

v1.0.12

Published

A custom button with an icon for playing audio. It is able to play the audio without overlapping each other.

Downloads

4

Readme

React Native Audio Player Button is a custom button with an icon for playing audio. The user is able to use this button as many as they want on the same screen without having the issue of overlapping playing audio.

Support

iOS & Android

Installation

npm install react-native-audio-player-button

Installing dependencies

npm install react-native-vector-icons react-native-sound

Usage

import AudioPlayerButton from 'react-native-audio-player-button';
import FAIcon from 'react-native-vector-icons/FontAwesome';

//...
const [playingUuid, setPlayingUuid] = React.useState(null);

<AudioPlayerButton
  audio={require('sample.mp3')}
  itemUuid='abcdefg'
  isSpeakerIcon={true}
  rippled={true}
  iconPrimaryColor='#0088ff'
  iconSecondaryColor='#5da297'
  playingUuid={playingUuid}
  updatePlayingUuid={(uuid) => setPlayingUuid(uuid)}
  containerStyle={{marginTop: 16}}
  customIcon={<FAIcon/>}
  customIconSet={{play: 'play-circle', pause: 'pause-circle', mute: 'repeat'}}
/>

Properties

Basic

| Prop | Default | Type | Optional | Description | | :----------------- | :-----------: | :--------: | :--------: | :------------------------------------------------------------------------------------------- | | audio | null | .mp3 | false | The audio file that will be playing | | itemUuid | null | string | false | A unique uuid of the audio or the uuid of the button (to prevent playing audio overlap) | | playingUuid | null | string | false | The uuid of the audio that is currently playing | | isSpeakerIcon | false | boolean | true | If true, it will show a speaker icon. If false, it will show a normal play icon | | buttonColor | '#ffffff' | string | true | The color of the button | | buttonHeight | 48 or 56 | number | true | Height of the button | | buttonWidth | 48 or 56 | number | true | Width of the button | | rippled | false | boolean | true | If true, it will show a ripple animation while playing the audio | | rippleColor | '#000000' | string | true | Color of the ripple animation | | rippleHeight | 48 or 56 | number | true | The height of the ripple animation | | rippleWidth | 48 or 56 | number | true | The width of the ripple animation | | rippleRadius | 48 or 56 | number | true | The radius of the ripple animation (higher radius makes the ripple appear in a round shape) | | iconSize | 24 or 26 | number | true | The size of the icons (play and pause icon) | | iconPrimaryColor | '#000000' | string | true | The color of the icon before playing the audio | | iconSecondaryColor | '#808080' | string | true | The color of the icon while playing the audio | | playingUuid | '' | string | false | The uuid of the playing audio component (to prevent playing audio overlap each other) | | hasShadow | false | boolean | true | The shadow of the button (Android only) | | allowPause | false | boolean | true | Allow to pause the audio when toggle the button | | isFromAppBundle | false | boolean | false | Set to true to play the audio that is stored in the app bundle (ex: the downloaded audio) | | rippleScaleSize | 'medium' | string | true | The scale size of the ripple animation while the audio is playing |

  • The default width, height of the button and ripple animation will be 56dp and 48dp for the low pixel devices

Custom styles

| Prop | Default | Type | Optional | Description | | :-------------------------- | :-----------: | :-------: | :--------: | :------------------------------------------------------------------------- | | containerStyle | {...} | style | true | Style of the button and ripple animation container | | buttonStyle | {...} | style | true | Style of the button | | iconStyle | {...} | style | true | Style of the audio icons (play and pause icon) | | rippleStyle | {...} | style | true | Style of the ripple animation | | customNotPlayingIconStyle | {...} | style | true | Style of the audio icon when is not playing | | customPlayingIconStyle | {...} | style | true | Style of the audio icon while playing |

Custom components

| Prop | Default | Type | Optional | Description | | :---------------- | :-------------------------------: | :----: | :--------: | :--------------------------------------------------- | | customIcon | {...} | comp | true | Custom audio icon component | | customIconSet | {{play: '', pause: '', mute: ''}} | hash | true | A hash of the custom icon names |

Child components

<AudioPlayerButton {...props}>
  <child components/>
</AudioPlayerButton>
  • play: The icon that will be shown when the audio is not playing
  • pause: The icon that will be shown while the audio is playing
  • mute: The icon that will be shown when there is no audio file
  • Default icon types of the button:
    • Speaker icon use Ionicons
    • Normal play icon use Feather icons

Events

| Prop | Default | Type | Optional | Description | | :---------------- | :-------: | :-------: | :--------: | :------------------------------------------------------------------- | | updatePlayingUuid | {...} | event | false | On press the button, to update the uuid of the playing item | | onPress | {...} | event | true | Event when pressing the button |

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.


Made with create-react-native-library