import * as React from "react";
import {View, ViewProps, ViewStyle} from 'react-native';

export interface MaterialContainerProps extends ViewProps {
  toolbar?():React.ReactNode,
  isRoot?: boolean,
  children?:React.ReactNode,
  style?: ViewStyle
}

export default function MaterialContainer ({isRoot = false, children = null , toolbar= null, style={} }: MaterialContainerProps) {
  return <View style={{width: '100%', height: '100%', flex: 1, padding: isRoot ? 0 : 16, ...style}}>
    { isRoot &&
      <View style={{width: '100%'}}>
        {toolbar()}
      </View>
    }
    {children}
  </View>;
};
