Skip to content

Commit

Permalink
Merge pull request #330 from VKCOM/pavelnikitin/fix/exportTypes
Browse files Browse the repository at this point in the history
Add export Blocker and BlockerFunction types
  • Loading branch information
pasha-nikitin-2003 authored Jan 15, 2024
2 parents 5f1ac41 + 2120910 commit f1cbeb0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v1.4.1
-
- Добавили типы BlockerFunction и Blocker

v1.4.0
-
- Избавились от UNSAFE методов библиотеки @remix-run/router
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import {
ModalPageHeader,
} from '@vkontakte/vkui';

import { useRouteNavigator } from '@vkontakte/vk-mini-apps-router';
import { BlockerFunction, useRouteNavigator, } from '@vkontakte/vk-mini-apps-router';
import { NavProp } from '../types';
import { BlockerFunction } from '@remix-run/router';

const PASSWORD = '1234';

Expand Down
4 changes: 2 additions & 2 deletions examples/vk-mini-apps-router-example/src/panels/Blocker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
useEnableSwipeBack,
useBlocker,
useActiveVkuiLocation,
BlockerFunction,
} from '@vkontakte/vk-mini-apps-router';
import { Action, BlockerFunction } from '@remix-run/router';
import { DEFAULT_VIEW_PANELS } from '../routes';

export const Blocker = ({ nav }: NavProp) => {
Expand All @@ -17,7 +17,7 @@ export const Blocker = ({ nav }: NavProp) => {
const routeNavigator = useRouteNavigator();

const blockerFn = useCallback<BlockerFunction>(({ historyAction }) => {
return historyAction !== Action.Push;
return historyAction !== "PUSH";
}, []);

const blocker = useBlocker(blockerFn);
Expand Down
16 changes: 10 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export type { BlockerFunction, Blocker } from '@remix-run/router';
export type { RouteWithoutRoot, RouteWithRoot, RouteLeaf } from './type';
export type { RouterProviderProps } from './components/RouterProvider';
export { RouterProvider } from './components/RouterProvider';
Expand All @@ -6,11 +7,7 @@ export { createHashRouter } from './utils/createHashRouter';
export { createHashParamRouter } from './utils/createHashParamRouter';
export { createBrowserRouter } from './utils/createBrowserRouter';

export {
useRouteNavigator,
useParams,
usePopout,
} from './hooks/hooks';
export { useRouteNavigator, useParams, usePopout } from './hooks/hooks';
export { useGetPanelForView } from './hooks/useGetPanelForView';
export { useSearchParams } from './hooks/useSearchParams';
export { useMetaParams } from './hooks/useMetaParams';
Expand All @@ -26,4 +23,11 @@ export { withRouter } from './hoc/withRouter';
export type { RouteNavigator } from './services/RouteNavigator.type';
export { getInitialLocation } from './services/InitialLocation';

export { RoutesConfig, createView, createRoot, createPanel, createTab, createModal } from './page-types';
export {
RoutesConfig,
createView,
createRoot,
createPanel,
createTab,
createModal,
} from './page-types';

0 comments on commit f1cbeb0

Please sign in to comment.