import React from 'react'; import { StyleSheet, View, Text, GestureResponderEvent, ActivityIndicator, Linking, TextInput, Slider, Image, Dimensions } from 'react-native'; import { FontAwesome } from '@expo/vector-icons'; import { getStatusBarHeight, getBottomSpace } from '../helper'; import { LatLng } from '../Api/interfaces'; import { COLORS_FRACTION, COLORS_LVL, RESO_NRG } from '../constants'; const { width, height } = Dimensions.get("screen") type Props = { goToMe: (e: GestureResponderEvent) => void; refresh: (e: GestureResponderEvent) => void; onOpenPortal: (guid: string, coords: LatLng) => void; getPortalDetails: (guid: string) => void; loading: Number; selectedPortal: any; portal: any; } export default class extends React.Component { componentWillReceiveProps(next) { if (this.props.selectedPortal !== next.selectedPortal && next.selectedPortal && next.selectedPortal.guid) { this.props.getPortalDetails(next.selectedPortal.guid) } } render() { const props = this.props const portal = this.props.portal return ( <> {props.loading > 0 ? ( ) : null} {props.selectedPortal ? ( {portal.name} Уровeнь: {portal.level}, здоровье: {portal.power} Владелец: {portal.owner || 'нет'} Резонаторы: {portal.resonators && portal .resonators .filter(r => !!r) .map((r, idx) => ([{r[1]}]))} {/* { props.onOpenPortal(props.selectedPortal.guid, props.selectedPortal.coords) }} iconStyle={styles.icon} color={"#000"} size={32} backgroundColor={"transparent"} /> */} { props.onOpenPortal(props.selectedPortal.guid, props.selectedPortal.coords) }} iconStyle={styles.icon} color={"#000"} size={32} backgroundColor={"transparent"} /> ) : null} ); } } const styles = StyleSheet.create({ overlayLeft: { position: 'absolute', top: getStatusBarHeight() + 20, left: 8, }, overlayRight: { position: 'absolute', top: getStatusBarHeight() + 20, right: 8, }, button: { justifyContent: 'center', alignItems: 'center', height: 48, width: 48, }, panelButton: { justifyContent: 'center', alignItems: 'center', height: 100, width: 64, }, buttonWrapper: { margin: 8, //ios shadowOpacity: 0.3, shadowRadius: 3, shadowOffset: { height: 0, width: 0 }, //android elevation: 1 }, panel: { position: 'absolute', bottom: 0, left: 0, right: 0, backgroundColor: '#fff', flexDirection: 'row', alignItems: 'center', overflow: 'hidden', borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: '#000', padding: 0, height: 100, //ios shadowOpacity: 0.6, shadowRadius: 6, shadowOffset: { height: 0, width: 0 }, //android elevation: 1 }, column: { flexGrow: 1, padding: 8, width: (width - 124) }, icon: { marginRight: 0, }, loader: { margin: 8, paddingHorizontal: 8, }, title: { fontWeight: 'bold', }, subtitle: { fontWeight: 'normal', }, user: { fontWeight: 'bold', }, photo: { width: 55, height: 100, } });