import React, {Component, Fragment} from 'react'; import Divider from '@material-ui/core/Divider'; import EmbarkJS from 'Embark/EmbarkJS'; import IdentityFactory from 'Embark/contracts/IdentityFactory'; import IdentityGasRelay from 'Embark/contracts/IdentityGasRelay'; import PropTypes from 'prop-types'; import Status from './status'; import Tab from '@material-ui/core/Tab'; import Tabs from '@material-ui/core/Tabs'; import {Typography} from '@material-ui/core'; import {withStyles} from '@material-ui/core/styles'; const styles = {}; class Body extends Component { constructor(props){ super(props); this.state = { tab: 0, identityAddress: null }; } componentDidMount(){ EmbarkJS.onReady(err => { if(err) { console.error(err); return; } this.setState({ identityAddress: IdentityGasRelay.options.address }); }); } handleChange = (event, tab) => { this.setState({tab}); }; newIdentity = (cb) => { let toSend = IdentityFactory.methods['createIdentity()'](); toSend.estimateGas() .then(estimatedGas => { return toSend.send({gas: estimatedGas + 100000}); }) .then((receipt) => { const instance = receipt.events.IdentityCreated.returnValues.instance; this.setState({identityAddress: instance}); cb(); }); } render(){ const {tab, identityAddress} = this.state; return {tab === 0 && One} {tab === 1 && Item Two} {tab === 2 && Item Three} ; } } function TabContainer(props) { return {props.children} ; } TabContainer.propTypes = { children: PropTypes.node.isRequired }; Body.propTypes = { classes: PropTypes.object.isRequired }; export default withStyles(styles)(Body);