Skip to content

Commit

Permalink
Updating types (#2262)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgperry authored Jul 28, 2023
1 parent 91351cb commit 1df15e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/framer-motion/src/render/dom/viewport/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ export type ViewChangeHandler = (entry: IntersectionObserverEntry) => void
export interface InViewOptions {
root?: Element | Document
margin?: string
amount?: "any" | "all" | number
amount?: "some" | "all" | number
}

const thresholds = {
any: 0,
some: 0,
all: 1,
}

export function inView(
elementOrSelector: ElementOrSelector,
onStart: (entry: IntersectionObserverEntry) => void | ViewChangeHandler,
{ root, margin: rootMargin, amount = "any" }: InViewOptions = {}
{ root, margin: rootMargin, amount = "some" }: InViewOptions = {}
): VoidFunction {
const elements = resolveElements(elementOrSelector)

Expand Down
2 changes: 1 addition & 1 deletion packages/framer-motion/src/utils/use-in-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function useInView(
const options: InViewOptions = {
root: (root && root.current) || undefined,
margin,
amount: amount === "some" ? "any" : amount,
amount,
}

return inView(ref.current, onEnter, options)
Expand Down

0 comments on commit 1df15e2

Please sign in to comment.