Skip to content

Commit c370a7c

Browse files
committed
Fix error caused by __createInterpolation being removed from react-native
1 parent 452aec0 commit c370a7c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/create-interpolation.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,18 @@ type ColorInterpolateFunction = (input: number) => string
77
function createInterpolation(
88
config: Animated.InterpolationConfigType
99
): ColorInterpolateFunction {
10-
return AnimatedInterpolation.__createInterpolation(config)
10+
if (AnimatedInterpolation.__createInterpolation) {
11+
return AnimatedInterpolation.__createInterpolation(config)
12+
}
13+
14+
return (input) => {
15+
const interpolation = new AnimatedInterpolation(
16+
{ __getValue: () => input },
17+
config
18+
)
19+
20+
return interpolation.__getValue()
21+
}
1122
}
1223

1324
export { createInterpolation }

0 commit comments

Comments
 (0)