1 | import React from 'react'
|
2 | import { observer, useBackPress } from 'startupjs'
|
3 | import { SafeAreaView, StatusBar } from 'react-native'
|
4 | import propTypes from 'prop-types'
|
5 | import { useHistory } from 'react-router-native'
|
6 | import config from './../../config/rootConfig'
|
7 | import './index.styl'
|
8 |
|
9 | function Layout ({ style, children }) {
|
10 | const history = useHistory()
|
11 |
|
12 | useBackPress((backHandler) => {
|
13 | if (!history.index) return
|
14 | history.goBack()
|
15 | return true
|
16 | })
|
17 |
|
18 | return pug`
|
19 | SafeAreaView.root(style=style)
|
20 | StatusBar(
|
21 | backgroundColor=config.colors.darkLighter
|
22 | barStyle='dark-content'
|
23 | )
|
24 | = children
|
25 | `
|
26 | }
|
27 |
|
28 | Layout.propTypes = {
|
29 | style: propTypes.oneOfType([propTypes.object, propTypes.array]),
|
30 | children: propTypes.node
|
31 | }
|
32 |
|
33 | export default observer(Layout)
|