import React, { useEffect } from 'react'
import { InputNumber } from 'antd'

const AutoCalculate = (props) => {

  const { value, onChange, schema, addons } = props
  const { disabled, presetValue } = schema

  useEffect(() => {
    onChange(presetValue)
  }, [presetValue])

  return (
    <InputNumber
      value={Number(value)}
      style={{ width: '100%' }}
      disabled={disabled}
    >
    </InputNumber>
  )

}

export default AutoCalculate