content: 
  'use strict';
  
  import React, { Component } from 'react';
  import{
      StyleSheet,
      View,
      Image,
      ScrollView,
      Dimensions,
      TouchableOpacity,
      Text,
      AlertIOS,
      AsyncStorage,
    } from 'react-native';
    import styleConfig from '../../components/styleConfig';
    import ImpactLeagueCode from '../ImpactLeague/ImpactLeagueCode'
    import ScrollableTabView, { ScrollableTabBarLeaderBoard, } from 'react-native-scrollable-tab-view';
    import Icon from 'react-native-vector-icons/FontAwesome';
    import commonStyles from '../styles';
    var deviceWidth = Dimensions.get('window').width;
    import LoginBtn from '../login/LoginBtns';
    var deviceHeight = Dimensions.get('window').height;
    import LeaderBoard from './leaderBoardData';
   var base64Icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAABICAYAAACqT5alAAAABGdBTUEAALGPC/xhBQAABOFJREFUeAHtmlmIFEcYx2dUxDt4YTSieCAqHkgkJARU9EFFgygeICIi+qCgQRHFh4CQhzwsgSiJeGD0yQNR8SDg8WBWvFZNRFkkEW/BCKsuisQcuvl9Zqbt6emq6aquaWd2+4P/dPVX31lfV3X1dGcyhtTU1HQdVAotNgw/08pUodrl04SrvYKl4k8rXGqEqr0/y3K7hSQ+NEhkIrKdDeTLKforxu8bONguCd9CYaCBUjWLrkzncDWXL0rs76PCLwhsCtgcJUDXMu8j4Z3ZbPY4iawHL10nVMpeG43AVvoehPSvgNcrhB+VJXYzJP2cBXMPzSVRFUPkDsCTlTpIC2AMDTLfnssqDcLoszAFBOM8PNT6bWJrbJhjA95Cv718G/3DChsrkr6k5Z7vEVW+zMkvHiOBhlzSTQo/WQU/CvsZQrvBY/AEPM0df+YYpNkwhoFuoHsOYzlOBbakKuQbSbgBDAqx3DOEF5W1ieptiCKM3B3kBB5xOUrAjcB2R9fDM1bYaBDDjwp53lnoHPZ69Y2FBD1AL6LtXU2vVbL47YDuaIX1R5LwNUXnEpRtV2NJ9iL6RoOGfGvwPbo1ipiisFch1D5E8DW8+gwOPgYqOhRURNBklf4T+XlBG2HnyHUG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
       
  
        constructor(props) {
          super(props);
          this.state = {
            RouteImpactleague:'',
          };
        }
  
  
        componentDidMount() {
         this.props.getUserData(); 
        }
  
        navigateToImpactLeague(){
            AsyncStorage.multiGet(['UID234'], (err, stores) => {
                stores.map((result, i, store) => {
                    let key = store[i][0];
                    let val = store[i][1];
                    let user = JSON.parse(val);
                    this.setState({
                        user: user,
                    })
                  if (this.state.user.team_code === 0) {
                    this.setState({
                      RouteImpactleague:'impactleaguecode'
                    })
                  }else{
                  this.setState({
                    RouteImpactleague:'impactleaguehome'
                  })
  
                 }
                this.props.navigator.push({
                id:this.state.RouteImpactleague,
                navigator: this.props.navigator,
                passProps:{user:this.props.user, getUserData:this.props.getUserData}
                })
                })
            })    
          
        }
  
        renderLeaderboadScreen(){
          if (this.props.user != null) {
           return(
            <LeaderBoard user={this.props.user} />
            )
          }else{
          return(
            <View style={{justifyContent: 'center', alignItems: 'center', width:deviceWidth,height:deviceHeight,paddingTop:(deviceHeight/2)-150,}}>
            <Text style={{fontFamily: 'Montserrat-Regular',bottom:50,fontSize:16,}}>Please Login To See Leaderboard</Text>
            <LoginBtn getUserData={this.props.getUserData}/>
            </View>
            )
          }
        }
  
        renderImpactLeagueIcon(){
          if (this.props.user != null) {
          return(
             <TouchableOpacity style={{height:70,width:70,backgroundColor:'transparent',justifyContent: 'center',alignItems: 'center',}} onPress={()=>this.navigateToImpactLeague()} >
               <Image style={{height:20,width:20,top:5}} source={{uri: base64Icon, scale:3}} ></Image>
              </TouchableOpacity>
            );
           }else{
            return;
           }
        }
  
  		  render() {
  		    return (
            <View>
           
              <View style={commonStyles.Navbar}>
                <Text style={commonStyles.menuTitle}>Leaderboard</Text>
                <View style={{position:'absolute',right:0,top:0,}}>{this.renderImpactLeagueIcon()}</View>
              </View>
              <View style= {styles.textlast7daysWrap}>
                <Text style={styles.last7dayText}>Most Kms last 7 days </Text>
              </View>
                 <View >{this.renderLeaderboadScreen()}</View>
            </View>
  			  );
  	    }
  }
  var styles = StyleSheet.create({
    scrollTabWrapper:{
      position:'relative',
      width:deviceWidth,
      backgroundColor:'white',
      height:deviceHeight,
      top:0,
    },
    textlast7daysWrap:{
      height:30,
      marginBottom:8,
      justifyContent: 'center',
      alignItems: 'center',
      width:deviceWidth,
      backgroundColor:'white',
      shadowColor: '#000000',
      shadowRadius:4,
      shadowOpacity: 0.1,
      shadowOffset: {
        height: 0,
      },
    },
    last7dayText:{
      color:styleConfig.greyish_brown_two,
      fontSize:15,
      fontWeight:'400',
      fontFamily:styleConfig.FontFamily,
    }
    })
  export default Leaderboard;