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

Method itemStyle

core/src/components/item/item.tsx:140–165  ·  view source on GitHub ↗
(ev: CustomEvent<StyleEventDetail>)

Source from the content-addressed store, hash-verified

138
139 @Listen('ionStyle')
140 itemStyle(ev: CustomEvent<StyleEventDetail>) {
141 ev.stopPropagation();
142
143 const tagName = (ev.target as HTMLElement).tagName;
144 const updatedStyles = ev.detail;
145 const newStyles = {} as CssClassMap;
146 const childStyles = this.itemStyles.get(tagName) || {};
147
148 let hasStyleChange = false;
149 Object.keys(updatedStyles).forEach((key) => {
150 if (updatedStyles[key]) {
151 const itemKey = `item-${key}`;
152 if (!childStyles[itemKey]) {
153 hasStyleChange = true;
154 }
155 newStyles[itemKey] = true;
156 }
157 });
158 if (!hasStyleChange && Object.keys(newStyles).length !== Object.keys(childStyles).length) {
159 hasStyleChange = true;
160 }
161 if (hasStyleChange) {
162 this.itemStyles.set(tagName, newStyles);
163 forceUpdate(this);
164 }
165 }
166
167 connectedCallback() {
168 this.hasStartEl();

Callers

nothing calls this directly

Calls 2

setMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected