Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _errors=require("./helpers/errors");var findEventHandler=function findEventHandler(element,eventName){var eventHandler=toEventHandlerName(eventName);if(typeof element.props[eventHandler]==='function'){return element.props[eventHandler];}if(element.parent===null||element.parent.parent===null){throw new _errors.ErrorWithStack("No handler function found for event: "+eventName,invokeEvent);}return findEventHandler(element.parent,eventName);};var invokeEvent=function invokeEvent(element,eventName,data){var handler=findEventHandler(element,eventName);return handler(data);};var toEventHandlerName=function toEventHandlerName(eventName){return"on"+eventName.charAt(0).toUpperCase()+eventName.slice(1);};var pressHandler=function pressHandler(element){return invokeEvent(element,'press');};var changeTextHandler=function changeTextHandler(element,data){return invokeEvent(element,'changeText',data);};var scrollHandler=function scrollHandler(element,data){return invokeEvent(element,'scroll',data);};var fireEvent=invokeEvent;fireEvent.press=pressHandler;fireEvent.changeText=changeTextHandler;fireEvent.scroll=scrollHandler;var _default=fireEvent;exports.default=_default;