| 79 | ? React.Children.toArray(children)[selectedIndex] |
| 80 | : undefined |
| 81 | const getChildIcon = (childArg: React.ReactNode) => { |
| 82 | if ( |
| 83 | React.isValidElement<SegmentedControlButtonProps>(childArg) && |
| 84 | childArg.type === Button && |
| 85 | childArg.props.leadingIcon |
| 86 | ) { |
| 87 | return childArg.props.leadingIcon |
| 88 | } |
| 89 | |
| 90 | return React.isValidElement<SegmentedControlIconButtonProps>(childArg) ? childArg.props.icon : null |
| 91 | } |
| 92 | const getChildText = (childArg: React.ReactNode) => { |
| 93 | if (React.isValidElement<SegmentedControlButtonProps>(childArg) && childArg.type === Button) { |
| 94 | return childArg.props.children |