Skip to content

Instantly share code, notes, and snippets.

@andreferi3
Created July 15, 2020 05:05
Show Gist options
  • Select an option

  • Save andreferi3/784a2c14e8667b78ebe281dbe04d617c to your computer and use it in GitHub Desktop.

Select an option

Save andreferi3/784a2c14e8667b78ebe281dbe04d617c to your computer and use it in GitHub Desktop.
import React from 'react'
import { View, StatusBar, ViewPropTypes, TouchableWithoutFeedback, Keyboard } from 'react-native'
import PropTypes from 'prop-types';
// * Components & Styling
import { Container, Content } from 'native-base';
import { GlobalStyles } from '../../public/styles/GlobalStyles';
import { onBoardData } from '../../public/constants/GlobalConstant';
import CActionBar from '../CActionBar';
const CWrapper = ({
children,
isScrolled,
backgroundColor,
safeAreaView,
hideStatusBar,
contentStyle,
contentContainerStyle,
onBoarding,
title,
goBack,
withHeader
}) => {
const Body = onBoarding ? View : Content
return (
<Container
style={[
safeAreaView && GlobalStyles.statusBarHeight,
{ backgroundColor }
]}>
{hideStatusBar && <StatusBar hidden />}
<Body
scrollEnabled={isScrolled ? true : false}
style={[{ flex: 1 }, contentStyle]}
contentContainerStyle={contentContainerStyle}>
{withHeader && <CActionBar {...{ title, goBack }} />}
{children}
</Body>
</Container>
)
}
CWrapper.propTypes = {
isScrolled: PropTypes.bool,
spacing: PropTypes.bool,
safeAreaView: PropTypes.bool,
hideStatusBar: PropTypes.bool,
contentStyle: ViewPropTypes.style,
contentContainerStyle: ViewPropTypes.style,
onBoarding: PropTypes.bool,
withHeader: PropTypes.bool,
backgroundColor: PropTypes.string
}
CWrapper.defaultProps = {
isScrolled: false,
spacing: false,
safeAreaView: false,
hideStatusBar: false,
onBoarding: false,
withHeader: false,
backgroundColor: '#ffffff'
}
export default CWrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment