import React, { Component } from 'react' import { StyleSheet, View, Dimensions, Platform, ScrollView, } from 'react-native' import {WebView} from 'react-native-webview'; import { connect } from 'react-redux' import { ImageBaseUrl } from '../../../utils/fetch/Fetchx' const { width, height } = Dimensions.get('window') @connect(({ detail }) => ({ ...detail })) class Details extends Component { gotoDetail = () => { this.props.dispatch(NavigationActions.navigate({ routeName: 'Detail' })) } constructor() { super() this.state = { WebViewHeight: 0, } } render() { const { detailDatas } = this.props let html = detailDatas.description html = html ? html.replace( /src=\"\/g1\//g, `style="max-width:${width - 20}px; max-height:${height - 100}px;" src="${ImageBaseUrl}/g1/` ) : '' let html5 = ` ${html}` let source = {html: html5} if(Platform.OS !== 'ios'){ source.baseUrl = '' } return ( {/* */} { this.setState({ WebViewHeight: info.url.replace('about:blank%23', '') / 1, }) }} /> {/* */} ) } } const styles = StyleSheet.create({ container: { flex: 1, }, headerFont: { fontSize: 14, color: '#333', lineHeight: 20, }, icon: { width: 32, height: 32, }, tabView: { flex: 1, // padding: 15, backgroundColor: 'rgba(0,0,0,0.01)', }, card: { borderWidth: 1, backgroundColor: '#fff', borderColor: 'rgba(0,0,0,0.1)', margin: 5, // height: 150, padding: 15, shadowColor: '#ccc', shadowOffset: { width: 2, height: 2 }, shadowOpacity: 0.5, shadowRadius: 3, }, }) export default Details