Created
February 22, 2017 12:03
-
-
Save hannigand/36368254d9d89746d24d0d277e57844e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getActiveItems() { | |
const { filterVideos, videos, structuredVideos, unstructuredVideos} = this.state; | |
let item = null; | |
let activeItem = null; | |
if(!filterVideos || filterVideos === 'all') { | |
item = videos | |
activeItem = 'all'; | |
} else if (filterVideos === 'structured') { | |
item = structuredVideos; | |
activeItem = 'structured'; | |
} else if ( filterVideos === 'unstructured') { | |
item = unstructuredVideos; | |
activeItem = 'unstructured'; | |
} | |
return { item, activeItem } | |
} | |
render() { | |
const { item, activeItem } = this.getActiveItems(); | |
return ( | |
<View> | |
<ScrollView> | |
<View style={ styles.container }> | |
<InfoBar | |
message="Please note, your CPD record can take up to 24 hours to update" | |
/> | |
<TabBar | |
filterVideos={ this.filterVideos } | |
setActive={ activeItem } /> | |
{ | |
item | |
.map(video => | |
<PlaylistItem | |
style={ { flex: 1 } } | |
key={ video.id } | |
video={ video } | |
updateStatement={ this.updateStatement } | |
/> | |
) | |
} | |
</View> | |
</ScrollView> | |
</View> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment