import {ReactNode} from 'react';
import {ScrollView, StyleProp, View, ViewStyle} from 'react-native';

interface MyScreenContainerProps {
  children: ReactNode;
  style?: StyleProp<ViewStyle>;
  scrollView?: boolean;
}

export function MyScreenContainer({
  children,
  style,
  scrollView,
}: MyScreenContainerProps) {
  const containerStyle = {
    backgroundColor: '#212137',
    flex: 1,
    paddingLeft: 20,
    paddingRight: 20,
  };

  if (scrollView) {
    return (
      <ScrollView style={containerStyle}>
        <View style={[style, !scrollView && containerStyle]}>{children}</View>
      </ScrollView>
    );
  }

  return <View style={[style, !scrollView && containerStyle]}>{children}</View>;
}
