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O,8BAAC,8BAAS,oBAAK,UAAU,IAAE,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,CAAC;IAC9D,CAAC;CACF;AA9CD,kCA8CC;AAED,kBAAe,WAAW,CAAC","names":[],"sources":["/Users/thomas/Source/react-native-core/source/components/input/CrossEditor.tsx"],"sourcesContent":["import React from 'react';\nimport { TextInput, TextInputProps } from 'react-native-paper';\nimport { TextInputMask, TextInputMaskProps } from 'react-native-masked-text';\n\n/**\n * Properties for the {@link CrossEditor} component. Supports masking through {@link maskProps}. This allows getting the masked value.\n *\n * The `onChangeText` event will isntead export the raw value.\n *\n * Inherits react-native-paper {@link https://callstack.github.io/react-native-paper/text-input.html TextInputProps}\n */\nexport interface ICrossEditorProps extends TextInputProps {\n  /**\n   * Text for floating label\n   * https://callstack.github.io/react-native-paper/text-input.html\n   */\n  label: string;\n  /**\n   * `True` to use error styling\n   * https://callstack.github.io/react-native-paper/text-input.html\n   */\n  error?: boolean | undefined;\n  /**\n   * Visual appearence. Default value is 'outlined'\n   *\n   * https://callstack.github.io/react-native-paper/text-input.html\n   */\n  mode?: 'flat' | 'outlined' | undefined;\n  /**\n   * Allows masking the input.\n   * \n   * https://github.com/benhurott/react-native-masked-text\n   * \n   * @example\n   * ```\n   <CrossEditor\n    label='Mobile'\n    maskProps={{ type: 'cel-phone' }} />```\n   */\n  maskProps?: TextInputMaskProps | undefined;\n}\n\nlet maskInput: TextInputMask | null = null;\n\n/**\n * A text input supporting mask through {@see ICrossEditorProps.maskProps}.\n * \n * When using mask the raw value will be exported in the `onChangeText` event, not the masked value.\n * \n * Default {@see ICrossEditorProps.mode mode} is 'outlined'.\n *\n * Props are {@see ICrossEditorProps}\n * \n * \n * @example\n * ```\n <CrossEditor\n  label='Mobile'\n  maskProps={{ type: 'cel-phone' }} />\n ```\n */\nexport class CrossEditor extends React.Component<ICrossEditorProps> {\n  constructor(props: ICrossEditorProps) {\n    super(props);\n  }\n\n  render() {\n    const paperProps = {\n      ...this.props,\n      mode: this.props.mode || ('outlined' as 'flat' | 'outlined'),\n    } as TextInputProps;\n\n    if (this.props.maskProps && this.props.maskProps.type) {\n      const maskedProps = {\n        ...this.props,\n        ...this.props.maskProps,\n      } as TextInputMaskProps;\n\n      return (\n        <TextInputMask\n          {...maskedProps}\n          ref={(comp) => (maskInput = comp)}\n          // @ts-ignore - bad map\n          customTextInput={TextInput}\n          customTextInputProps={paperProps}\n          onChangeText={() => {\n            if(maskInput && this.props.onChangeText){\n\n            }\n            if (\n              !maskInput ||\n              !this.props.maskProps ||\n              !this.props.maskProps.onChangeText\n            ) {\n              return;\n            }\n\n            // @ts-ignore - bad map\n            const rawValue = maskInput.getRawValue();\n            this.props.maskProps.onChangeText(rawValue);\n          }}\n        />\n      );\n    }\n\n    return <TextInput {...paperProps} mode={paperProps.mode} />;\n  }\n}\n\nexport default CrossEditor;\n"],"version":3}