import * as React from 'react'; import {useState, useEffect} from 'react'; import {View, Text, TouchableOpacity, Image, ImageBackground} from 'react-native'; import Theme from '../theme.style'; import Assets from '../assets.manager'; import Icon from '../icons.js'; import DB from '../storage'; import { exp } from 'react-native-reanimated'; const styles = { borderedButton: { padding: 5, borderColor: '#fff', borderRadius: 5, borderWidth: 2, height: 45, width: 130, margin: 5, justifyContent: 'center' }, textBig: { } } class Header extends React.PureComponent { constructor(props) { super(props) this.btnstyle = { marginLeft: 10 }; this.name = '' this.cardnumber = '' this.points = '' } state = { profile: {} } componentDidMount() { this.init() } componentWillUnmount() { } init = async () => { let stored = await DB.profile() this.setState({ profile: stored }) this.name = stored && stored?.data ? stored.data : {} this.cardnumber = stored && stored?.data ? stored.data.card_number : '' this.points = stored && stored?.data ? stored.data.points : '' } openDrawer = () => { this.props.navigation.openDrawer() } render() { return ( this.openDrawer()}> Guest Points: {Theme.formatter.CRNCY(0)} My Transactions My Card ) } } export default Header // export default function Header({navigation, reload}){ // const openDrawer = () => { navigation.navigation.openDrawer();} // const btnstyle = {marginLeft: 10}; // const navigate = (screen, onBackPress) => { // // navigation.navigate("MyProfile", {screen: screen == "mycard" ? "ProfileCardTab" : "ProfileTransactionsTab", params: "card"}) // navigation.navigation.navigate('MyProfile', { // tab: screen == "mycard" ? "ProfileCardTab" : "ProfileTransactionsTab", // onBackPress: onBackPress // }); // } // const [profile, setprofile] = useState({}) // const init = async () => { // let stored = await DB.profile() // setprofile(stored) // } // useEffect(() => { // init() // }, []) // // console.log("PROFILE FROM EMPTY", profile) // let name = profile && profile?.data ? profile.data : {} // let cardnumber = profile && profile?.data ? profile.data.card_number : '' // let points = profile && profile?.data ? profile.data.points : '' // return ( // // // // // // // // // // // // // // // Guest // // // // // Points: {Theme.formatter.CRNCY(0)} // // // // // // // My Transactions // // // My Card // // // // // // // ); // }