• react-native-video 视屏播放期的使用


    安装:yarn add react-native-video

    react-native link react-native-video

    import React, {
    Component
    } from 'react';

    import {
    StyleSheet,
    View,
    BackHandler,
    TouchableOpacity,
    Image,
    Text,
    ScrollView
    } from 'react-native';
    import { Button, InputItem, List,Icon,Checkbox } from '@ant-design/react-native';
    import Video from 'react-native-video';


    export default class WatchScreen extends Component {

    static navigationOptions = {
    header: null
    };

    componentWillMount() {
    BackHandler.addEventListener('hardwareBackPress', this.onBackAndroid);
    }

    componentWillUnmount() {
    BackHandler.removeEventListener('hardwareBackPress', this.onBackAndroid);
    }

    onBackAndroid = () => {
    this.props.navigation.goBack();
    return true;
    };

    render() {
    const {navigation} = this.props;
    return (
    <View>
    <View style={styles.header}>
    <View style={styles.flex1}>
    <TouchableOpacity onPress={() => navigation.openDrawer()} style={{alignSelf:'flex-start',marginLeft:10}}>
    <Image source={require('../../assets/images/logo.png')} style={styles.avatar} />
    </TouchableOpacity>
    </View>
    <View style={styles.flex1}>
    <Text style={styles.title}>看点</Text>
    </View>
    <View style={styles.flex1}>
    <TouchableOpacity onPress={() =>{
    navigation.navigate('FriendAdd')
    }} style={{alignSelf:'flex-end',marginRight:10}}>
    <Icon style={{color:'#fff',paddingLeft:10}} name={'eye'}/>
    </TouchableOpacity>
    </View>
    </View>
    <ScrollView>
    <View style={{'100%'}}>
    <List>
    <List.Item>
    <Text>周杰伦《告白气球》</Text>
    <Video
    source={require('../../assets/video/gbqq.mp4')}
    style={styles.fullScreen}
    />
    </List.Item>
    </List>
    </View>
    </ScrollView>
    </View>
    );
    }
    }


    const styles = StyleSheet.create({
    header: {
    height: 60,
    flexDirection: 'row',
    backgroundColor: '#0187FB',
    borderBottomWidth: 1,
    borderColor: '#ddd'
    },
    flex1: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    },
    avatar: {
    50,
    height: 50,
    borderRadius: 25
    },
    title: {
    fontSize: 20,
    color: '#fff'
    },
    add: {
    fontSize: 18,
    color: '#fff',
    },
    fullScreen: {
    flex:1,
    flexDirection: 'row',
    height:200,
    },
    });
  • 相关阅读:
    Datatables 在asp.net mvc
    VS Code开发调试.NET Core
    领域模型中的用户设计
    MVC数组模型绑定
    Java RMI(远程方法调用) 实例与分析 (转)
    oracle转mysql总结(转)
    Windows远程桌面连接Ubuntu 14.04 (转)
    oracle转Mysql中,varchar2(10)和number应该转换为什么类型? (转)
    MySQL与Oracle的语法区别详细对比 (转)
    python购物淫秽数据分析(2)
  • 原文地址:https://www.cnblogs.com/boonook/p/10364902.html
Copyright © 2020-2023  润新知