Function MainScreenComponent

MainScreenComponent is a React functional component that dynamically adjusts the layout and dimensions of its child components based on props and the window size.

import React from 'react';
import { MainScreenComponent } from 'mediasfu-reactjs';

function App() {
return (
<MainScreenComponent
mainSize={70}
doStack={true}
containerWidthFraction={0.5}
containerHeightFraction={0.5}
updateComponentSizes={(sizes) => console.log('Component sizes:', sizes)}
defaultFraction={0.9}
showControls={true}
componentSizes={{ mainHeight: 100, otherHeight: 100, mainWidth: 100, otherWidth: 100 }}
>
<ChildComponent />
</MainScreenComponent>
);
}

export default App;

Properties

propTypes?: WeakValidationMap<MainScreenComponentOptions>

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<MainScreenComponentOptions>

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'