react-mask-field icon indicating copy to clipboard operation
react-mask-field copied to clipboard

Error Message: TypeError: k.split is not a function

Open Geraldf opened this issue 2 years ago • 1 comments

I am getting the below error message in line 15 at the file "node_modules/react-mask-field/dist/index.esm.js"

TypeError: k.split is not a function

(anonymous function)
node_modules/react-mask-field/dist/index.esm.js:15
  12 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  13 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14 | PERFORMANCE OF THIS SOFTWARE.
> 15 | ***************************************************************************** */var o=function(e,r){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])})(e,r)};var c=function(){return(c=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e}).apply(this,arguments)};function i(e){var r;return"string"==typeof e?((r={})[e]=/./,r):e}function s(e){var r=e.value,t=e.replaceableSymbols,n=e.replacement,a=e.separate,u=t;return r.split("").reduce((function(e,r){var t,l=Object.prototype.hasOwnProperty.call(n,r),o=null===(t=n[u[0]])||void 0===t?void 0:t.test(r);return(a?l||o:!l&&o)?(u=u.slice(1),e+r):e}),"")}function p(e)

when I perform this code

export const CardNumberInput = forwardRef<
  HTMLInputElement,
  InputBaseComponentProps
>((props, ref) => {
  const { mask } = props;
  return (
    <MaskField
      ref={ref}
      // mask="____ ____ ____ ____"
      showMask={true}
      replacement={{ _: /\d/ }}
      {...props}
    />
  );
});

type Props = TextFieldProps & {
  mask: string;
  replacement: string | object;
  showMask?: boolean;
};

export const Example = (props: Props) => {
  const { mask } = props;

  return (
    <CustomTextfield
      {...props}
      //inputProps={CardNumberInput}
      InputProps={{
        inputComponent: CardNumberInput,
        inputProps: {
          mask: { mask },
        },
      }}
    />
  );
};

Geraldf avatar Nov 13 '22 09:11 Geraldf

Could you provide more detailed code?

GoncharukBro avatar Dec 04 '22 20:12 GoncharukBro