...
|
...
|
@@ -8,7 +8,9 @@ import ReactNative, { |
|
|
ListView,
|
|
|
TouchableOpacity,
|
|
|
StyleSheet,
|
|
|
Dimensions
|
|
|
Dimensions,
|
|
|
Animated,
|
|
|
Easing
|
|
|
} from 'react-native';
|
|
|
import Immutable, {Map, List} from 'immutable';
|
|
|
|
...
|
...
|
@@ -21,6 +23,10 @@ export default class ProductCell extends Component { |
|
|
super(props);
|
|
|
|
|
|
this.renderReduce = this.renderReduce.bind(this);
|
|
|
|
|
|
this.state = {
|
|
|
marginLeft: new Animated.Value(0)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
renderReduce() {
|
...
|
...
|
@@ -48,6 +54,14 @@ export default class ProductCell extends Component { |
|
|
);
|
|
|
}
|
|
|
|
|
|
// componentWillReceiveProps(nextProps) {
|
|
|
// if (this.props.data.isDeleting
|
|
|
// && this.props.data.isDeleting != nextProps.data.isDeleting) {
|
|
|
// this.state.currentlyOpenSwipeable && this.state.currentlyOpenSwipeable.recenter();
|
|
|
// this.setState({currentlyOpenSwipeable: null});
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
render() {
|
|
|
|
|
|
let data = this.props.data;
|
...
|
...
|
@@ -77,7 +91,15 @@ export default class ProductCell extends Component { |
|
|
let {editing, editedRow, rowID} = this.props;
|
|
|
let showLeft = editing && editedRow != rowID;
|
|
|
let showTail = editing && editedRow == rowID;
|
|
|
let marginLeft = showTail?-70:0;
|
|
|
let marginLeft = showTail
|
|
|
? -70
|
|
|
: 0;
|
|
|
|
|
|
Animated.timing(this.state.marginLeft, {
|
|
|
toValue: marginLeft,
|
|
|
duration: 150,
|
|
|
easing: Easing.linear
|
|
|
}).start();
|
|
|
return (
|
|
|
<View style={styles.fatherContainer}>
|
|
|
{showLeft
|
...
|
...
|
@@ -90,7 +112,13 @@ export default class ProductCell extends Component { |
|
|
</TouchableOpacity>
|
|
|
: null}
|
|
|
|
|
|
<TouchableOpacity activeOpacity={1} style={[styles.container, {marginLeft}]} onPress={() => {
|
|
|
<Animated.View style={[
|
|
|
styles.container, {
|
|
|
marginLeft: this.state.marginLeft
|
|
|
}
|
|
|
]}>
|
|
|
|
|
|
<TouchableOpacity activeOpacity={1} style={[styles.container]} onPress={() => {
|
|
|
this.props.onPressProduct && this.props.onPressProduct(data);
|
|
|
}}>
|
|
|
<View style={styles.container}>
|
...
|
...
|
@@ -118,16 +146,18 @@ export default class ProductCell extends Component { |
|
|
<Text style={styles.soldOut}>{'已售罄'}</Text>
|
|
|
</View>
|
|
|
: null}
|
|
|
|
|
|
<TouchableOpacity activeOpacity={1} style={styles.similar} onPress={() => {
|
|
|
{this.props.currentTab != 'global'
|
|
|
? <TouchableOpacity activeOpacity={1} style={styles.similar} onPress={() => {
|
|
|
this.props.onPressFindSimilar && this.props.onPressFindSimilar(data);
|
|
|
}}>
|
|
|
<Image source={require('../../images/browse/shopcart_findResemblance.png')}/>
|
|
|
</TouchableOpacity>
|
|
|
: null}
|
|
|
|
|
|
<View style={styles.separator}/>
|
|
|
</View>
|
|
|
</TouchableOpacity>
|
|
|
</Animated.View>
|
|
|
|
|
|
{showTail
|
|
|
? <TouchableOpacity activeOpacity={1} style={styles.tailContainer} onPress={() => {
|
...
|
...
|
@@ -155,27 +185,28 @@ let styles = StyleSheet.create({ |
|
|
fatherContainer: {
|
|
|
flexDirection: 'row',
|
|
|
alignItems: 'center',
|
|
|
backgroundColor: 'white',
|
|
|
backgroundColor: 'white'
|
|
|
},
|
|
|
deleteContainer: {
|
|
|
width: 50,
|
|
|
width: 40,
|
|
|
height: 70,
|
|
|
alignItems: 'center',
|
|
|
justifyContent: 'center',
|
|
|
backgroundColor : 'white',
|
|
|
backgroundColor: 'white',
|
|
|
paddingLeft: 5
|
|
|
},
|
|
|
deleteCircle: {
|
|
|
width: 15,
|
|
|
height: 15,
|
|
|
borderRadius: 7.5,
|
|
|
width: 22,
|
|
|
height: 22,
|
|
|
borderRadius: 11,
|
|
|
backgroundColor: 'red',
|
|
|
flexDirection: 'row',
|
|
|
alignItems: 'center',
|
|
|
justifyContent: 'center'
|
|
|
},
|
|
|
deleteBar: {
|
|
|
width: 6,
|
|
|
height: 1,
|
|
|
width: 11,
|
|
|
height: 1.5,
|
|
|
backgroundColor: 'white'
|
|
|
},
|
|
|
tailContainer: {
|
...
|
...
|
|