Skip to content

Instantly share code, notes, and snippets.

@dmoss18
Last active April 23, 2020 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmoss18/95abe6aba4b1e4084c65bc70b0406dec to your computer and use it in GitHub Desktop.
Save dmoss18/95abe6aba4b1e4084c65bc70b0406dec to your computer and use it in GitHub Desktop.
//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