react-native-reorderable-list
Version:
Reorderable list for React Native applications, powered by Reanimated
25 lines (24 loc) • 907 B
JavaScript
/**
* Flattens an object containing `SharedValue`s by extracting their underlying values.
*
* @param target - An object to which the flattened shared values and every other field will be mapped to.
* @param source - The object containing, possibly among others, the shared values.
* @param excludedKeys - The keys to exclude from flattening and mapping.
*
* @returns The object to which the fields where flattened and mapped to.
*/
export const applyAnimatedStyles = (target, source, excludedKeys = []
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) => {
'worklet';
let keys = Object.keys(source);
for (let key of keys) {
if (excludedKeys.includes(key)) {
continue;
}
let value = source[key];
target[key] = value !== null && typeof value === 'object' && 'value' in value ? value.value : value;
}
return target;
};
//# sourceMappingURL=helpers.js.map