MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / copyLayerProperties

Function copyLayerProperties

packages/core/utils/native-helper.ios.ts:319–336  ·  view source on GitHub ↗
(view: UIView, toView: UIView, customProperties?: { view?: Array<keyof UIView>; layer?: Array<keyof CALayer> })

Source from the content-addressed store, hash-verified

317}
318
319function copyLayerProperties(view: UIView, toView: UIView, customProperties?: { view?: Array<keyof UIView>; layer?: Array<keyof CALayer> }) {
320 const viewPropertiesToMatch: Array<keyof UIView> = customProperties?.view || ['backgroundColor'];
321 const layerPropertiesToMatch: Array<keyof CALayer> = customProperties?.layer || ['cornerRadius', 'borderWidth', 'borderColor'];
322
323 viewPropertiesToMatch.forEach((property) => {
324 if (view[property] !== toView[property]) {
325 // console.log('| -- matching view property:', property);
326 view[property as any] = toView[property];
327 }
328 });
329
330 layerPropertiesToMatch.forEach((property) => {
331 if (view.layer[property] !== toView.layer[property]) {
332 // console.log('| -- matching layer property:', property);
333 view.layer[property as any] = toView.layer[property];
334 }
335 });
336}
337
338function animateWithSpring(options?: { tension?: number; friction?: number; mass?: number; delay?: number; velocity?: number; animateOptions?: UIViewAnimationOptions; animations?: () => void; completion?: (finished?: boolean) => void }) {
339 // for convenience, default spring settings are provided

Callers

nothing calls this directly

Calls 1

forEachMethod · 0.80

Tested by

no test coverage detected