Skip to content

Commit 668b22e

Browse files
committed
Update Hidden component
1 parent 2083693 commit 668b22e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Hidden/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react'
2+
import { View, ViewProps } from 'react-native'
23

34
import { useBreakpoint } from '../context'
45
import { isCurrentBreakpointBelow, isCurrentBreakpointAbove, Breakpoint } from '../utils'
@@ -7,10 +8,11 @@ export interface Props {
78
children: React.ReactNode
89
below?: Exclude<Breakpoint, 'mobile'>
910
above?: Exclude<Breakpoint, 'desktop'>
11+
style?: ViewProps['style']
1012
}
1113

12-
export const Hidden = (props: Props): JSX.Element | null => {
13-
const { children, below, above } = props
14+
export const Hidden = (props: Props) => {
15+
const { children, below, above, style } = props
1416
const { currentBreakpoint } = useBreakpoint()
1517

1618
if (typeof below === 'undefined' && typeof above === 'undefined') {
@@ -19,6 +21,6 @@ export const Hidden = (props: Props): JSX.Element | null => {
1921

2022
return isCurrentBreakpointBelow(currentBreakpoint, below) ||
2123
isCurrentBreakpointAbove(currentBreakpoint, above) ? null : (
22-
<>{children}</>
24+
<View style={style}>{children}</View>
2325
)
2426
}

0 commit comments

Comments
 (0)