import * as React from 'react'; import {useState, useEffect} from 'react'; import { connect } from "react-redux"; import { SafeAreaView, Button, View, Text, Image, ScrollView, StyleSheet, TouchableOpacity } from 'react-native'; import {useNetInfo} from "@react-native-community/netinfo"; import NetInfo from "../../components/netstatus"; // import NetInfo from "@react-native-community/netinfo"; import CustomHeader from '../../components/header.js'; import Assets from '../../components/assets.manager.js'; import Elements from '../../components/elements.js'; import Theme from '../../components/theme.style.js'; import {Icon} from 'react-native-elements'; import DB from '../../components/storage/'; import REQUEST from '../../components/api/'; import CustomSafeArea from '../../components/safeArea.component'; const Content = require("./aboutus.json"); class About extends React.Component { constructor(props) { super(props) } state = { drop1: false, drop2: false, data: {}, connected: false } componentDidMount() { this.initAbount() } componentWillUnmount() { } initAbount = () => { NetInfo.netstatus(isConnected => { if(isConnected) { this.init() } else { Elements.nointernet2(this.props) } }) } init = async () => { this.setState({ connected: true }) await REQUEST("contact_us", "get", {}, {}, {}, async (res) => { if(res.status == 1 && res.data) { this.setState({ data: res.data }) } }, (err) => { Alert.alert("Information", `\n${err.message}`); }, "ContactOptions", "Fetch") } fetch = (detail) => { if(!this.state.connected) return null let r = "" let d = detail.split(`"`) for(var x=0;x { if(!this.state.connected) return null return ( this.setState({ drop1: !this.state.drop1 })}> WHAT WE DO {this.state.drop1 ? {this.fetch(this.state.data.what_we_do_content)} : null} this.setState({ drop2: !this.state.drop2 })}> WHY UNIOIL {this.state.drop2 ? {this.fetch(this.state.data.why_unioil_content)} : null} ) } render() { return ( {this.state.connected ? WHO WE ARE {this.state.data.who_we_are_content} {this.renderDetails()} : null } ); } } const mapStateToProps = (state) => { return { app_theme: state.appThemeReducer.theme } } export default connect(mapStateToProps, null)(About);