Function ControlButtonsComponentTouch

ControlButtonsComponentTouch is a React functional component that renders a customizable set of control buttons with flexible styling, positioning, and layout options.

This component supports various button configurations, including custom icons, background colors, and dynamic display settings. It can be positioned horizontally or vertically with alignment control.

import React from 'react';
import { ControlButtonsComponentTouch } from 'mediasfu-reactjs';
import { faPlay, faPause } from '@fortawesome/free-solid-svg-icons';

function App() {
const buttons = [
{
name: "Play",
icon: faPlay,
onPress: () => console.log("Play button pressed"),
backgroundColor: { default: "green" },
active: true,
},
{
name: "Pause",
icon: faPause,
onPress: () => console.log("Pause button pressed"),
backgroundColor: { default: "red" },
},
];

return (
<ControlButtonsComponentTouch
buttons={buttons}
position="left"
location="top"
direction="horizontal"
buttonsContainerStyle={{ padding: 10 }}
showAspect={true}
/>
);
}

export default App;

Properties

propTypes?: WeakValidationMap<ControlButtonsComponentTouchOptions>

Used to declare the types of the props accepted by the component. These types will be checked during rendering and in development only.

We recommend using TypeScript instead of checking prop types at runtime.

contextTypes?: ValidationMap<any>

Lets you specify which legacy context is consumed by this component.

defaultProps?: Partial<ControlButtonsComponentTouchOptions>

Used to define default values for the props accepted by the component.

type Props = { name?: string }

const MyComponent: FC<Props> = (props) => {
return <div>{props.name}</div>
}

MyComponent.defaultProps = {
name: 'John Doe'
}
displayName?: string

Used in debugging messages. You might want to set it explicitly if you want to display a different name for debugging purposes.


const MyComponent: FC = () => {
return <div>Hello!</div>
}

MyComponent.displayName = 'MyAwesomeComponent'