import { useRoute, useNavigation } from '@react-navigation/core'

export function createParams<T>(params: T): T {
  return { ...params }
}

export function useParams<T extends any>(): T {
  return useRoute().params as T
}

export function useCurrentPage(routeName: string): boolean {
  const navigation = useNavigation()
  const { index, routes} = navigation.getState()
  return routeName === routes[index].name
}
