@ledgerhq/native-ui 0.7.9 → 0.7.10
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,12 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { useCallback } from "react";
|
|
2
13
|
import styled from "styled-components/native";
|
|
3
14
|
import Input, { InputRenderLeftContainer } from "../BaseInput";
|
|
4
15
|
import SearchMedium from "@ledgerhq/icons-ui/native/SearchMedium";
|
|
16
|
+
import Button from "../../../cta/Button";
|
|
5
17
|
const Icon = styled(SearchMedium).attrs((p) => ({
|
|
6
18
|
color: p.theme.colors.neutral.c70,
|
|
7
19
|
})) ``;
|
|
8
|
-
function SearchInput(
|
|
9
|
-
|
|
10
|
-
|
|
20
|
+
function SearchInput(_a, ref) {
|
|
21
|
+
var { onChange, value } = _a, props = __rest(_a, ["onChange", "value"]);
|
|
22
|
+
const onClear = useCallback(() => {
|
|
23
|
+
if (onChange) {
|
|
24
|
+
onChange("");
|
|
25
|
+
}
|
|
26
|
+
}, [onChange]);
|
|
27
|
+
return (React.createElement(Input, Object.assign({ ref: ref, onChange: onChange, value: value }, props, { renderLeft: React.createElement(InputRenderLeftContainer, null,
|
|
28
|
+
React.createElement(Icon, null)), renderRight: value ? React.createElement(Button, { iconName: "Close", onPress: onClear }) : null })));
|
|
11
29
|
}
|
|
12
30
|
export default React.forwardRef(SearchInput);
|