Skip to content

Commit 2812f35

Browse files
committed
fix types
1 parent 5790b4f commit 2812f35

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

packages/moti/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "moti",
33
"description": "The universal React Native animation library, powered by Reanimated 3. 🦉",
4-
"version": "0.29.0",
4+
"version": "0.30.0",
55
"keywords": [
66
"react-native",
77
"ios",

packages/moti/src/core/use-animator/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export default function useAnimationState<V extends Variants<V>>(
134134
to = 'to' as keyof V,
135135
}: UseAnimationStateConfig<V> = {}
136136
) {
137-
const controller = useRef<UseAnimationState<V>>()
137+
const controller = useRef<UseAnimationState<V>>(null)
138138
const __state = useSharedValue<InternalControllerState<V>>(
139139
from ? _variants[from] : 0
140140
)

packages/moti/src/core/use-dynamic-animation/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default function useDynamicAnimation<
5050

5151
const __state = useSharedValue(initializer.current.value)
5252

53-
const controller = useRef<UseDynamicAnimationState<Animate>>()
53+
const controller = useRef<UseDynamicAnimationState<Animate>>(null)
5454

5555
if (controller.current == null) {
5656
controller.current = {

packages/moti/src/interactions/pressable/hoverable.tsx

+9-4
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,20 @@ function isHoverEnabled(): boolean {
4444
return isEnabled
4545
}
4646

47-
import React, { useCallback, ReactChild, useRef, useEffect } from 'react'
47+
import React, {
48+
useCallback,
49+
ReactElement as ReactChild,
50+
useRef,
51+
useEffect,
52+
} from 'react'
4853
import { useSharedValue, useAnimatedReaction } from 'react-native-reanimated'
4954
import { HoveredContext } from './hoverable-context'
5055
import { mergeRefs } from './merge-refs'
5156

5257
export interface HoverableProps {
5358
onHoverIn?: () => void
5459
onHoverOut?: () => void
55-
children: NonNullable<ReactChild>
60+
children: ReactChild
5661
childRef?: React.Ref<any>
5762
}
5863

@@ -123,15 +128,15 @@ export function Hoverable({
123128
}
124129
}, [isHovered])
125130

126-
const child = React.Children.only(children) as React.ReactElement
131+
const child = React.Children.only(children)
127132

128133
return (
129134
<HoveredContext.Provider value={isHovered}>
130135
{React.cloneElement(child, {
131136
onMouseEnter: handleMouseEnter,
132137
onMouseLeave: handleMouseLeave,
133138
ref: mergeRefs([localRef, childRef || null]),
134-
})}
139+
} as any)}
135140
</HoveredContext.Provider>
136141
)
137142
}

0 commit comments

Comments
 (0)