1.0.8 • Published 1 year ago

react-native-audio-card-view v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

React Native Audio Card View is a card item with a title, a subtitle, and an audio player button.

Support

iOS & Android

Installation

npm install react-native-audio-card-view

Installing dependencies

npm install react-native-vector-icons react-native-sound react-native-audio-player-button

Usage

import AudioCardView from 'react-native-audio-card-view';
import FAIcon from 'react-native-vector-icons/FontAwesome';

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

<AudioCardView
  audio={require('testing_audio.mp3')}
  audioPosition='top-left'
  containerStyle={{marginTop: 10, height: 120, width: '100%'}}
  title="Card item title"
  subtitle="Card item subtitle"
  customIcon={<FAIcon/>}
  customIconSet={{play: 'play-circle', pause: 'pause-circle', mute: 'repeat'}}
  onPress={() => console.log('do something')}
/>

Properties

Basic

PropDefaultTypeOptionalDescription
uuidnullstringfalseA unique uuid of the audio or the uuid of the button (to prevent playing audio overlap)
titlenullstringfalseThe title of the card item (maximum 2 lines)
subtitlenullstringfalseThe subtitle of the card item (maximum 1 lines)
primaryColor'#000000'stringtrueThe color of the audio icon before playing the audio
secondaryColor'#808080'stringtrueThe color of the audio icon while playing the audio
audionull.mp3trueThe audio file for playing
playingUuidnullstringtrueThe uuid of the playing audio
disabledfalsebooleantrueThe disabled status of the card item
disabledColor'#CDCCCC'stringtrueThe background color of the card item when disabled
audioPosition'top-left'stringtrueThe position of the audio button ('top-left', 'left', 'right')
showDraggableIconfalsebooleantrueTo show the 3 dots icon to indicate the card is draggable
hideAudioPlayerfalsebooleantrueTo hide the audio player button
isFromAppBundlefalsebooleantrueSet to true to play the audio that is stored in the app bundle (ex: the downloaded audio)
allowFlexibleHeightfalsebooleantrueSet to true to make the card height flexible based on the length of the title

Custom styles

PropDefaultTypeOptionalDescription
containerStyle{...}styletrueStyle of the card item container
labelContainerStyle{...}styletrueStyle of the title and subtitle container
titleStyle{...}styletrueStyle of the title
subtitleStyle{...}styletrueStyle of the subtitle
audioButtonContainerStyle{...}styletrueStyle of the audio button container
audioButtonStyle{...}styletrueStyle of the audio button
audioIconStyle{...}styletrueStyle of the audio icon
audioRippleStyle{...}styletrueStyle of the audio ripple animation while playing
draggableIconContainerStyle{...}styletrueStyle of the draggable icon container
draggableIconStyle{...}styletrueStyle of the draggable icon
customNotPlayingIconStyle{...}styletrueStyle of the audio icon when is not playing
customPlayingIconStyle{...}styletrueStyle of the audio icon while playing

Custom components

PropDefaultTypeOptionalDescription
customAudioIcon{...}comptrueCustom audio icon component
customAudioIconSet{{play: '', pause: '', mute: ''}}hashtrueA hash of the custom icon names

Child component

<AudioCardView {...props}>
  <Text>Child component</Text>
</AudioCardView>

Events

PropDefaultTypeOptionalDescription
updatePlayingUuid{...}eventfalseOn press the button, to update the uuid of the playing item
onPress{...}eventtrueEvent when pressing the card item
onLongPress{...}eventtrueEvent when long pressing the card item

Contributing

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


Made with create-react-native-library

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago