@momo-platform/momo-cornerstone
Advanced tools
Comparing version 0.0.9 to 0.0.10
{ | ||
"name": "@momo-platform/momo-cornerstone", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "momo-cornerstone", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -23,3 +23,6 @@ import React, { useState, useEffect } from 'react'; | ||
useEffect(() => { | ||
CornerStoneUtil?.trackEventWith(data[selectedIndex], 'impression'); | ||
if (data && data[selectedIndex] && !data[selectedIndex].swiped) { | ||
data[selectedIndex].swiped = true; | ||
CornerStoneUtil?.trackEventWith(data[selectedIndex], 'impression') | ||
} | ||
}, [selectedIndex]); | ||
@@ -40,3 +43,3 @@ | ||
sliderWidth={width} | ||
// loop={true} | ||
loop={true} | ||
autoplay={true} | ||
@@ -56,6 +59,2 @@ onSnapToItem={onSnapToItem} | ||
<Pagination | ||
//style={styles.dotsArea} | ||
//dotColor={'#ffa940'} | ||
//inactiveDotColor={'transparent'} | ||
//dotContainerStyle={styles.dot} | ||
activeDotIndex={selectedIndex} | ||
@@ -114,7 +113,5 @@ dotsLength={data.length} | ||
borderColor: '#0000001A', | ||
//backgroundColor: 'red', | ||
width: 10, | ||
height: 6, | ||
borderRadius: 3, | ||
//marginHorizontal: 2, | ||
}, | ||
@@ -129,4 +126,3 @@ | ||
borderRadius: 3, | ||
// marginHorizontal: 1 | ||
} | ||
}); |
import React, { useState, useEffect } from 'react'; | ||
import { View, TouchableOpacity, StyleSheet, Dimensions, Text, Image, ScrollView } from 'react-native'; | ||
import { View, TouchableOpacity, StyleSheet, Dimensions, Text, Image, ScrollView, Alert } from 'react-native'; | ||
import { HTMLView, Icon, Colors } from '@momo-platform/component-kits'; | ||
@@ -45,2 +45,9 @@ import { NumberUtil } from '@momo-platform/utils'; | ||
useEffect(() => { | ||
let newdataSelected = data?.filter?.(item => { | ||
return item.selected; | ||
}); | ||
callback?.(newdataSelected || []); | ||
}, []); | ||
const onPressItem = (item) => { | ||
@@ -52,6 +59,5 @@ let newdata = data?.map?.(item1 => { | ||
}) | ||
let newdataSelected = data.filter(item2 => { | ||
let newdataSelected = newdata.filter(item2 => { | ||
return item2.selected; | ||
}) | ||
}); | ||
callback?.(newdataSelected); | ||
@@ -58,0 +64,0 @@ CornerStoneUtil.trackEventWith(item, item.selected ? 'close' : 'click'); |
@@ -1,2 +0,2 @@ | ||
import React from "react"; | ||
import React, { useEffect } from "react"; | ||
import { | ||
@@ -17,3 +17,2 @@ View, | ||
const { data, title, onPress } = props || {}; | ||
const renderItem = ({ item, index }) => { | ||
@@ -49,2 +48,6 @@ return <Item onPress={onPress} zone={item} index={index} />; | ||
useEffect(() => { | ||
CornerStoneUtil.trackEventWith(zone, "impression"); | ||
}, []); | ||
const onPressItem = () => { | ||
@@ -54,5 +57,2 @@ onPress?.(zone); | ||
// const onPressHeart = () => { | ||
// } | ||
return ( | ||
@@ -59,0 +59,0 @@ <TouchableOpacity |
@@ -7,3 +7,3 @@ import React, { useState } from 'react'; | ||
export default function Xbanner(props) { | ||
const { onClose, onPress } = props; | ||
const { onClose, onPress, type } = props; | ||
const [data, setData] = useState(props.data); | ||
@@ -25,3 +25,3 @@ | ||
return (<View style={styles.xbanner}> | ||
<XbannerBasic item={data[0]} onPress={onPressItem} onClose={onCloseItem} /> | ||
<XbannerBasic type={type} item={data[0]} onPress={onPressItem} onClose={onCloseItem} /> | ||
</View>); | ||
@@ -31,4 +31,4 @@ } | ||
function XbannerBasic(props) { | ||
const { onPress, item, onClose } = props; | ||
const { name, content, icon, btnTitle, type } = item || {}; | ||
const { onPress, item, onClose, type } = props; | ||
const { name, content, icon, btnTitle } = item || {}; | ||
@@ -58,3 +58,3 @@ const onPressItem = () => { | ||
<TouchableOpacity onPress={onCloseItem} style={styles.ic_x}> | ||
<Icon name={'24_navigation_close'} style={[styles.icon_x, { tintColor: Colors.black }]} /> | ||
<Image source={require('../resources/imgs/ic_close.png')} style={[styles.icon_x, { tintColor: Colors.black }]} /> | ||
</TouchableOpacity> | ||
@@ -74,3 +74,3 @@ </View> : | ||
padding: 12, | ||
backgroundColor: '#EDEEEE' | ||
backgroundColor: 'white' | ||
}, | ||
@@ -77,0 +77,0 @@ icon_x: { |
@@ -45,4 +45,4 @@ import React, { Component } from "react"; | ||
if (zone) { | ||
let { type } = zone; | ||
let now = new Date().getTime(); | ||
let { type, key } = zone; | ||
// let now = new Date().getTime(); | ||
let Comp = SCREENS[type]; | ||
@@ -52,3 +52,3 @@ Comp && | ||
<Comp | ||
key={`${type}_${now}`} | ||
key={`${type}_${key}`} | ||
onPress={this.onPress} | ||
@@ -71,6 +71,12 @@ onClose={this.trackingCloseWith} | ||
const block = blocks[index]; | ||
const { zones = [] } = block || {}; | ||
if (zones?.length > 0) { | ||
this.setState({ zones }); | ||
let { zones = [] } = block || {}; | ||
let newzones = []; | ||
if (zones?.length <= 0) return; | ||
for (const i in zones) { | ||
let zone = zones[i]; | ||
CornerStoneUtil.trackEventWith(zone, "impression"); | ||
newzones.push({ ...zone, key: new Date().getTime() }); | ||
} | ||
this.setState({ zones: newzones }); | ||
} | ||
@@ -90,12 +96,2 @@ }); | ||
trackingImpression() { | ||
let { zones } = this.state; | ||
if (!zones) return; | ||
for (const i in zones) { | ||
let zone = zones[i]; | ||
zone && CornerStoneUtil.trackEventWith(zone, "impression"); | ||
} | ||
} | ||
render() { | ||
@@ -102,0 +98,0 @@ let { style } = this.props; |
32386
18