( tabItem: RNTabItem, parentTab: RNTab, newProps: TabItemProps, oldProps: TabItemProps )
| 11 | * @ignore |
| 12 | */ |
| 13 | export 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 |
no outgoing calls
no test coverage detected