UNPKG

721 BPlain TextView Raw
1'use strict';
2import { addWhitelistedNativeProps } from '../ConfigHelper';
3import type {
4 AnimatedPropsAdapterFunction,
5 AnimatedPropsAdapterWorklet,
6} from './commonTypes';
7
8// @ts-expect-error This overload is required by our API.
9export function createAnimatedPropAdapter(
10 adapter: AnimatedPropsAdapterFunction,
11 nativeProps?: string[]
12): AnimatedPropsAdapterFunction;
13
14export function createAnimatedPropAdapter(
15 adapter: AnimatedPropsAdapterWorklet,
16 nativeProps?: string[]
17): AnimatedPropsAdapterWorklet {
18 const nativePropsToAdd: { [key: string]: boolean } = {};
19 nativeProps?.forEach((prop) => {
20 nativePropsToAdd[prop] = true;
21 });
22 addWhitelistedNativeProps(nativePropsToAdd);
23 return adapter;
24}