"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const react_1 = require("react");
const lib_1 = require("../../lib");
const Navigation_1 = require("../Navigation");
const historyToActionObject_1 = require("../../helpers/historyToActionObject");
/**
 * NavigationActions
 * This is a render prop component which passes the navigation actions
 * to the child component. It's useful when you cannot pass the navigation
 * actions into the component directly, or don't want to pass it in case
 * of a deeply nested child.
 */
exports.NavigationActions = lib_1.withRouter((_a) => {
    var { children } = _a, rest = tslib_1.__rest(_a, ["children"]);
    const mainNavigatorConfigs = react_1.useContext(Navigation_1.MainNavigatorContext);
    const actions = historyToActionObject_1.historyToActionObject(rest, mainNavigatorConfigs);
    return children(actions);
});
