Skip to content

Commit

Permalink
fix: workletize hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
nandorojo committed Apr 1, 2021
1 parent 537e729 commit 9eeff15
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/core/src/use-animator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export default function useAnimationState<V extends Variants<V>>(
controller.current = {
__state,
transitionTo(nextStateOrFunction) {
'worklet'
const runTransition = (nextStateKey: keyof V) => {
selectedVariant.current = nextStateKey

Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/use-dynamic-animation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ export default function useDynamicAnimation(

const controller = useRef<UseDynamicAnimationState>()

if (controller.current === null) {
if (controller.current == null) {
controller.current = {
__state,
get current(): DynamicStyleProp {
return activeStyle.current.value
},
animateTo(nextStateOrFunction) {
'worklet'
const runAnimation = (nextStyleObject: DynamicStyleProp) => {
if (nextStyleObject) {
activeStyle.current.value = nextStyleObject
Expand Down

0 comments on commit 9eeff15

Please sign in to comment.