MainContainerComponent renders a container with customizable dimensions, margins, and padding. The container's width and height adjust based on window size and specified fractions.

This component is responsive to window size changes, recalculating its dimensions dynamically and supporting customization of margins, padding, and background color.

import React from 'react';
import { MainContainerComponent } from 'mediasfu-reactnative-expo';

function App() {
return (
<MainContainerComponent
backgroundColor="lightblue"
containerWidthFraction={0.9}
containerHeightFraction={0.8}
marginLeft={10}
marginRight={10}
marginTop={20}
marginBottom={20}
padding={15}
>
<Text>Main Content</Text>
</MainContainerComponent>
);
}

export default App;

Properties

propTypes?: WeakValidationMap<MainContainerComponentOptions>

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

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'