MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / valueChanged

Function valueChanged

packages/core/ui/core/view-base/index.ts:1587–1609  ·  view source on GitHub ↗
(view: ViewBase, oldValue: string, newValue: string)

Source from the content-addressed store, hash-verified

1585export const classNameProperty = new Property<ViewBase, string>({
1586 name: 'className',
1587 valueChanged(view: ViewBase, oldValue: string, newValue: string) {
1588 const cssClasses = view.cssClasses;
1589 const rootViewsCssClasses = CSSUtils.getSystemCssClasses();
1590
1591 const shouldAddModalRootViewCssClasses = cssClasses.has(CSSUtils.MODAL_ROOT_VIEW_CSS_CLASS);
1592 const shouldAddRootViewCssClasses = cssClasses.has(CSSUtils.ROOT_VIEW_CSS_CLASS);
1593
1594 cssClasses.clear();
1595
1596 if (shouldAddModalRootViewCssClasses) {
1597 cssClasses.add(CSSUtils.MODAL_ROOT_VIEW_CSS_CLASS);
1598 } else if (shouldAddRootViewCssClasses) {
1599 cssClasses.add(CSSUtils.ROOT_VIEW_CSS_CLASS);
1600 }
1601
1602 rootViewsCssClasses.forEach((c) => cssClasses.add(c));
1603
1604 if (typeof newValue === 'string' && newValue !== '') {
1605 newValue.split(' ').forEach((c) => cssClasses.add(c));
1606 }
1607
1608 view._onCssStateChange();
1609 },
1610});
1611classNameProperty.register(ViewBase);
1612

Callers 5

constructorMethod · 0.50
constructorMethod · 0.50
setLocalValueMethod · 0.50
setCssValueMethod · 0.50
setFuncMethod · 0.50

Calls 4

forEachMethod · 0.80
clearMethod · 0.65
addMethod · 0.65
addPseudoClassMethod · 0.65

Tested by

no test coverage detected