{"size": 2022, "ext": "js", "max_stars_repo_path": "JQBuyMall/Component/Home/CustomHomeBanerView.js", "max_stars_repo_name": "JQHee/ReactNative", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "JQBuyMall/Component/Home/CustomHomeBanerView.js", "max_issues_repo_name": "JQHee/ReactNative", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "JQBuyMall/Component/Home/CustomHomeBanerView.js", "max_forks_repo_name": "JQHee/ReactNative", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.4666666667, "max_line_length": 111, "alphanum_fraction": 0.4920870425}
/**
 * Created by hjq on 2017/4/6.
 */
import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    Image,
    TouchableOpacity,
    Alert,
    TouchableHighlight
} from 'react-native';

var Swiper = require('react-native-swiper');


//参数的传递使用props
var Slider = React.createClass({

    _loadWeb:function(title,loadurl){
        alert(title + loadurl);
    },

    render: function(){
        var thiz = this;
        return (
            <Swiper style={Styles.wrapper}
                    showsButtons={false}
                    paginationStyle={{bottom:10}}
                    autoplayTimeout={3.0}
                    autoplay={true}
                    height={140}
                    showsPagination={true}
                    dot={this._indexView('gray')}
                    activeDot={this._indexView('red')}
            >
                {this.props.banners.map(function(banner){
                    return (
                        <TouchableHighlight key={banner} onPress={()=>thiz._loadWeb(banner,'')}>
                            <Image style={[Styles.slide,]} source={{uri: 'icon_tabbar_mine_selected'}}></Image>
                        </TouchableHighlight>
                    );
                })}
            </Swiper>
        );
    },

    _indexView(color){
        let view = <View style={[Styles.swiperIndexView, {backgroundColor:color}]}></View>;
        return view;
    }
});

const Styles = {

    swiperIndexView:{
        width:8,
        height:8,
        borderRadius:4,
        marginLeft:3,
        marginRight:3
    },

    //slider
    row:{
        flexDirection:'row',
    },
    wrapper: {
        height:125,
    },
    flex1:{
        flex:1,
    },
    center:{
        alignItems:'center',
        justifyContent: 'center',
    },
    slide: {
        height:125,
        resizeMode: Image.resizeMode.stretch,
    },
    adv: {
        height:145,
        resizeMode: Image.resizeMode.stretch,
    },
};

module.exports = Slider;