@ledgerhq/native-ui 0.7.8 → 0.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,20 @@
1
- import React from "react";
2
- import { Switch as NativeSwitch } from "react-native";
1
+ import React, { useCallback } from "react";
2
+ import { Pressable as BasePressable, Switch as NativeSwitch } from "react-native";
3
3
  import { useTheme } from "styled-components/native";
4
4
  import Text from "../../Text";
5
- import Flex from "../../Layout/Flex";
5
+ import proxyStyled from "../../../components/styled";
6
+ const Pressable = proxyStyled(BasePressable).attrs({
7
+ flexDirection: "row",
8
+ alignItems: "center",
9
+ }) ``;
6
10
  const Switch = ({ checked, onChange, disabled, label }) => {
7
11
  const { colors, space } = useTheme();
8
- return (React.createElement(Flex, { flexDirection: "row", alignItems: "center" },
12
+ const handlePress = useCallback(() => {
13
+ if (disabled)
14
+ return;
15
+ onChange && onChange(!checked);
16
+ }, [checked, disabled, onChange]);
17
+ return (React.createElement(Pressable, { onPress: handlePress },
9
18
  React.createElement(NativeSwitch, { trackColor: {
10
19
  false: colors.neutral.c50,
11
20
  true: colors.primary.c80,
@@ -18,6 +18,7 @@ import CloseMedium from "@ledgerhq/icons-ui/native/CloseMedium";
18
18
  import Text from "../../../Text";
19
19
  import { BoxedIcon } from "../../../Icon";
20
20
  import { Flex } from "../../index";
21
+ import { space } from "styled-system";
21
22
  const { width, height } = sizes;
22
23
  const Container = styled.View `
23
24
  background-color: ${(p) => p.theme.colors.background.main};
@@ -34,6 +35,12 @@ const CloseContainer = styled.View `
34
35
  align-items: flex-end;
35
36
  margin-bottom: ${(p) => p.theme.space[7]}px;
36
37
  `;
38
+ const ClosePressableExtendedBounds = styled.TouchableOpacity.attrs({
39
+ p: 5,
40
+ m: -5,
41
+ }) `
42
+ ${space};
43
+ `;
37
44
  const StyledTitle = styled(Text).attrs({ variant: "h2" }) `
38
45
  text-transform: uppercase;
39
46
  `;
@@ -70,7 +77,8 @@ export default function BaseModal(_a) {
70
77
  return (React.createElement(ReactNativeModal, Object.assign({}, rest, backDropProps, { isVisible: isOpen, deviceWidth: width, deviceHeight: height, useNativeDriver: true, useNativeDriverForBackdrop: true, hideModalContentWhileAnimating: true, onModalHide: onClose, style: [defaultModalStyle, modalStyle] }),
71
78
  React.createElement(Container, { style: containerStyle },
72
79
  !noCloseButton && (React.createElement(CloseContainer, null,
73
- React.createElement(Link, { Icon: CloseMedium, onPress: onClose }))),
80
+ React.createElement(ClosePressableExtendedBounds, { onPress: onClose },
81
+ React.createElement(Link, { Icon: CloseMedium, onPress: onClose })))),
74
82
  React.createElement(ModalHeader, { Icon: Icon, iconColor: iconColor, title: title, description: description, subtitle: subtitle }),
75
83
  React.createElement(ContentContainer, null, children))));
76
84
  }
@@ -5,6 +5,7 @@ import { TouchableOpacity } from "react-native";
5
5
  import Text from "../../Text";
6
6
  import CloseMedium from "@ledgerhq/icons-ui/native/CloseMedium";
7
7
  import { Flex } from "../../Layout";
8
+ import { space } from "styled-system";
8
9
  const NotificationContainer = styled.View `
9
10
  display: flex;
10
11
  width: 100%;
@@ -17,6 +18,12 @@ const NotificationContainer = styled.View `
17
18
  background-color: ${(p) => p.variant === "primary" ? p.theme.colors.primary.c90 : "transparent"};
18
19
  border-radius: ${(p) => `${p.theme.radii[1]}px`};
19
20
  `;
21
+ const ClosePressableExtendedBounds = styled.TouchableOpacity.attrs({
22
+ p: 5,
23
+ m: -5,
24
+ }) `
25
+ ${space};
26
+ `;
20
27
  export default function Notification({ Icon, iconColor, variant = "primary", numberOfLines, title, subtitle, onClose, linkText, onLinkPress, }) {
21
28
  const { colors } = useTheme();
22
29
  const textColor = variant === "primary" ? colors.neutral.c00 : colors.neutral.c100;
@@ -30,6 +37,6 @@ export default function Notification({ Icon, iconColor, variant = "primary", num
30
37
  React.createElement(TouchableOpacity, { onPress: onLinkPress },
31
38
  React.createElement(Text, { variant: "body", fontWeight: "semiBold", color: textColor }, linkText))))),
32
39
  onClose && (React.createElement(FlexBox, { marginLeft: "auto", pl: 16 },
33
- React.createElement(TouchableOpacity, { onPress: onClose },
40
+ React.createElement(ClosePressableExtendedBounds, { onPress: onClose },
34
41
  React.createElement(CloseMedium, { size: 14, color: textColor }))))));
35
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/native-ui",
3
- "version": "0.7.8",
3
+ "version": "0.7.9",
4
4
  "description": "Ledger Live - Desktop UI",
5
5
  "repository": "https://github.com/LedgerHQ/ui",
6
6
  "license": "MIT",