import React, { useEffect } from 'react'

export default (props) => {
  
  useEffect(() => {
    window.AMapUI.loadUI(['misc/PoiPicker'], function(PoiPicker) {
      const poiPicker = new PoiPicker({
          input: props.input.current
      });

      poiPicker.on('poiPicked', props.onPick)
    });
  }, [])

  return null
}
