| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import React, { Component } from 'react';
- import { Text, ListView, View } from 'react-native';
- import { Card, CardSection, Button } from '../../components/common';
- import { Actions } from 'react-native-router-flux';
- import Header from './Header';
- //import VideoPlayer from 'react-native-video-controls';
- class Videos extends Component {
- componentWillMount() {
- this.createDataSource(this.props);
- }
- componentWillReceiveProps(nextProps) {
- this.createDataSource(nextProps);
- }
- createDataSource({ videos }) {
- const ds = new ListView.DataSource({
- rowHasChanged: (r1, r2) => r1 !== r2
- });
- console.log(videos);
- this.dataSource = ds.cloneWithRows(videos);
- }
- renderHeader() {
- return <Header titulo={this.props.titulo} profesor={this.props.profesor} fecha={this.props.fecha} />;
- }
- playVideo(id) {
- Actions.ViewVideo({ id:id });
- }
- renderVideo({ video, titulo }) {
- return ( <Button onPress={this.playVideo.bind(this, video) }>{titulo}</Button> );
- }
- render() {
- return (
- <View>
- <ListView
- dataSource={this.dataSource}
- renderRow={this.renderVideo.bind(this)}
- />
- </View>
- );
- }
- }
- const styles = {
- texto: {
- fontSize: 12,
- }
- }
- export default Videos;
|