@momo-kits/calculator-keyboard 0.112.1-rn80.5-kits.1 → 0.112.1-rn80.6

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.
@@ -8,19 +8,39 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  var _jsxRuntime = require("react/jsx-runtime");
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- const NativeInput = (0, _reactNative.requireNativeComponent)('RCTInputCalculator');
11
+ const NAME = 'RCTInputCalculator';
12
+ const NativeInput = (0, _reactNative.requireNativeComponent)(NAME);
12
13
  const InputCalculator = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
14
+ const nativeRef = _react.default.useRef(null);
13
15
  const _onChange = event => {
14
16
  const currentText = event.nativeEvent.text;
15
17
  props.onChange && props.onChange(event);
16
18
  props.onChangeText && props.onChangeText(currentText);
17
19
  };
18
- const text = props.text || props.defaultValue || '';
20
+ const text = props.text ?? props.defaultValue ?? '';
21
+ _react.default.useImperativeHandle(ref, () => ({
22
+ focus() {
23
+ const node = (0, _reactNative.findNodeHandle)(nativeRef.current);
24
+ if (!node) return;
25
+ const config = _reactNative.UIManager.getViewManagerConfig(NAME);
26
+ if (config?.Commands?.focus != null) {
27
+ _reactNative.UIManager.dispatchViewManagerCommand(node, config.Commands.focus, []);
28
+ }
29
+ },
30
+ blur() {
31
+ const node = (0, _reactNative.findNodeHandle)(nativeRef.current);
32
+ if (!node) return;
33
+ const config = _reactNative.UIManager.getViewManagerConfig(NAME);
34
+ if (config?.Commands?.blur != null) {
35
+ _reactNative.UIManager.dispatchViewManagerCommand(node, config.Commands.blur, []);
36
+ }
37
+ }
38
+ }));
19
39
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(NativeInput, {
20
40
  ...props,
21
- ref: ref,
41
+ ref: nativeRef,
22
42
  onChange: _onChange,
23
- text: text,
43
+ value: text,
24
44
  keybardColor: (0, _reactNative.processColor)(props.keyboardColor)
25
45
  });
26
46
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_jsxRuntime","e","__esModule","default","NativeInput","requireNativeComponent","InputCalculator","React","forwardRef","props","ref","_onChange","event","currentText","nativeEvent","text","onChange","onChangeText","defaultValue","jsx","keybardColor","processColor","keyboardColor","_default","exports"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAMsB,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGtB,MAAMG,WAAW,GAAG,IAAAC,mCAAsB,EAAM,oBAAoB,CAAC;AAOrE,MAAMC,eAAe,gBAAGC,cAAK,CAACC,UAAU,CACtC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACd,MAAMC,SAAS,GACbC,KAAqD,IAClD;IACH,MAAMC,WAAW,GAAGD,KAAK,CAACE,WAAW,CAACC,IAAI;IAC1CN,KAAK,CAACO,QAAQ,IAAIP,KAAK,CAACO,QAAQ,CAACJ,KAAK,CAAC;IACvCH,KAAK,CAACQ,YAAY,IAAIR,KAAK,CAACQ,YAAY,CAACJ,WAAW,CAAC;EACvD,CAAC;EAED,MAAME,IAAI,GAAGN,KAAK,CAACM,IAAI,IAAIN,KAAK,CAACS,YAAY,IAAI,EAAE;EAEnD,oBACE,IAAAlB,WAAA,CAAAmB,GAAA,EAACf,WAAW;IAAA,GACNK,KAAK;IACTC,GAAG,EAAEA,GAAI;IACTM,QAAQ,EAAEL,SAAU;IACpBI,IAAI,EAAEA,IAAK;IACXK,YAAY,EAAE,IAAAC,yBAAY,EAACZ,KAAK,CAACa,aAAa;EAAE,CACjD,CAAC;AAEN,CACF,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArB,OAAA,GAEaG,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_jsxRuntime","e","__esModule","default","NAME","NativeInput","requireNativeComponent","InputCalculator","React","forwardRef","props","ref","nativeRef","useRef","_onChange","event","currentText","nativeEvent","text","onChange","onChangeText","defaultValue","useImperativeHandle","focus","node","findNodeHandle","current","config","UIManager","getViewManagerConfig","Commands","dispatchViewManagerCommand","blur","jsx","value","keybardColor","processColor","keyboardColor","_default","exports"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQsB,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGtB,MAAMG,IAAI,GAAG,oBAAoB;AACjC,MAAMC,WAAW,GAAG,IAAAC,mCAAsB,EAAMF,IAAI,CAAC;AAYrD,MAAMG,eAAe,gBAAGC,cAAK,CAACC,UAAU,CACtC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACd,MAAMC,SAAS,GAAGJ,cAAK,CAACK,MAAM,CAAM,IAAI,CAAC;EAEzC,MAAMC,SAAS,GACbC,KAAqD,IAClD;IACH,MAAMC,WAAW,GAAGD,KAAK,CAACE,WAAW,CAACC,IAAI;IAC1CR,KAAK,CAACS,QAAQ,IAAIT,KAAK,CAACS,QAAQ,CAACJ,KAAK,CAAC;IACvCL,KAAK,CAACU,YAAY,IAAIV,KAAK,CAACU,YAAY,CAACJ,WAAW,CAAC;EACvD,CAAC;EAED,MAAME,IAAI,GAAGR,KAAK,CAACQ,IAAI,IAAIR,KAAK,CAACW,YAAY,IAAI,EAAE;EAEnDb,cAAK,CAACc,mBAAmB,CAACX,GAAG,EAAE,OAAO;IACpCY,KAAKA,CAAA,EAAG;MACN,MAAMC,IAAI,GAAG,IAAAC,2BAAc,EAACb,SAAS,CAACc,OAAO,CAAC;MAC9C,IAAI,CAACF,IAAI,EAAE;MACX,MAAMG,MAAM,GAAGC,sBAAS,CAACC,oBAAoB,CAACzB,IAAI,CAAC;MACnD,IAAIuB,MAAM,EAAEG,QAAQ,EAAEP,KAAK,IAAI,IAAI,EAAE;QACnCK,sBAAS,CAACG,0BAA0B,CAACP,IAAI,EAAEG,MAAM,CAACG,QAAQ,CAACP,KAAK,EAAE,EAAE,CAAC;MACvE;IACF,CAAC;IACDS,IAAIA,CAAA,EAAG;MACL,MAAMR,IAAI,GAAG,IAAAC,2BAAc,EAACb,SAAS,CAACc,OAAO,CAAC;MAC9C,IAAI,CAACF,IAAI,EAAE;MACX,MAAMG,MAAM,GAAGC,sBAAS,CAACC,oBAAoB,CAACzB,IAAI,CAAC;MACnD,IAAIuB,MAAM,EAAEG,QAAQ,EAAEE,IAAI,IAAI,IAAI,EAAE;QAClCJ,sBAAS,CAACG,0BAA0B,CAACP,IAAI,EAAEG,MAAM,CAACG,QAAQ,CAACE,IAAI,EAAE,EAAE,CAAC;MACtE;IACF;EACF,CAAC,CAAC,CAAC;EAEH,oBACE,IAAAhC,WAAA,CAAAiC,GAAA,EAAC5B,WAAW;IAAA,GACNK,KAAK;IACTC,GAAG,EAAEC,SAAU;IACfO,QAAQ,EAAEL,SAAU;IACpBoB,KAAK,EAAEhB,IAAK;IACZiB,YAAY,EAAE,IAAAC,yBAAY,EAAC1B,KAAK,CAAC2B,aAAa;EAAE,CACjD,CAAC;AAEN,CACF,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAApC,OAAA,GAEaI,eAAe","ignoreList":[]}
@@ -1,22 +1,42 @@
1
1
  "use strict";
2
2
 
3
3
  import React from 'react';
4
- import { processColor } from 'react-native';
4
+ import { processColor, UIManager, findNodeHandle } from 'react-native';
5
5
  import { requireNativeComponent } from 'react-native';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
- const NativeInput = requireNativeComponent('RCTInputCalculator');
7
+ const NAME = 'RCTInputCalculator';
8
+ const NativeInput = requireNativeComponent(NAME);
8
9
  const InputCalculator = /*#__PURE__*/React.forwardRef((props, ref) => {
10
+ const nativeRef = React.useRef(null);
9
11
  const _onChange = event => {
10
12
  const currentText = event.nativeEvent.text;
11
13
  props.onChange && props.onChange(event);
12
14
  props.onChangeText && props.onChangeText(currentText);
13
15
  };
14
- const text = props.text || props.defaultValue || '';
16
+ const text = props.text ?? props.defaultValue ?? '';
17
+ React.useImperativeHandle(ref, () => ({
18
+ focus() {
19
+ const node = findNodeHandle(nativeRef.current);
20
+ if (!node) return;
21
+ const config = UIManager.getViewManagerConfig(NAME);
22
+ if (config?.Commands?.focus != null) {
23
+ UIManager.dispatchViewManagerCommand(node, config.Commands.focus, []);
24
+ }
25
+ },
26
+ blur() {
27
+ const node = findNodeHandle(nativeRef.current);
28
+ if (!node) return;
29
+ const config = UIManager.getViewManagerConfig(NAME);
30
+ if (config?.Commands?.blur != null) {
31
+ UIManager.dispatchViewManagerCommand(node, config.Commands.blur, []);
32
+ }
33
+ }
34
+ }));
15
35
  return /*#__PURE__*/_jsx(NativeInput, {
16
36
  ...props,
17
- ref: ref,
37
+ ref: nativeRef,
18
38
  onChange: _onChange,
19
- text: text,
39
+ value: text,
20
40
  keybardColor: processColor(props.keyboardColor)
21
41
  });
22
42
  });
@@ -1 +1 @@
1
- {"version":3,"names":["React","processColor","requireNativeComponent","jsx","_jsx","NativeInput","InputCalculator","forwardRef","props","ref","_onChange","event","currentText","nativeEvent","text","onChange","onChangeText","defaultValue","keybardColor","keyboardColor"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAKEC,YAAY,QACP,cAAc;AACrB,SAASC,sBAAsB,QAAmB,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEjE,MAAMC,WAAW,GAAGH,sBAAsB,CAAM,oBAAoB,CAAC;AAOrE,MAAMI,eAAe,gBAAGN,KAAK,CAACO,UAAU,CACtC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACd,MAAMC,SAAS,GACbC,KAAqD,IAClD;IACH,MAAMC,WAAW,GAAGD,KAAK,CAACE,WAAW,CAACC,IAAI;IAC1CN,KAAK,CAACO,QAAQ,IAAIP,KAAK,CAACO,QAAQ,CAACJ,KAAK,CAAC;IACvCH,KAAK,CAACQ,YAAY,IAAIR,KAAK,CAACQ,YAAY,CAACJ,WAAW,CAAC;EACvD,CAAC;EAED,MAAME,IAAI,GAAGN,KAAK,CAACM,IAAI,IAAIN,KAAK,CAACS,YAAY,IAAI,EAAE;EAEnD,oBACEb,IAAA,CAACC,WAAW;IAAA,GACNG,KAAK;IACTC,GAAG,EAAEA,GAAI;IACTM,QAAQ,EAAEL,SAAU;IACpBI,IAAI,EAAEA,IAAK;IACXI,YAAY,EAAEjB,YAAY,CAACO,KAAK,CAACW,aAAa;EAAE,CACjD,CAAC;AAEN,CACF,CAAC;AAED,eAAeb,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["React","processColor","UIManager","findNodeHandle","requireNativeComponent","jsx","_jsx","NAME","NativeInput","InputCalculator","forwardRef","props","ref","nativeRef","useRef","_onChange","event","currentText","nativeEvent","text","onChange","onChangeText","defaultValue","useImperativeHandle","focus","node","current","config","getViewManagerConfig","Commands","dispatchViewManagerCommand","blur","value","keybardColor","keyboardColor"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAKEC,YAAY,EACZC,SAAS,EACTC,cAAc,QACT,cAAc;AACrB,SAASC,sBAAsB,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEtD,MAAMC,IAAI,GAAG,oBAAoB;AACjC,MAAMC,WAAW,GAAGJ,sBAAsB,CAAMG,IAAI,CAAC;AAYrD,MAAME,eAAe,gBAAGT,KAAK,CAACU,UAAU,CACtC,CA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;EAEH,oBACEzB,IAAA,CAACE,WAAW;IAAA,GACNG,KAAK;IACTC,GAAG,EAAEC,SAAU;IACfO,QAAQ,EAAEL,SAAU;IACpBiB,KAAK,EAAEb,IAAK;IACZc,YAAY,EAAEhC,YAAY,CAACU,KAAK,CAACuB,aAAa;EAAE,CACjD,CAAC;AAEN,CACF,CAAC;AAED,eAAezB,eAAe","ignoreList":[]}
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
2
  import { type TextInputProps, type ColorValue } from 'react-native';
3
- import { TextInput } from 'react-native';
4
3
  interface InputCalculatorProps extends TextInputProps {
5
4
  text?: string | undefined;
6
5
  keyboardColor?: ColorValue;
7
6
  }
8
- declare const InputCalculator: React.ForwardRefExoticComponent<InputCalculatorProps & React.RefAttributes<TextInput>>;
7
+ export type InputCalculatorRef = {
8
+ focus: () => void;
9
+ blur: () => void;
10
+ };
11
+ declare const InputCalculator: React.ForwardRefExoticComponent<InputCalculatorProps & React.RefAttributes<InputCalculatorRef>>;
9
12
  export default InputCalculator;
10
- export type { InputCalculatorProps };
11
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,UAAU,EAEhB,MAAM,cAAc,CAAC;AACtB,OAAO,EAA0B,SAAS,EAAE,MAAM,cAAc,CAAC;AAIjE,UAAU,oBAAqB,SAAQ,cAAc;IACnD,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,UAAU,CAAC;CAC5B;AAED,QAAA,MAAM,eAAe,wFAsBpB,CAAC;AAEF,eAAe,eAAe,CAAC;AAE/B,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,UAAU,EAIhB,MAAM,cAAc,CAAC;AAMtB,UAAU,oBAAqB,SAAQ,cAAc;IACnD,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,UAAU,CAAC;CAC5B;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB,CAAC;AAEF,QAAA,MAAM,eAAe,iGA2CpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
2
  import { type TextInputProps, type ColorValue } from 'react-native';
3
- import { TextInput } from 'react-native';
4
3
  interface InputCalculatorProps extends TextInputProps {
5
4
  text?: string | undefined;
6
5
  keyboardColor?: ColorValue;
7
6
  }
8
- declare const InputCalculator: React.ForwardRefExoticComponent<InputCalculatorProps & React.RefAttributes<TextInput>>;
7
+ export type InputCalculatorRef = {
8
+ focus: () => void;
9
+ blur: () => void;
10
+ };
11
+ declare const InputCalculator: React.ForwardRefExoticComponent<InputCalculatorProps & React.RefAttributes<InputCalculatorRef>>;
9
12
  export default InputCalculator;
10
- export type { InputCalculatorProps };
11
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,UAAU,EAEhB,MAAM,cAAc,CAAC;AACtB,OAAO,EAA0B,SAAS,EAAE,MAAM,cAAc,CAAC;AAIjE,UAAU,oBAAqB,SAAQ,cAAc;IACnD,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,UAAU,CAAC;CAC5B;AAED,QAAA,MAAM,eAAe,wFAsBpB,CAAC;AAEF,eAAe,eAAe,CAAC;AAE/B,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,UAAU,EAIhB,MAAM,cAAc,CAAC;AAMtB,UAAU,oBAAqB,SAAQ,cAAc;IACnD,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,UAAU,CAAC;CAC5B;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB,CAAC;AAEF,QAAA,MAAM,eAAe,iGA2CpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/calculator-keyboard",
3
- "version": "0.112.1-rn80.5-kits.1",
3
+ "version": "0.112.1-rn80.6",
4
4
  "description": "react native calculator keyboard",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",