@ledgerhq/native-ui 0.15.0 → 0.15.1-next.0
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.
- package/lib/components/Cards/FullBackgroundCard/ColoredGradient.js +1 -1
- package/lib/components/Cards/FullBackgroundCard/index.js +1 -1
- package/lib/components/Cards/InformativeCard/index.d.ts +6 -5
- package/lib/components/Cards/InformativeCard/index.js +15 -9
- package/lib/components/Layout/Modals/BaseModal/index.d.ts +1 -1
- package/lib/components/Layout/Modals/BaseModal/index.js +10 -3
- package/lib/components/cta/Link/index.js +1 -1
- package/package.json +2 -2
|
@@ -31,6 +31,6 @@ const FullBackgroundCard = ({ variant, backgroundImage, tag, description, onPres
|
|
|
31
31
|
React.createElement(TouchableOpacity, { onPress: onDismiss, style: { top: -8, right: -8 } },
|
|
32
32
|
React.createElement(Flex, { bg: "neutral.c30", p: "6px", borderRadius: 24 },
|
|
33
33
|
React.createElement(Icon, { name: "Close", size: 12, color: "neutral.c100" })))),
|
|
34
|
-
description ? (React.createElement(Text, { variant: "h4", fontWeight: "semiBold", color: "neutral.c100", numberOfLines: 3, height: "
|
|
34
|
+
description ? (React.createElement(Text, { variant: "h4", fontWeight: "semiBold", color: "neutral.c100", numberOfLines: 3, height: "96px", lineHeight: "32.4px" }, highlight(description, "h4"))) : null))));
|
|
35
35
|
};
|
|
36
36
|
export default FullBackgroundCard;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { TouchableOpacityProps } from "react-native";
|
|
2
|
+
import { TouchableOpacityProps, ImageProps } from "react-native";
|
|
3
3
|
export type CardProps = TouchableOpacityProps & {
|
|
4
|
-
tag?:
|
|
5
|
-
title?:
|
|
4
|
+
tag?: React.ReactNode;
|
|
5
|
+
title?: React.ReactNode;
|
|
6
6
|
imageUrl?: string;
|
|
7
7
|
onClickCard?: () => void;
|
|
8
|
+
imageProps?: Partial<ImageProps>;
|
|
8
9
|
};
|
|
9
|
-
declare const
|
|
10
|
-
export default
|
|
10
|
+
declare const _default: React.MemoExoticComponent<(props: CardProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>>;
|
|
11
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { TouchableOpacity, Image } from "react-native";
|
|
1
|
+
import React, { memo } from "react";
|
|
2
|
+
import { TouchableOpacity, Image, StyleSheet, } from "react-native";
|
|
3
3
|
import styled from "styled-components/native";
|
|
4
4
|
import Text from "../../Text";
|
|
5
5
|
import Flex from "../../Layout/Flex";
|
|
@@ -7,19 +7,25 @@ const Base = styled(TouchableOpacity) ``;
|
|
|
7
7
|
const ImageContent = styled(Image) `
|
|
8
8
|
border-radius: 8px;
|
|
9
9
|
`;
|
|
10
|
+
const styles = StyleSheet.create({
|
|
11
|
+
image: {
|
|
12
|
+
flex: 1,
|
|
13
|
+
backgroundColor: "#fff",
|
|
14
|
+
width: "100%",
|
|
15
|
+
},
|
|
16
|
+
});
|
|
10
17
|
const CardContainer = (props) => {
|
|
11
|
-
const { imageUrl, title, tag } = props;
|
|
18
|
+
const { imageUrl, title, tag, imageProps } = props;
|
|
12
19
|
return (React.createElement(Flex, { flexDirection: "row" },
|
|
13
|
-
React.createElement(Flex, { justifyContent: "space-between", alignItems: "flex-start", py: 2, pr: 4, flex: 1 },
|
|
20
|
+
React.createElement(Flex, { justifyContent: "space-between", alignItems: "flex-start", py: 2, pr: imageUrl ? 4 : 2, flex: 1 },
|
|
14
21
|
React.createElement(Text, { variant: "body", fontWeight: "medium", color: "neutral.c100", numberOfLines: 2 }, title),
|
|
15
22
|
React.createElement(Text, { variant: "paragraph", fontWeight: "medium", color: "neutral.c70", numberOfLines: 1, mt: 4 }, tag)),
|
|
16
|
-
React.createElement(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, style: { width: "100%", height: "100%" } }))));
|
|
23
|
+
imageUrl && (React.createElement(ImageContent, Object.assign({ source: {
|
|
24
|
+
uri: imageUrl,
|
|
25
|
+
}, style: styles.image }, imageProps)))));
|
|
20
26
|
};
|
|
21
27
|
const InformativeCard = (props) => {
|
|
22
28
|
return (React.createElement(Base, Object.assign({}, props, { activeOpacity: 0.5, onPress: props.onClickCard }),
|
|
23
29
|
React.createElement(CardContainer, Object.assign({}, props))));
|
|
24
30
|
};
|
|
25
|
-
export default InformativeCard;
|
|
31
|
+
export default memo(InformativeCard);
|
|
@@ -19,4 +19,4 @@ export type BaseModalProps = {
|
|
|
19
19
|
} & Partial<ModalProps>;
|
|
20
20
|
export declare function ModalHeader({ Icon, iconColor, title, description, subtitle, }: Pick<BaseModalProps, "Icon" | "iconColor" | "title" | "description" | "subtitle">): React.ReactElement | null;
|
|
21
21
|
export declare function ModalHeaderCloseButton({ onClose, }: Pick<BaseModalProps, "onClose">): React.ReactElement;
|
|
22
|
-
export default function BaseModal({ isOpen, onClose, noCloseButton, safeContainerStyle, containerStyle, modalStyle, preventBackdropClick, Icon, iconColor, title, description, subtitle, children, ...rest }: BaseModalProps): React.ReactElement;
|
|
22
|
+
export default function BaseModal({ isOpen, onClose, noCloseButton, safeContainerStyle, containerStyle, modalStyle, preventBackdropClick, Icon, iconColor, title, description, subtitle, children, onModalHide, ...rest }: BaseModalProps): React.ReactElement;
|
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import React from "react";
|
|
12
|
+
import React, { useCallback } from "react";
|
|
13
13
|
import ReactNativeModal from "react-native-modal";
|
|
14
14
|
import styled from "styled-components/native";
|
|
15
15
|
import sizes from "../../../../helpers/getDeviceSize";
|
|
@@ -74,7 +74,7 @@ export function ModalHeaderCloseButton({ onClose, }) {
|
|
|
74
74
|
React.createElement(Icons.CloseMedium, { color: "neutral.c100", size: "20px" }))));
|
|
75
75
|
}
|
|
76
76
|
export default function BaseModal(_a) {
|
|
77
|
-
var { isOpen, onClose = () => { }, noCloseButton, safeContainerStyle = {}, containerStyle = {}, modalStyle = {}, preventBackdropClick, Icon, iconColor, title, description, subtitle, children } = _a, rest = __rest(_a, ["isOpen", "onClose", "noCloseButton", "safeContainerStyle", "containerStyle", "modalStyle", "preventBackdropClick", "Icon", "iconColor", "title", "description", "subtitle", "children"]);
|
|
77
|
+
var { isOpen, onClose = () => { }, noCloseButton, safeContainerStyle = {}, containerStyle = {}, modalStyle = {}, preventBackdropClick, Icon, iconColor, title, description, subtitle, children, onModalHide } = _a, rest = __rest(_a, ["isOpen", "onClose", "noCloseButton", "safeContainerStyle", "containerStyle", "modalStyle", "preventBackdropClick", "Icon", "iconColor", "title", "description", "subtitle", "children", "onModalHide"]);
|
|
78
78
|
const backDropProps = preventBackdropClick
|
|
79
79
|
? {}
|
|
80
80
|
: {
|
|
@@ -82,7 +82,14 @@ export default function BaseModal(_a) {
|
|
|
82
82
|
onBackButtonPress: onClose,
|
|
83
83
|
onSwipeComplete: onClose,
|
|
84
84
|
};
|
|
85
|
-
|
|
85
|
+
// Workaround: until this, onModalHide={onClose}, making onClose being called twice and onModalHide being never called
|
|
86
|
+
// The real fix would be to have onModalHide={onModalHide} and make sure every usage on onClose in the consumers of this component
|
|
87
|
+
// expect the correct behavior
|
|
88
|
+
const onModalHideWithClose = useCallback(() => {
|
|
89
|
+
onClose();
|
|
90
|
+
onModalHide && onModalHide();
|
|
91
|
+
}, [onClose, onModalHide]);
|
|
92
|
+
return (React.createElement(ReactNativeModal, Object.assign({}, backDropProps, rest, { isVisible: isOpen, deviceWidth: width, deviceHeight: height, useNativeDriver: true, useNativeDriverForBackdrop: true, hideModalContentWhileAnimating: true, onModalHide: onModalHideWithClose, style: [defaultModalStyle, modalStyle] }),
|
|
86
93
|
React.createElement(SafeContainer, { style: safeContainerStyle },
|
|
87
94
|
React.createElement(Container, { style: containerStyle },
|
|
88
95
|
!noCloseButton && React.createElement(ModalHeaderCloseButton, { onClose: onClose }),
|
|
@@ -5,7 +5,7 @@ import Text from "../../Text";
|
|
|
5
5
|
import { getLinkColors } from "./getLinkStyle";
|
|
6
6
|
import { ctaIconSize, ctaTextType } from "../getCtaStyle";
|
|
7
7
|
const IconContainer = styled.View `
|
|
8
|
-
${(p) => p.iconLink ? "" : p.iconPosition === "left" ? `margin-right:
|
|
8
|
+
${(p) => p.iconLink ? "" : p.iconPosition === "left" ? `margin-right: 4px;` : `margin-left: 4px;`}
|
|
9
9
|
`;
|
|
10
10
|
export const Base = styled(TouchableOpacity) `
|
|
11
11
|
flex-direction: row;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/native-ui",
|
|
3
|
-
"version": "0.15.0",
|
|
3
|
+
"version": "0.15.1-next.0",
|
|
4
4
|
"description": "Ledger Live - Mobile UI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"react-native-reanimated": "^2.8.0",
|
|
134
134
|
"react-native-web": "~0.17.5",
|
|
135
135
|
"regenerator-runtime": "^0.13.9",
|
|
136
|
-
"rimraf": "^
|
|
136
|
+
"rimraf": "^4.1.2",
|
|
137
137
|
"styled-components": "^5.3.3",
|
|
138
138
|
"stylelint": "^14.9.1",
|
|
139
139
|
"stylelint-config-recommended": "^8.0.0",
|