import * as React from "react";

import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
import { deprecationWarningWithIdentifier } from "@applicaster/zapp-react-native-utils/appUtils";

export function withNavigator(Component) {
  return function WithNavigator(props: any) {
    const navigator = useNavigation();

    deprecationWarningWithIdentifier(
      "withNavigator decorator",
      "useNavigation() hook from @applicaster/zapp-react-native-utils/reactHooks/navigation",
      props?.component?.component_type
    );

    return <Component {...props} navigator={navigator} />;
  };
}
