Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import styled from '@emotion/native';
import { View } from 'react-native';

interface Props {
onPress: () => void;
Expand All @@ -13,10 +14,36 @@ const Touchable = styled.TouchableOpacity({
zIndex: 100,
});

const HideIcon = styled.Text(({ theme }) => ({
fontSize: 14,
color: theme.buttonTextColor || '#999999',
const HIDE_ICON_SIZE = 14;
const HIDE_ICON_BORDER_WIDTH = 1;
const Inner = styled.View(({ theme }) => ({
position: 'absolute',
top: 0,
left: 0,
width: HIDE_ICON_SIZE,
height: HIDE_ICON_SIZE,
borderRadius: HIDE_ICON_BORDER_WIDTH,
overflow: 'hidden',
borderColor: theme.buttonTextColor || '#999999',
borderWidth: HIDE_ICON_BORDER_WIDTH * 2,
}));
const Outer = styled.View({
position: 'absolute',
top: 0,
left: 0,
width: HIDE_ICON_SIZE,
height: HIDE_ICON_SIZE,
borderRadius: HIDE_ICON_BORDER_WIDTH,
overflow: 'hidden',
borderColor: 'white',
borderWidth: HIDE_ICON_BORDER_WIDTH,
});
const HideIcon = () => (
<View style={{ width: HIDE_ICON_SIZE, height: HIDE_ICON_SIZE, marginRight: 4 }}>
<Inner />
<Outer />
</View>
);

const VisibilityButton = ({ onPress }: Props) => (
<Touchable
Expand All @@ -25,7 +52,7 @@ const VisibilityButton = ({ onPress }: Props) => (
accessibilityLabel="Storybook.OnDeviceUI.toggleUI"
hitSlop={{ top: 5, left: 5, bottom: 5, right: 5 }}
>
<HideIcon>□</HideIcon>
<HideIcon />
</Touchable>
);
export default React.memo(VisibilityButton);