Authored by 孙凯

YH_Image replace Image review by hongmo

... ... @@ -8,6 +8,7 @@ const {
const {
NativeModules,
Image,
} = ReactNative;
const YH_ImageView = ReactNative.requireNativeComponent('YH_ImageView', null);
... ... @@ -21,10 +22,19 @@ export default class YH_Image extends Component {
}
render() {
return (
<YH_ImageView
{...this.props}
/>
);
if (Platform.OS === 'ios') {
return (
<YH_ImageView
{...this.props}
/>
);
}else {
return (
<Image
source={{uri: this.props.url}}
{...this.props}
/>
);
}
}
}
... ...
'use strict';
import ReactNative from 'react-native';
import HomeService from '../../services/Home';
import HomeService from '../../services/HomeService';
import store from 'react-native-simple-store';
const {
... ...
... ... @@ -22,7 +22,7 @@ let InitialState = Record({
boy: templet,
girl: templet,
kid: timplet,
kid: templet,
lifeStyle: templet,
});
... ...
... ... @@ -3,10 +3,10 @@
import React from 'react';
import ReactNative from 'react-native';
import Immutable, {Map} from 'immutable';
import YH_Image from '../../../common/components/YH_Image';
const {
View,
Image,
Text,
TouchableOpacity,
Dimensions,
... ... @@ -66,10 +66,10 @@ export default class DoubleImage extends React.Component {
return(
<View style={{flexDirection: 'row',width: width,height: backgroundHeight,backgroundColor: 'white',}}>
<TouchableOpacity onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType1,linkReource1)}} >
<Image
source={{uri: backgroundImage1}}
<YH_Image
url={backgroundImage1}
style={styles.thumbnail}
></Image>
></YH_Image>
{linkType1=='1'?<View style={styles.titleView}>
<Text style={styles.title}>{name1}</Text>
<View style={styles.saleView}>
... ... @@ -80,10 +80,10 @@ export default class DoubleImage extends React.Component {
</TouchableOpacity>
<TouchableOpacity onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType2,linkReource2)}} >
<Image
source={{uri: backgroundImage2}}
<YH_Image
url={backgroundImage2}
style={styles.thumbnail}
></Image>
></YH_Image>
{linkType2=='1'?<View style={styles.titleView}>
<Text style={styles.title}>{name2}</Text>
<View style={styles.saleView}>
... ...
... ... @@ -6,6 +6,7 @@ import Immutable, {Map} from 'immutable';
import DeviceInfo from 'react-native-device-info';
import {getSlicedUrl} from '../../../classify/utils/Utils';
import {removeHTMLTag} from '../../utils/Helper';
import YH_Image from '../../../common/components/YH_Image';
const {
View,
... ... @@ -120,8 +121,8 @@ export default class Header extends React.Component {
return (
<View style={{width: width, height: cellHeight}}>
<Image
source={{uri: backgroundImage}}
<YH_Image
url={backgroundImage}
style={{width, height: imageHeigth }}
/>
... ... @@ -135,8 +136,8 @@ export default class Header extends React.Component {
</View>
<Text style={styles.number}>{numberOfFav}</Text>
<Image
source={{uri: brandIcon}}
<YH_Image
url={brandIcon}
style={styles.brandIcon}
/>
... ...
... ... @@ -4,10 +4,10 @@ import React from 'react';
import ReactNative from 'react-native';
import Swiper from 'react-native-swiper';
import ImmutablePropTypes from 'react-immutable-proptypes';
import YH_Image from '../../../common/components/YH_Image';
const {
View,
Image,
TouchableOpacity,
StyleSheet,
Dimensions,
... ... @@ -73,8 +73,8 @@ export default class RedBrandSwiper extends React.Component {
this.props.onPressSlideItem && this.props.onPressSlideItem(data[0].linkType,data[0].resource);
}}
>
<Image
source={{uri: data[0].pic}}
<YH_Image
url={data[0].pic}
style={{ width: width, height: swiperHeight}}
/>
</TouchableOpacity>
... ... @@ -102,8 +102,8 @@ export default class RedBrandSwiper extends React.Component {
this.props.onPressSlideItem && this.props.onPressSlideItem(item.linkType,item.resource);
}}
>
<Image
source={{uri: item.pic}}
<YH_Image
url={item.pic}
style={{width: width, height: swiperHeight}}
/>
</TouchableOpacity>
... ...
... ... @@ -3,10 +3,10 @@
import React from 'react';
import ReactNative from 'react-native';
import Immutable, {Map} from 'immutable';
import YH_Image from '../../../common/components/YH_Image';
const {
View,
Image,
Text,
TouchableOpacity,
Dimensions,
... ... @@ -59,8 +59,8 @@ export default class SingleImage extends React.Component {
this.props.onPressProduct && this.props.onPressProduct(linkType,linkReource);
}}>
<View style={{width: backgroundWidth, height:backgroundHeight,backgroundColor: 'white'}}>
<Image
source={{uri: backgroundImage}}
<YH_Image
url={backgroundImage}
style={{width: backgroundWidth, height: imageHeight}}
/>
{linkType=='1'?<View style={{ width: width, height: 35,position: 'absolute',backgroundColor: 'rgba(0,0,0,0.3)',top: imageHeight-35,flexDirection: 'row',alignItems: 'center',justifyContent: 'space-around'}}>
... ...
import React, {Component } from 'react'
import { Image ,View, StyleSheet, Text, Dimensions,TouchableOpacity} from 'react-native';
import {View, StyleSheet, Text, Dimensions,TouchableOpacity} from 'react-native';
import Immutable, {Map} from 'immutable';
import YH_Image from '../../../common/components/YH_Image';
export default class RedPersonPicThree extends Component{
constructor(props) {
... ... @@ -68,28 +69,28 @@ export default class RedPersonPicThree extends Component{
return (
<View style={{flexDirection: 'row',width:width,height: isModuleMargin=='1'?containerHeigth4+nullHeigth:containerHeigth4,backgroundColor: 'white'}}>
<TouchableOpacity style={styles.imagetype4} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType1,linkReource1)}} >
<Image source={{uri: backgroundImage1}} style={styles.imagetype4}>
<YH_Image url={backgroundImage1} style={styles.imagetype4}>
{saleAble1?<View style={styles.maskContainer4}>
<Text numberOfLines={1} style={styles.titleText4}>{name1}</Text>
<Text style={styles.price4}>{price1}</Text>
</View>:null}
</Image>
</YH_Image>
</TouchableOpacity>
<TouchableOpacity style={styles.imagetype4} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType2,linkReource2)}} >
<Image source={{uri: backgroundImage2}} style={styles.imagetype4}>
<YH_Image url={backgroundImage2} style={styles.imagetype4}>
{saleAble2?<View style={styles.maskContainer4}>
<Text numberOfLines={1} style={styles.titleText4}>{name2}</Text>
<Text style={styles.price4}>{price2}</Text>
</View>:null}
</Image>
</YH_Image>
</TouchableOpacity>
<TouchableOpacity style={styles.imagetype4} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType3,linkReource3)}} >
<Image source={{uri: backgroundImage3}} style={styles.imagetype4}>
<YH_Image url={backgroundImage3} style={styles.imagetype4}>
{saleAble3?<View style={styles.maskContainer4}>
<Text numberOfLines={1} style={styles.titleText4}>{name3}</Text>
<Text style={styles.price4}>{price3}</Text>
</View>:null}
</Image>
</YH_Image>
</TouchableOpacity>
</View>
)
... ... @@ -98,25 +99,25 @@ export default class RedPersonPicThree extends Component{
return (
<View style={{flexDirection: 'row',width:width,height: isModuleMargin=='1'?containerHeigth3+nullHeigth:containerHeigth3,backgroundColor: 'white'}}>
<TouchableOpacity style={styles.imagetype3} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType1,linkReource1)}} >
<Image source={{uri: backgroundImage1}} style={styles.imagetype3}>
<YH_Image url={backgroundImage1} style={styles.imagetype3}>
{saleAble1?<View style={styles.maskContainer3}>
<Text style={styles.price3}>{price1}</Text>
</View>:null}
</Image>
</YH_Image>
</TouchableOpacity>
<TouchableOpacity style={styles.imagetype3} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType2,linkReource2)}} >
<Image source={{uri: backgroundImage2}} style={styles.imagetype3}>
<YH_Image url={backgroundImage2} style={styles.imagetype3}>
{saleAble2?<View style={styles.maskContainer3}>
<Text style={styles.price3}>{price2}</Text>
</View>:null}
</Image>
</YH_Image>
</TouchableOpacity>
<TouchableOpacity style={styles.imagetype3} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType3,linkReource3)}} >
<Image source={{uri: backgroundImage3}} style={styles.imagetype3}>
<YH_Image url={backgroundImage3} style={styles.imagetype3}>
{saleAble3?<View style={styles.maskContainer3}>
<Text style={styles.price3}>{price3}</Text>
</View>:null}
</Image>
</YH_Image>
</TouchableOpacity>
</View>
)
... ... @@ -126,29 +127,29 @@ export default class RedPersonPicThree extends Component{
<View style={{flexDirection: 'row',width:width,height: isModuleMargin=='1'?containerHeigth+nullHeigth:containerHeigth,backgroundColor: 'white'}}>
<View style={styles.subContainer}>
<TouchableOpacity style={styles.image} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType1,linkReource1)}} >
<Image source={{uri: backgroundImage1}} style={styles.image}>
<YH_Image url={backgroundImage1} style={styles.image}>
{saleAble1?<View style={styles.maskContainer1}>
<Text numberOfLines={2} style={styles.titleText}>{name1}</Text>
<Text style={styles.price}>{price1}</Text>
</View>:null}
</Image>
</YH_Image>
</TouchableOpacity>
<TouchableOpacity style={styles.image} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType2,linkReource2)}} >
<Image source={{uri: backgroundImage2}} style={styles.image}>
<YH_Image url={backgroundImage2} style={styles.image}>
{saleAble2?<View style={styles.maskContainer1}>
<Text numberOfLines={2} style={styles.titleText}>{name2}</Text>
<Text style={styles.price}>{price2}</Text>
</View>:null}
</Image>
</YH_Image>
</TouchableOpacity>
</View>
<TouchableOpacity style={styles.imageBig} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType3,linkReource3)}} >
<Image source={{uri: backgroundImage3}} style={styles.imageBig}>
<YH_Image url={backgroundImage3} style={styles.imageBig}>
{saleAble3?<View style={styles.maskContainer2}>
<Text numberOfLines={2} style={styles.titleText}>{name3}</Text>
<Text style={styles.price}>{price3}</Text>
</View>:null}
</Image>
</YH_Image>
</TouchableOpacity>
</View>
)
... ... @@ -158,30 +159,30 @@ export default class RedPersonPicThree extends Component{
<View style={{flexDirection: 'row',width:width,height: isModuleMargin=='1'?containerHeigth+nullHeigth:containerHeigth,backgroundColor: 'white'}}>
<TouchableOpacity onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType1,linkReource1)}} >
<View style={styles.subContainer}>
<Image source={{uri: backgroundImage1}} style={styles.imageBig}>
<YH_Image url={backgroundImage1} style={styles.imageBig}>
{saleAble1?<View style={styles.maskContainer2}>
<Text numberOfLines={2} style={styles.titleText}>{name1}</Text>
<Text style={styles.price}>{price1}</Text>
</View>:null}
</Image>
</YH_Image>
</View>
</TouchableOpacity>
<View style={styles.subContainer}>
<TouchableOpacity style={styles.image} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType2,linkReource2)}} >
<Image source={{uri: backgroundImage2}} style={styles.image}>
<YH_Image url={backgroundImage2} style={styles.image}>
{saleAble2?<View style={styles.maskContainer1}>
<Text numberOfLines={2} style={styles.titleText}>{name2}</Text>
<Text style={styles.price}>{price2}</Text>
</View>:null}
</Image>
</YH_Image>
</TouchableOpacity>
<TouchableOpacity style={styles.image} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType3,linkReource3)}} >
<Image source={{uri: backgroundImage3}} style={styles.image}>
<YH_Image url={backgroundImage3} style={styles.image}>
{saleAble3?<View style={styles.maskContainer1}>
<Text numberOfLines={2} style={styles.titleText}>{name3}</Text>
<Text style={styles.price}>{price3}</Text>
</View>:null}
</Image>
</YH_Image>
</TouchableOpacity>
</View>
</View>
... ...
... ... @@ -4,11 +4,12 @@ import React from 'react';
import ReactNative from 'react-native';
import Immutable, {Map} from 'immutable';
import {GetQueryString} from '../../utils/Helper';
import YH_Image from '../../../common/components/YH_Image';
const {
View,
Image,
Text,
Image,
TouchableOpacity,
Dimensions,
StyleSheet,
... ... @@ -62,10 +63,10 @@ export default class Video extends React.Component {
onPress={() => {
this.props.onPressVideo && this.props.onPressVideo(room,bgpic);
}}>
<Image
source={{uri: videoImage}}
<YH_Image
url={videoImage}
style={styles.thumbnail}
></Image>
></YH_Image>
</TouchableOpacity>
<View style={styles.icon}>
<Image source={require('../../image/shared_view_icon.png')} style={styles.eyeImage}></Image>
... ...