MCPcopy Index your code
hub / github.com/nodegui/react-nodegui / setTabItemProps

Function setTabItemProps

src/components/TabItem/RNTabItem.ts:13–37  ·  view source on GitHub ↗
(
  tabItem: RNTabItem,
  parentTab: RNTab,
  newProps: TabItemProps,
  oldProps: TabItemProps
)

Source from the content-addressed store, hash-verified

11 * @ignore
12 */
13export const setTabItemProps = (
14 tabItem: RNTabItem,
15 parentTab: RNTab,
16 newProps: TabItemProps,
17 oldProps: TabItemProps
18) => {
19 if (!tabItem.actualTabWidget) {
20 return;
21 }
22 const tabIndex = parentTab.indexOf(tabItem.actualTabWidget);
23 if (tabIndex < 0) {
24 console.error("TabItem is not part of the parent tab it references to");
25 return;
26 }
27
28 const setter: TabItemProps = {
29 set title(text: string) {
30 parentTab.setTabText(tabIndex, text);
31 },
32 set icon(qicon: QIcon) {
33 parentTab.setTabIcon(tabIndex, qicon);
34 }
35 };
36 Object.assign(setter, newProps);
37};
38
39/**
40 * @ignore

Callers 3

appendInitialChildMethod · 0.90
insertBeforeMethod · 0.90
setPropsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected