/**
 * Splash Screen
 */

import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { Container } from '../components';
import { initRequest } from '../actions';
import { Linking, AsyncStorage, Platform } from 'react-native';
import SplashScreen from 'react-native-splash-screen';
export interface Props {
  init: any;
  navigation: any;
}

class LandingScreen extends React.PureComponent<Props> {
  constructor(props: Props) {
    super(props);
    props.init();
  }

  componentDidMount = () => {
    Linking.addEventListener('url', this.handleOpenURL);
    Linking.getInitialURL().then(url => {
      if (url) {
        this.handleOpenURL(url);
      } else {
        this.handleOpenURL(url);
        //  this.props.init();
      }
    });
  };
  handleOpenURL = async (event: any) => {
   
  };

  render = () => {
    return (
      <Container
        transparentStatusBar
        statusBarColor="transparent"
        safeAreaView={false}
      />
    );
  };
}

function mapStateToProps() {
  return {};
}

function mapDispatchToProps(dispatch: any) {
  return bindActionCreators({ init: initRequest }, dispatch);
}

export default connect(mapStateToProps, mapDispatchToProps)(LandingScreen);
