forked from GeekyAnts/NativeBase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request GeekyAnts#5598 from GeekyAnts/release/3.4.26
Release/3.4.26
- Loading branch information
Showing
20 changed files
with
185 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import React from 'react'; | ||
import { useTheme } from 'native-base'; | ||
import { Platform } from 'react-native'; | ||
import type { IHiddenProps } from './types'; | ||
import { useColorMode } from '../../../core/color-mode/hooks'; | ||
|
||
export const HiddenSSR = React.memo(({ children, ...props }: IHiddenProps) => { | ||
const theme = useTheme(); | ||
const breakPoints = Object.keys(theme.breakpoints); | ||
const currentColorMode = useColorMode(); | ||
|
||
const { from, till, only, colorMode, platform } = props; | ||
|
||
if (children === null) return null; | ||
if (!from && !till && !only && !colorMode && !platform) { | ||
return null; | ||
} else if ( | ||
(Array.isArray(platform) && platform.includes(Platform.OS)) || | ||
platform === Platform.OS | ||
) { | ||
return null; | ||
} else if (colorMode === currentColorMode.colorMode) { | ||
return null; | ||
} | ||
const display: any = {}; | ||
|
||
if (till) { | ||
let flag = false; | ||
for (const i in breakPoints) { | ||
if (breakPoints[i] === till) { | ||
display[breakPoints[i]] = 'flex'; | ||
flag = true; | ||
} else { | ||
display[breakPoints[i]] = flag ? 'flex' : 'none'; | ||
} | ||
} | ||
} | ||
|
||
if (from) { | ||
let flag = false; | ||
for (const i in breakPoints) { | ||
if (breakPoints[i] === from || flag) { | ||
display[breakPoints[i]] = 'none'; | ||
flag = true; | ||
} else { | ||
display[breakPoints[i]] = 'flex'; | ||
} | ||
} | ||
} | ||
if (only) { | ||
if (Array.isArray(only)) { | ||
for (const i in breakPoints) { | ||
if (only.includes(breakPoints[i])) { | ||
display[breakPoints[i]] = 'none'; | ||
} else { | ||
display[breakPoints[i]] = 'flex'; | ||
} | ||
} | ||
} else { | ||
display[only] = 'none'; | ||
} | ||
} | ||
|
||
return React.cloneElement(children, { | ||
display: display, | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.