Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//scrolling-statistics-row.tsx
export type KeyedStatisticRenderer = { key: string, render: StatisticRenderer }
export function keyedRenderer(key: string, renderer: StatisticRenderer): KeyedStatisticRenderer { return { key, render: renderer } }
const WatchlistStatisticRenderers = {
[WatchlistColumn.EstimatedEarnings]: keyedRenderer('watchlist-estimated-earnings', createStatisticFieldRenderer(() => 0))
[WatchlistColumn.Range]: keyedRenderer('watchlist-range', RangeFieldRenderer)
}
<AnimatedSyncedHorizontalScrollView offsetObserver={this.props.offsetObserver} style={this.props.style} onPress={this.props.onPress}>
{this.props.columnRenderers.map((renderer, index) => (
<View
key={renderer.key}
style={[{ width: this.columnWidth }, Styles.container]}
>
{renderer.render({ quote: this.props.quote, positionStatistic: this.props.positionStatistic })}
</View>
))}
</AnimatedSyncedHorizontalScrollView>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment