| 110 | } |
| 111 | |
| 112 | renderOption(option, key) { |
| 113 | const { selectedOption } = this.props; |
| 114 | |
| 115 | const isSelected = selectedOption && option.title === selectedOption.title; |
| 116 | |
| 117 | return ( |
| 118 | <TabMenuItem |
| 119 | key={key} |
| 120 | isSelected={isSelected} |
| 121 | item={option} |
| 122 | onItemPressed={option => this.handleOptionSelected(option)} |
| 123 | onLayoutMeasured={width => this.handleItemLayout(key, width)} |
| 124 | /> |
| 125 | ); |
| 126 | } |
| 127 | |
| 128 | render() { |
| 129 | const { style, options } = this.props; |
| 130 | |
| 131 | return ( |
| 132 | <ScrollView |
| 133 | horizontal |
| 134 | contentContainerStyle={style.container} |
| 135 | onScroll={this.handleScroll} |
| 136 | onLayout={this.handleScrollLayout} |
| 137 | ref={ref => { |
| 138 | this.scroll = ref; |
| 139 | }} |
| 140 | scrollEventThrottle={16} |
| 141 | showsHorizontalScrollIndicator={false} |
| 142 | style={style.list} |