// withHooks
// noPage

import { LibInput } from 'esoftplay/cache/lib/input/import';
import { LibStyle } from 'esoftplay/cache/lib/style/import';
import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
import { MarketInput_label } from 'esoftplay/cache/market/input_label/import';

import React from 'react';
import { Platform, TextInput, View } from 'react-native';

export interface MarketInput_squareProps {
  label?: string,
  _ref?: React.Ref<LibInput>,
  placeholder?: string,
  mask?: string,
  maskFrom?: 'start' | 'end',
  prefix?: string,
  suffix?: string,
  error?: boolean,
  allowFontScaling?: boolean,
  autoCapitalize?: "none" | "sentences" | "words" | "characters",
  autoCorrect?: boolean,
  autoFocus?: boolean,
  blurOnSubmit?: boolean,
  onBlur?: () => void,
  onFocus?: () => void,
  caretHidden?: boolean,
  contextMenuHidden?: boolean,
  defaultValue?: string,
  editable?: boolean,
  inactive?: boolean,
  keyboardType?: "default" | "email-address" | "numeric" | "phone-pad",
  maxLength?: number,
  multiline?: boolean,
  onSubmitEditing?: () => void,
  onChangeText: (text: string, textMasked: string) => void,
  placeholderTextColor?: string,
  returnKeyType?: "done" | "go" | "next" | "search" | "send",
  secureTextEntry?: boolean,
  selectTextOnFocus?: boolean,
  selectionColor?: string,
  style?: any,
  containerStyle?: any,
  value?: string,
  mandatory?: boolean,
  mandatoryColor?: string,
  testID?: string
}
export default function m(props: MarketInput_squareProps): any {
  return (
    <View style={{ paddingHorizontal: 17, marginTop: 4, marginBottom: 8, ...props.containerStyle }} >
      {props.label && <MarketInput_label label={props.label} mandatory={props.mandatory} mandatoryColor={props.mandatoryColor} />}
      <View testID={props?.testID || 'input_square'} style={{ flexDirection: "row", alignItems: "center", borderWidth: 1, borderRadius: 6, borderColor: props.error ? LibStyle.colorRed : "#ddd", backgroundColor: props.inactive ? "#eee" : "white", paddingHorizontal: 10 }} >
        {props.prefix && <LibTextstyle textStyle="callout" text={props.prefix} style={{ fontSize: 14, color: "#aaa" }} />}
        {
          props._ref ?
            // @ts-ignore
            <LibInput base={true} ref={props._ref}  {...props} style={{ flex: 1, paddingVertical: Platform.OS == 'ios' ? 10 : 4, fontSize: 14, ...props.style }} />
            :
            // @ts-ignore
            <TextInput {...props} style={{ flex: 1, paddingVertical: Platform.OS == 'ios' ? 10 : 4, fontSize: 14, ...props.style }} />
        }
        {props.suffix && <LibTextstyle textStyle="callout" text={"    " + props.suffix} style={{ fontSize: 14, color: "#aaa" }} />}
      </View>
    </View>
  )
}