@tamagui/focusable 1.0.1-beta.151 → 1.0.1-beta.152
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/dist/cjs/focusableInputHOC.js +45 -42
- package/dist/cjs/focusableInputHOC.js.map +2 -2
- package/dist/esm/focusableInputHOC.js +45 -39
- package/dist/esm/focusableInputHOC.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/jsx/focusableInputHOC.js +40 -35
- package/dist/jsx/focusableInputHOC.js.map +1 -1
- package/dist/jsx/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,60 +15,65 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
21
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
19
|
var focusableInputHOC_exports = {};
|
|
23
20
|
__export(focusableInputHOC_exports, {
|
|
24
21
|
focusableInputHOC: () => focusableInputHOC
|
|
25
22
|
});
|
|
26
23
|
module.exports = __toCommonJS(focusableInputHOC_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
25
|
var import_compose_refs = require("@tamagui/compose-refs");
|
|
28
26
|
var import_core = require("@tamagui/core");
|
|
29
|
-
var import_react =
|
|
27
|
+
var import_react = require("react");
|
|
30
28
|
var import_react2 = require("react");
|
|
31
29
|
var import_registerFocusable = require("./registerFocusable");
|
|
32
30
|
function focusableInputHOC(Component) {
|
|
33
|
-
return (0, import_react2.forwardRef)(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
31
|
+
return (0, import_react2.forwardRef)(
|
|
32
|
+
(props, ref) => {
|
|
33
|
+
const isInput = (0, import_core.isTamaguiComponent)(Component) && Component.staticConfig.isInput;
|
|
34
|
+
const inputValue = (0, import_react.useRef)(props.value || props.defaultValue || "");
|
|
35
|
+
const inputRef = (0, import_react2.useCallback)(
|
|
36
|
+
(input) => {
|
|
37
|
+
if (!props.id)
|
|
38
|
+
return;
|
|
39
|
+
if (!input)
|
|
40
|
+
return;
|
|
41
|
+
(0, import_registerFocusable.registerFocusable)(props.id, {
|
|
42
|
+
focus: input.focus,
|
|
43
|
+
...isInput && {
|
|
44
|
+
focusAndSelect() {
|
|
45
|
+
input.focus();
|
|
46
|
+
if (input.setSelection && typeof inputValue.current === "string") {
|
|
47
|
+
input.setSelection(0, inputValue.current.length);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
48
50
|
}
|
|
49
|
-
}
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
[props.id]
|
|
54
|
+
);
|
|
55
|
+
const combinedRefs = (0, import_compose_refs.composeRefs)(ref, inputRef);
|
|
56
|
+
(0, import_react2.useEffect)(() => {
|
|
57
|
+
if (!props.id)
|
|
58
|
+
return;
|
|
59
|
+
return () => {
|
|
60
|
+
(0, import_registerFocusable.unregisterFocusable)(props.id);
|
|
61
|
+
};
|
|
62
|
+
}, [props.id]);
|
|
63
|
+
const finalProps = isInput ? {
|
|
64
|
+
...props,
|
|
65
|
+
onChangeText(value) {
|
|
66
|
+
var _a;
|
|
67
|
+
inputValue.current = value;
|
|
68
|
+
(_a = props.onChangeText) == null ? void 0 : _a.call(props, value);
|
|
50
69
|
}
|
|
70
|
+
} : props;
|
|
71
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {
|
|
72
|
+
ref: combinedRefs,
|
|
73
|
+
...finalProps
|
|
51
74
|
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
(0, import_react2.useEffect)(() => {
|
|
55
|
-
if (!props.id)
|
|
56
|
-
return;
|
|
57
|
-
return () => {
|
|
58
|
-
(0, import_registerFocusable.unregisterFocusable)(props.id);
|
|
59
|
-
};
|
|
60
|
-
}, [props.id]);
|
|
61
|
-
const finalProps = isInput ? {
|
|
62
|
-
...props,
|
|
63
|
-
onChangeText(value) {
|
|
64
|
-
var _a;
|
|
65
|
-
inputValue.current = value;
|
|
66
|
-
(_a = props.onChangeText) == null ? void 0 : _a.call(props, value);
|
|
67
|
-
}
|
|
68
|
-
} : props;
|
|
69
|
-
return /* @__PURE__ */ import_react.default.createElement(Component, {
|
|
70
|
-
ref: combinedRefs,
|
|
71
|
-
...finalProps
|
|
72
|
-
});
|
|
73
|
-
});
|
|
75
|
+
}
|
|
76
|
+
);
|
|
74
77
|
}
|
|
75
78
|
// Annotate the CommonJS export names for ESM import in node:
|
|
76
79
|
0 && (module.exports = {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/focusableInputHOC.tsx"],
|
|
4
4
|
"sourcesContent": ["import { composeRefs } from '@tamagui/compose-refs'\nimport { isTamaguiComponent } from '@tamagui/core'\nimport React, { useRef } from 'react'\nimport { forwardRef, useCallback, useEffect } from 'react'\n\nimport { registerFocusable, unregisterFocusable } from './registerFocusable'\n\nexport function focusableInputHOC<A extends Function>(Component: A): A {\n return forwardRef(\n (\n props: {\n id?: string\n onChangeText?: (val: string) => void\n value?: string\n defaultValue?: string\n },\n ref\n ) => {\n const isInput = isTamaguiComponent(Component) && Component.staticConfig.isInput\n const inputValue = useRef(props.value || props.defaultValue || '')\n\n const inputRef = useCallback(\n (input) => {\n if (!props.id) return\n if (!input) return\n registerFocusable(props.id, {\n focus: input.focus,\n\n ...(isInput && {\n // react-native doesn't support programmatic .select()\n focusAndSelect() {\n input.focus()\n if (input.setSelection && typeof inputValue.current === 'string') {\n input.setSelection(0, inputValue.current.length)\n }\n },\n }),\n })\n },\n [props.id]\n )\n\n const combinedRefs = composeRefs(ref, inputRef)\n\n useEffect(() => {\n if (!props.id) return\n return () => {\n unregisterFocusable(props.id!)\n }\n }, [props.id])\n\n const finalProps = isInput\n ? {\n ...props,\n onChangeText(value) {\n inputValue.current = value\n props.onChangeText?.(value)\n },\n }\n : props\n\n return <Component ref={combinedRefs} {...finalProps} />\n }\n ) as any\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6Da;AA7Db,0BAA4B;AAC5B,kBAAmC;AACnC,mBAA8B;AAC9B,IAAAA,gBAAmD;AAEnD,+BAAuD;AAEhD,SAAS,kBAAsC,WAAiB;AACrE,aAAO;AAAA,IACL,CACE,OAMA,QACG;AACH,YAAM,cAAU,gCAAmB,SAAS,KAAK,UAAU,aAAa;AACxE,YAAM,iBAAa,qBAAO,MAAM,SAAS,MAAM,gBAAgB,EAAE;AAEjE,YAAM,eAAW;AAAA,QACf,CAAC,UAAU;AACT,cAAI,CAAC,MAAM;AAAI;AACf,cAAI,CAAC;AAAO;AACZ,0DAAkB,MAAM,IAAI;AAAA,YAC1B,OAAO,MAAM;AAAA,YAEb,GAAI,WAAW;AAAA,cAEb,iBAAiB;AACf,sBAAM,MAAM;AACZ,oBAAI,MAAM,gBAAgB,OAAO,WAAW,YAAY,UAAU;AAChE,wBAAM,aAAa,GAAG,WAAW,QAAQ,MAAM;AAAA,gBACjD;AAAA,cACF;AAAA,YACF;AAAA,UACF,CAAC;AAAA,QACH;AAAA,QACA,CAAC,MAAM,EAAE;AAAA,MACX;AAEA,YAAM,mBAAe,iCAAY,KAAK,QAAQ;AAE9C,mCAAU,MAAM;AACd,YAAI,CAAC,MAAM;AAAI;AACf,eAAO,MAAM;AACX,4DAAoB,MAAM,EAAG;AAAA,QAC/B;AAAA,MACF,GAAG,CAAC,MAAM,EAAE,CAAC;AAEb,YAAM,aAAa,UACf;AAAA,QACE,GAAG;AAAA,QACH,aAAa,OAAO;AAtDhC;AAuDc,qBAAW,UAAU;AACrB,sBAAM,iBAAN,+BAAqB;AAAA,QACvB;AAAA,MACF,IACA;AAEJ,aAAO,4CAAC;AAAA,QAAU,KAAK;AAAA,QAAe,GAAG;AAAA,OAAY;AAAA,IACvD;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["import_react"]
|
|
7
7
|
}
|
|
@@ -1,50 +1,56 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import { composeRefs } from "@tamagui/compose-refs";
|
|
2
3
|
import { isTamaguiComponent } from "@tamagui/core";
|
|
3
|
-
import
|
|
4
|
+
import { useRef } from "react";
|
|
4
5
|
import { forwardRef, useCallback, useEffect } from "react";
|
|
5
6
|
import { registerFocusable, unregisterFocusable } from "./registerFocusable";
|
|
6
7
|
function focusableInputHOC(Component) {
|
|
7
|
-
return forwardRef(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
return forwardRef(
|
|
9
|
+
(props, ref) => {
|
|
10
|
+
const isInput = isTamaguiComponent(Component) && Component.staticConfig.isInput;
|
|
11
|
+
const inputValue = useRef(props.value || props.defaultValue || "");
|
|
12
|
+
const inputRef = useCallback(
|
|
13
|
+
(input) => {
|
|
14
|
+
if (!props.id)
|
|
15
|
+
return;
|
|
16
|
+
if (!input)
|
|
17
|
+
return;
|
|
18
|
+
registerFocusable(props.id, {
|
|
19
|
+
focus: input.focus,
|
|
20
|
+
...isInput && {
|
|
21
|
+
focusAndSelect() {
|
|
22
|
+
input.focus();
|
|
23
|
+
if (input.setSelection && typeof inputValue.current === "string") {
|
|
24
|
+
input.setSelection(0, inputValue.current.length);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
22
27
|
}
|
|
23
|
-
}
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
[props.id]
|
|
31
|
+
);
|
|
32
|
+
const combinedRefs = composeRefs(ref, inputRef);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!props.id)
|
|
35
|
+
return;
|
|
36
|
+
return () => {
|
|
37
|
+
unregisterFocusable(props.id);
|
|
38
|
+
};
|
|
39
|
+
}, [props.id]);
|
|
40
|
+
const finalProps = isInput ? {
|
|
41
|
+
...props,
|
|
42
|
+
onChangeText(value) {
|
|
43
|
+
var _a;
|
|
44
|
+
inputValue.current = value;
|
|
45
|
+
(_a = props.onChangeText) == null ? void 0 : _a.call(props, value);
|
|
24
46
|
}
|
|
47
|
+
} : props;
|
|
48
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
49
|
+
ref: combinedRefs,
|
|
50
|
+
...finalProps
|
|
25
51
|
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
if (!props.id)
|
|
30
|
-
return;
|
|
31
|
-
return () => {
|
|
32
|
-
unregisterFocusable(props.id);
|
|
33
|
-
};
|
|
34
|
-
}, [props.id]);
|
|
35
|
-
const finalProps = isInput ? {
|
|
36
|
-
...props,
|
|
37
|
-
onChangeText(value) {
|
|
38
|
-
var _a;
|
|
39
|
-
inputValue.current = value;
|
|
40
|
-
(_a = props.onChangeText) == null ? void 0 : _a.call(props, value);
|
|
41
|
-
}
|
|
42
|
-
} : props;
|
|
43
|
-
return /* @__PURE__ */ React.createElement(Component, {
|
|
44
|
-
ref: combinedRefs,
|
|
45
|
-
...finalProps
|
|
46
|
-
});
|
|
47
|
-
});
|
|
52
|
+
}
|
|
53
|
+
);
|
|
48
54
|
}
|
|
49
55
|
export {
|
|
50
56
|
focusableInputHOC
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/focusableInputHOC.tsx"],
|
|
4
4
|
"sourcesContent": ["import { composeRefs } from '@tamagui/compose-refs'\nimport { isTamaguiComponent } from '@tamagui/core'\nimport React, { useRef } from 'react'\nimport { forwardRef, useCallback, useEffect } from 'react'\n\nimport { registerFocusable, unregisterFocusable } from './registerFocusable'\n\nexport function focusableInputHOC<A extends Function>(Component: A): A {\n return forwardRef(\n (\n props: {\n id?: string\n onChangeText?: (val: string) => void\n value?: string\n defaultValue?: string\n },\n ref\n ) => {\n const isInput = isTamaguiComponent(Component) && Component.staticConfig.isInput\n const inputValue = useRef(props.value || props.defaultValue || '')\n\n const inputRef = useCallback(\n (input) => {\n if (!props.id) return\n if (!input) return\n registerFocusable(props.id, {\n focus: input.focus,\n\n ...(isInput && {\n // react-native doesn't support programmatic .select()\n focusAndSelect() {\n input.focus()\n if (input.setSelection && typeof inputValue.current === 'string') {\n input.setSelection(0, inputValue.current.length)\n }\n },\n }),\n })\n },\n [props.id]\n )\n\n const combinedRefs = composeRefs(ref, inputRef)\n\n useEffect(() => {\n if (!props.id) return\n return () => {\n unregisterFocusable(props.id!)\n }\n }, [props.id])\n\n const finalProps = isInput\n ? {\n ...props,\n onChangeText(value) {\n inputValue.current = value\n props.onChangeText?.(value)\n },\n }\n : props\n\n return <Component ref={combinedRefs} {...finalProps} />\n }\n ) as any\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AA6Da;AA7Db,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AACnC,SAAgB,cAAc;AAC9B,SAAS,YAAY,aAAa,iBAAiB;AAEnD,SAAS,mBAAmB,2BAA2B;AAEhD,SAAS,kBAAsC,WAAiB;AACrE,SAAO;AAAA,IACL,CACE,OAMA,QACG;AACH,YAAM,UAAU,mBAAmB,SAAS,KAAK,UAAU,aAAa;AACxE,YAAM,aAAa,OAAO,MAAM,SAAS,MAAM,gBAAgB,EAAE;AAEjE,YAAM,WAAW;AAAA,QACf,CAAC,UAAU;AACT,cAAI,CAAC,MAAM;AAAI;AACf,cAAI,CAAC;AAAO;AACZ,4BAAkB,MAAM,IAAI;AAAA,YAC1B,OAAO,MAAM;AAAA,YAEb,GAAI,WAAW;AAAA,cAEb,iBAAiB;AACf,sBAAM,MAAM;AACZ,oBAAI,MAAM,gBAAgB,OAAO,WAAW,YAAY,UAAU;AAChE,wBAAM,aAAa,GAAG,WAAW,QAAQ,MAAM;AAAA,gBACjD;AAAA,cACF;AAAA,YACF;AAAA,UACF,CAAC;AAAA,QACH;AAAA,QACA,CAAC,MAAM,EAAE;AAAA,MACX;AAEA,YAAM,eAAe,YAAY,KAAK,QAAQ;AAE9C,gBAAU,MAAM;AACd,YAAI,CAAC,MAAM;AAAI;AACf,eAAO,MAAM;AACX,8BAAoB,MAAM,EAAG;AAAA,QAC/B;AAAA,MACF,GAAG,CAAC,MAAM,EAAE,CAAC;AAEb,YAAM,aAAa,UACf;AAAA,QACE,GAAG;AAAA,QACH,aAAa,OAAO;AAtDhC;AAuDc,qBAAW,UAAU;AACrB,sBAAM,iBAAN,+BAAqB;AAAA,QACvB;AAAA,MACF,IACA;AAEJ,aAAO,oBAAC;AAAA,QAAU,KAAK;AAAA,QAAe,GAAG;AAAA,OAAY;AAAA,IACvD;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["export * from './registerFocusable'\nexport * from './focusableInputHOC'\nexport * from './focusable'\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,43 +4,48 @@ import { useRef } from "react";
|
|
|
4
4
|
import { forwardRef, useCallback, useEffect } from "react";
|
|
5
5
|
import { registerFocusable, unregisterFocusable } from "./registerFocusable";
|
|
6
6
|
function focusableInputHOC(Component) {
|
|
7
|
-
return forwardRef(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
return forwardRef(
|
|
8
|
+
(props, ref) => {
|
|
9
|
+
const isInput = isTamaguiComponent(Component) && Component.staticConfig.isInput;
|
|
10
|
+
const inputValue = useRef(props.value || props.defaultValue || "");
|
|
11
|
+
const inputRef = useCallback(
|
|
12
|
+
(input) => {
|
|
13
|
+
if (!props.id)
|
|
14
|
+
return;
|
|
15
|
+
if (!input)
|
|
16
|
+
return;
|
|
17
|
+
registerFocusable(props.id, {
|
|
18
|
+
focus: input.focus,
|
|
19
|
+
...isInput && {
|
|
20
|
+
focusAndSelect() {
|
|
21
|
+
input.focus();
|
|
22
|
+
if (input.setSelection && typeof inputValue.current === "string") {
|
|
23
|
+
input.setSelection(0, inputValue.current.length);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
22
26
|
}
|
|
23
|
-
}
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
[props.id]
|
|
30
|
+
);
|
|
31
|
+
const combinedRefs = composeRefs(ref, inputRef);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!props.id)
|
|
34
|
+
return;
|
|
35
|
+
return () => {
|
|
36
|
+
unregisterFocusable(props.id);
|
|
37
|
+
};
|
|
38
|
+
}, [props.id]);
|
|
39
|
+
const finalProps = isInput ? {
|
|
40
|
+
...props,
|
|
41
|
+
onChangeText(value) {
|
|
42
|
+
inputValue.current = value;
|
|
43
|
+
props.onChangeText?.(value);
|
|
24
44
|
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (!props.id)
|
|
30
|
-
return;
|
|
31
|
-
return () => {
|
|
32
|
-
unregisterFocusable(props.id);
|
|
33
|
-
};
|
|
34
|
-
}, [props.id]);
|
|
35
|
-
const finalProps = isInput ? {
|
|
36
|
-
...props,
|
|
37
|
-
onChangeText(value) {
|
|
38
|
-
inputValue.current = value;
|
|
39
|
-
props.onChangeText?.(value);
|
|
40
|
-
}
|
|
41
|
-
} : props;
|
|
42
|
-
return <Component ref={combinedRefs} {...finalProps} />;
|
|
43
|
-
});
|
|
45
|
+
} : props;
|
|
46
|
+
return <Component ref={combinedRefs} {...finalProps} />;
|
|
47
|
+
}
|
|
48
|
+
);
|
|
44
49
|
}
|
|
45
50
|
export {
|
|
46
51
|
focusableInputHOC
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/focusableInputHOC.tsx"],
|
|
4
4
|
"sourcesContent": ["import { composeRefs } from '@tamagui/compose-refs'\nimport { isTamaguiComponent } from '@tamagui/core'\nimport React, { useRef } from 'react'\nimport { forwardRef, useCallback, useEffect } from 'react'\n\nimport { registerFocusable, unregisterFocusable } from './registerFocusable'\n\nexport function focusableInputHOC<A extends Function>(Component: A): A {\n return forwardRef(\n (\n props: {\n id?: string\n onChangeText?: (val: string) => void\n value?: string\n defaultValue?: string\n },\n ref\n ) => {\n const isInput = isTamaguiComponent(Component) && Component.staticConfig.isInput\n const inputValue = useRef(props.value || props.defaultValue || '')\n\n const inputRef = useCallback(\n (input) => {\n if (!props.id) return\n if (!input) return\n registerFocusable(props.id, {\n focus: input.focus,\n\n ...(isInput && {\n // react-native doesn't support programmatic .select()\n focusAndSelect() {\n input.focus()\n if (input.setSelection && typeof inputValue.current === 'string') {\n input.setSelection(0, inputValue.current.length)\n }\n },\n }),\n })\n },\n [props.id]\n )\n\n const combinedRefs = composeRefs(ref, inputRef)\n\n useEffect(() => {\n if (!props.id) return\n return () => {\n unregisterFocusable(props.id!)\n }\n }, [props.id])\n\n const finalProps = isInput\n ? {\n ...props,\n onChangeText(value) {\n inputValue.current = value\n props.onChangeText?.(value)\n },\n }\n : props\n\n return <Component ref={combinedRefs} {...finalProps} />\n }\n ) as any\n}\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
5
|
+
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AACnC,SAAgB,cAAc;AAC9B,SAAS,YAAY,aAAa,iBAAiB;AAEnD,SAAS,mBAAmB,2BAA2B;AAEhD,SAAS,kBAAsC,WAAiB;AACrE,SAAO;AAAA,IACL,CACE,OAMA,QACG;AACH,YAAM,UAAU,mBAAmB,SAAS,KAAK,UAAU,aAAa;AACxE,YAAM,aAAa,OAAO,MAAM,SAAS,MAAM,gBAAgB,EAAE;AAEjE,YAAM,WAAW;AAAA,QACf,CAAC,UAAU;AACT,cAAI,CAAC,MAAM;AAAI;AACf,cAAI,CAAC;AAAO;AACZ,4BAAkB,MAAM,IAAI;AAAA,YAC1B,OAAO,MAAM;AAAA,YAEb,GAAI,WAAW;AAAA,cAEb,iBAAiB;AACf,sBAAM,MAAM;AACZ,oBAAI,MAAM,gBAAgB,OAAO,WAAW,YAAY,UAAU;AAChE,wBAAM,aAAa,GAAG,WAAW,QAAQ,MAAM;AAAA,gBACjD;AAAA,cACF;AAAA,YACF;AAAA,UACF,CAAC;AAAA,QACH;AAAA,QACA,CAAC,MAAM,EAAE;AAAA,MACX;AAEA,YAAM,eAAe,YAAY,KAAK,QAAQ;AAE9C,gBAAU,MAAM;AACd,YAAI,CAAC,MAAM;AAAI;AACf,eAAO,MAAM;AACX,8BAAoB,MAAM,EAAG;AAAA,QAC/B;AAAA,MACF,GAAG,CAAC,MAAM,EAAE,CAAC;AAEb,YAAM,aAAa,UACf;AAAA,QACE,GAAG;AAAA,QACH,aAAa,OAAO;AAClB,qBAAW,UAAU;AACrB,gBAAM,eAAe,KAAK;AAAA,QAC5B;AAAA,MACF,IACA;AAEJ,aAAO,CAAC,UAAU,KAAK,kBAAkB,YAAY;AAAA,IACvD;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/jsx/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["export * from './registerFocusable'\nexport * from './focusableInputHOC'\nexport * from './focusable'\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/focusable",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.152",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"clean:build": "tamagui-build clean:build"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@tamagui/compose-refs": "^1.0.1-beta.
|
|
26
|
-
"@tamagui/core": "^1.0.1-beta.
|
|
25
|
+
"@tamagui/compose-refs": "^1.0.1-beta.152",
|
|
26
|
+
"@tamagui/core": "^1.0.1-beta.152"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": "*",
|
|
30
30
|
"react-dom": "*"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
33
|
+
"@tamagui/build": "^1.0.1-beta.152",
|
|
34
34
|
"react": "*",
|
|
35
35
|
"react-dom": "*"
|
|
36
36
|
},
|