MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / checkConfig

Function checkConfig

packages/react/src/components/CreateAnimation.tsx:113–162  ·  view source on GitHub ↗
(animation: Animation, currentProps: any = {}, prevProps: any = {})

Source from the content-addressed store, hash-verified

111}
112
113const checkConfig = (animation: Animation, currentProps: any = {}, prevProps: any = {}) => {
114 const reservedProps = [
115 'children',
116 'progressStart',
117 'progressStep',
118 'progressEnd',
119 'pause',
120 'stop',
121 'destroy',
122 'play',
123 'from',
124 'to',
125 'fromTo',
126 'onFinish',
127 ];
128 for (const key in currentProps) {
129 if (
130 // eslint-disable-next-line no-prototype-builtins
131 currentProps.hasOwnProperty(key) &&
132 !reservedProps.includes(key) &&
133 currentProps[key] !== prevProps[key]
134 ) {
135 (animation as any)[key]((currentProps as any)[key]);
136 }
137 }
138
139 const fromValues = currentProps.from;
140 if (fromValues && fromValues !== prevProps.from) {
141 const values = Array.isArray(fromValues) ? fromValues : [fromValues];
142 values.forEach((val) => animation.from(val.property, val.value));
143 }
144
145 const toValues = currentProps.to;
146 if (toValues && toValues !== prevProps.to) {
147 const values = Array.isArray(toValues) ? toValues : [toValues];
148 values.forEach((val) => animation.to(val.property, val.value));
149 }
150
151 const fromToValues = currentProps.fromTo;
152 if (fromToValues && fromToValues !== prevProps.fromTo) {
153 const values = Array.isArray(fromToValues) ? fromToValues : [fromToValues];
154 values.forEach((val) => animation.fromTo(val.property, val.fromValue, val.toValue));
155 }
156
157 const onFinishValues = currentProps.onFinish;
158 if (onFinishValues && onFinishValues !== prevProps.onFinish) {
159 const values = Array.isArray(onFinishValues) ? onFinishValues : [onFinishValues];
160 values.forEach((val) => animation.onFinish(val.callback, val.opts));
161 }
162};
163
164const checkProgress = (animation: Animation, currentProps: any = {}, prevProps: any = {}) => {
165 const { progressStart, progressStep, progressEnd } = currentProps;

Callers 2

setupAnimationMethod · 0.85
componentDidUpdateMethod · 0.85

Calls 4

fromMethod · 0.80
toMethod · 0.80
fromToMethod · 0.80
onFinishMethod · 0.80

Tested by

no test coverage detected