react-native-reanimated
Version:
More powerful alternative to Animated library for React Native.
28 lines (24 loc) • 979 B
text/typescript
;
import { processBoxShadowWeb, processFilterWeb } from '../common/web';
import type { ViewDescriptorsWrapper } from '../commonTypes';
import type { PropUpdates } from '../createAnimatedComponent/commonTypes';
import type { ReanimatedHTMLElement } from '../ReanimatedModule/js-reanimated';
import { _updatePropsJS } from '../ReanimatedModule/js-reanimated';
const updateProps: (
viewDescriptors: ViewDescriptorsWrapper,
updates: PropUpdates,
isAnimatedProps?: boolean
) => void = (viewDescriptors, updates, isAnimatedProps) => {
'worklet';
viewDescriptors.value?.forEach((viewDescriptor) => {
const component = viewDescriptor.tag as ReanimatedHTMLElement;
if ('boxShadow' in updates) {
updates.boxShadow = processBoxShadowWeb(updates.boxShadow);
}
if ('filter' in updates) {
updates.filter = processFilterWeb(updates.filter);
}
_updatePropsJS(updates, component, isAnimatedProps);
});
};
export default updateProps;