import React, { Component, PureComponent } from 'react'; import { StyleSheet, View, Text, GestureResponderEvent, ActivityIndicator, Image, Dimensions, Button, Linking } from 'react-native'; // import { Button } from 'react-native-vector-icons/FontAwesome'; import { getStatusBarHeight } from '../helper'; import { connect } from 'react-redux'; import actions from '../Actions/actions'; import { Portal } from '../Api/types'; import { bindActionCreators } from 'redux'; import { COLORS_FRACTION, RESO_NRG, COLORS_LVL, COLORS_MOD, MOD_TYPE, NavTo } from '../constants'; type Props = { guid: string portal?: Portal } const { width, height } = Dimensions.get("screen") class PortalPanel extends PureComponent { static navigationOptions = ({ navigation }) => { return { title: 'Информация о портале', }; }; componentDidMount() { this.props.getPortalDetails(this.props.guid) } componentWillReceiveProps(next: Props) { if (next.guid != this.props.guid) { this.props.getPortalDetails(next.guid) } } render() { const { portal } = this.props if (!portal) { return } return ( {portal.name} Уровeнь: {portal.level}, здоровье: {portal.power} Владелец: {portal.owner || 'нет'} Дата: {portal.timestamp && (new Date(portal.timestamp)).toLocaleString()} Адрес: {portal.address || 'загрузка...'} Резонаторы {portal.resonators && portal.resonators.map((r, idx) => r ? ({idx + 1}: {r[1]} [{r[2]}/{RESO_NRG[r[1]]}] - {r[0]}) : ({idx + 1}: нет) )} {(!portal.resonators || portal.resonators.length == 0) && (нет)} Моды {portal.mods && portal.mods.map((r, idx) => r ? ({idx + 1}: {MOD_TYPE[r[1]] || r[1]} [{r[2]}] - {r[0]}) : ({idx + 1}: нет) )} Навигация к порталу