Media Button

January 17, 2023 Β· View on GitHub

MediaButton component comes withΒ custom animation and a customized pulse effect around the button.

🎬 Preview


MediaButton
alt tag

Default Usage


import React from 'react';
import { StyleSheet, View } from 'react-native';
import { MediaButton } from 'react-native-skia-catalog';

const MediaButtonScreen = () => (
  <View style={styles.container}>
    <MediaButton />
  </View>
);

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
});

export default MediaButtonScreen;

Custom Usage


import React from 'react';
import { View, StyleSheet } from 'react-native';
import { ButtonEnum, MediaButton } from 'react-native-skia-catalog';

const MediaButtonScreen = () => (
  <View style={styles.container}>
    <MediaButton
      buttonType={ButtonEnum.CIRCLE}
      size={200}
      pulseSpeed={2000}
      speed={1000}
      pulseStart={0.2}
      pulseEnd={0.7}
      color={'#FF5252'}
    />
  </View>
);

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
});

export default MediaButtonScreen;

🎬 Custom Usage Preview


alt tag

Properties

PropsDefaultTypeDescription
size110numberSize of Button.
color#E65100stringColor of Button.
speed800numberSpeed of icon rotation.
buttonType"CIRCLE""CIRCLE" / "RECTANGLE" / "SQUARE"Type of Button. Note: ButtonEnum can be used to specify the type. Ex. ButtonEnum.SQUARE.
style{}ViewStyleContainer style.
playImageSource-ImageSourcePropTypePlay image source path.
pauseImageSource-ImageSourcePropTypePause image source path.
onPlayPress() => {}functionPlay callback function that invoke on pressing play button.
onPausePress() => {}functionPause callback function that invoke on pressing pause button.
pulseStart0numberPulse starting scale value.
pulseEnd1numberPulse ending scale value.
pulseSpeed1800numberPulse effect speed.
pulseDisablefalsenumberIt disable pulse effect, if true value was passed. Note: In Rectangular Media Button Pulse is disabled.

NOTE: pulseStart & pulseEnd are scale values. Minimum scale value is zero. Maximum scale value is one. When value is 0, the pulse begins from the button. If pulseStart exceeds pulseEnd, the direction of the pulse will change.

🎬 Preview Example


Media Button