@ledgerhq/native-ui 0.20.7-nightly.0 → 0.21.0-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.
|
@@ -5,6 +5,7 @@ import { BaseStyledProps } from "../../styled";
|
|
|
5
5
|
import { IconType } from "../../Icon/type";
|
|
6
6
|
export type ButtonProps = TouchableOpacityProps & BaseStyledProps & {
|
|
7
7
|
Icon?: IconType;
|
|
8
|
+
onPressWhenDisabled?: TouchableOpacityProps["onPress"];
|
|
8
9
|
iconName?: string;
|
|
9
10
|
type?: "main" | "shade" | "error" | "color" | "default";
|
|
10
11
|
size?: "small" | "medium" | "large";
|
|
@@ -18,9 +18,17 @@ import baseStyled from "../../styled";
|
|
|
18
18
|
const IconContainer = styled.View `
|
|
19
19
|
${(p) => p.iconButton ? "" : p.iconPosition === "left" ? `margin-right: 10px;` : `margin-left: 10px;`}
|
|
20
20
|
`;
|
|
21
|
-
export const Base = baseStyled(TouchableOpacity).attrs((p) =>
|
|
22
|
-
//
|
|
23
|
-
|
|
21
|
+
export const Base = baseStyled(TouchableOpacity).attrs((p) => {
|
|
22
|
+
// if onPressWhenDisabled prop exists then the button will look
|
|
23
|
+
// disabled but will still be press-able.
|
|
24
|
+
const disabled = !p.onPressWhenDisabled && p.disabled;
|
|
25
|
+
const visuallyDisabled = p.onPressWhenDisabled && p.disabled;
|
|
26
|
+
const onPress = visuallyDisabled ? p.onPressWhenDisabled : p.onPress;
|
|
27
|
+
return Object.assign(Object.assign({}, getButtonColorStyle(p.theme.colors, p).button), {
|
|
28
|
+
// Avoid conflict with styled-system's size property by nulling size and renaming it
|
|
29
|
+
size: undefined, sizeVariant: p.size, disabled,
|
|
30
|
+
onPress });
|
|
31
|
+
}) `
|
|
24
32
|
|
|
25
33
|
border-radius: ${(p) => p.theme.space[10]}px;
|
|
26
34
|
padding: 0 ${(p) => p.theme.space[7]}px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/native-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0-next.0",
|
|
4
4
|
"description": "Ledger Live - Mobile UI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"moment": "^2.29.1",
|
|
43
43
|
"react-native-animatable": "^1.3.3",
|
|
44
44
|
"react-native-modal": "^13.0.0",
|
|
45
|
-
"react-native-svg": "13.
|
|
45
|
+
"react-native-svg": "^13.11.0",
|
|
46
46
|
"rn-range-slider": "2.1.1",
|
|
47
47
|
"styled-system": "^5.1.5",
|
|
48
48
|
"victory-native": "^35.5.5",
|
|
49
49
|
"@ledgerhq/crypto-icons-ui": "^0.5.1",
|
|
50
|
-
"@ledgerhq/icons-ui": "^0.6.0-
|
|
50
|
+
"@ledgerhq/icons-ui": "^0.6.0-next.0",
|
|
51
51
|
"@ledgerhq/ui-shared": "^0.2.1"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|