Skip to content

Commit

Permalink
fix: hermes
Browse files Browse the repository at this point in the history
  • Loading branch information
nandorojo committed Jan 20, 2023
1 parent 969ed06 commit 916c29e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/moti/src/core/use-motify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,16 @@ export function useMotify<Animate>({
}

const exitingStyleProps: Record<string, boolean> = {}
for (const key in exitStyle || {}) {

Object.keys(exitStyle || {}).forEach((key) => {
const disabledExitStyles = {
position: true,
zIndex: true,
}
if (!disabledExitStyles[key]) {
exitingStyleProps[key] = true
}
}
})

// allow shared values as transitions
let transition: MotiTransition<Animate> | undefined
Expand Down Expand Up @@ -402,8 +403,8 @@ export function useMotify<Animate>({
transition = Object.assign({}, transition, exitTransition)
}

for (const _key in mergedStyles) {
const key = _key as string
// need to use forEach to work with Hermes...https://github.com/nandorojo/moti/issues/214#issuecomment-1399055535
Object.keys(mergedStyles).forEach((key) => {
const value = mergedStyles[key]

const {
Expand Down Expand Up @@ -447,7 +448,7 @@ export function useMotify<Animate>({
// skip missing values
// this is useful if you want to do {opacity: loading && 1}
// without this, those values will break I think
continue
return
}

if (key === 'transform') {
Expand Down Expand Up @@ -590,7 +591,7 @@ export function useMotify<Animate>({
final[key] = finalValue
}
}
}
})

if (!final.transform?.length) {
delete final.transform
Expand Down

0 comments on commit 916c29e

Please sign in to comment.