点击自动埋点 — reviewed by yjc
Showing
3 changed files
with
26 additions
and
0 deletions
@@ -29,6 +29,8 @@ import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; | @@ -29,6 +29,8 @@ import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; | ||
29 | import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; | 29 | import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; |
30 | import type {Props as TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback'; | 30 | import type {Props as TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback'; |
31 | import type {TVParallaxPropertiesType} from '../AppleTV/TVViewPropTypes'; | 31 | import type {TVParallaxPropertiesType} from '../AppleTV/TVViewPropTypes'; |
32 | +const { YH_CommonHelper } = require('../../BatchedBridge/NativeModules'); | ||
33 | + | ||
32 | 34 | ||
33 | const DEFAULT_PROPS = { | 35 | const DEFAULT_PROPS = { |
34 | activeOpacity: 0.85, | 36 | activeOpacity: 0.85, |
@@ -334,6 +336,13 @@ const TouchableHighlight = ((createReactClass({ | @@ -334,6 +336,13 @@ const TouchableHighlight = ((createReactClass({ | ||
334 | ); | 336 | ); |
335 | } | 337 | } |
336 | this.props.onPress && this.props.onPress(e); | 338 | this.props.onPress && this.props.onPress(e); |
339 | + | ||
340 | + let eventName = this.props.yh_clickData && this.props.yh_clickData.eventName | ||
341 | + let param = this.props.yh_clickData | ||
342 | + if (param) { | ||
343 | + delete param.eventName | ||
344 | + } | ||
345 | + eventName && YH_CommonHelper && YH_CommonHelper.logEvent(eventName, param) | ||
337 | }, | 346 | }, |
338 | 347 | ||
339 | touchableHandleLongPress: function(e: PressEvent) { | 348 | touchableHandleLongPress: function(e: PressEvent) { |
@@ -27,6 +27,8 @@ import type {Props as TouchableWithoutFeedbackProps} from './TouchableWithoutFee | @@ -27,6 +27,8 @@ import type {Props as TouchableWithoutFeedbackProps} from './TouchableWithoutFee | ||
27 | import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; | 27 | import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; |
28 | import type {TVParallaxPropertiesType} from '../AppleTV/TVViewPropTypes'; | 28 | import type {TVParallaxPropertiesType} from '../AppleTV/TVViewPropTypes'; |
29 | import type {PressEvent} from '../../Types/CoreEventTypes'; | 29 | import type {PressEvent} from '../../Types/CoreEventTypes'; |
30 | +const { YH_CommonHelper } = require('../../BatchedBridge/NativeModules'); | ||
31 | + | ||
30 | 32 | ||
31 | const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30}; | 33 | const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30}; |
32 | 34 | ||
@@ -262,6 +264,13 @@ const TouchableOpacity = ((createReactClass({ | @@ -262,6 +264,13 @@ const TouchableOpacity = ((createReactClass({ | ||
262 | 264 | ||
263 | touchableHandlePress: function(e: PressEvent) { | 265 | touchableHandlePress: function(e: PressEvent) { |
264 | this.props.onPress && this.props.onPress(e); | 266 | this.props.onPress && this.props.onPress(e); |
267 | + | ||
268 | + let eventName = this.props.yh_clickData && this.props.yh_clickData.eventName | ||
269 | + let param = this.props.yh_clickData | ||
270 | + if (param) { | ||
271 | + delete param.eventName | ||
272 | + } | ||
273 | + eventName && YH_CommonHelper && YH_CommonHelper.logEvent(eventName, param) | ||
265 | }, | 274 | }, |
266 | 275 | ||
267 | touchableHandleLongPress: function(e: PressEvent) { | 276 | touchableHandleLongPress: function(e: PressEvent) { |
@@ -18,6 +18,7 @@ const View = require('../View/View'); | @@ -18,6 +18,7 @@ const View = require('../View/View'); | ||
18 | 18 | ||
19 | const createReactClass = require('create-react-class'); | 19 | const createReactClass = require('create-react-class'); |
20 | const ensurePositiveDelayProps = require('./ensurePositiveDelayProps'); | 20 | const ensurePositiveDelayProps = require('./ensurePositiveDelayProps'); |
21 | +const { YH_CommonHelper } = require('../../BatchedBridge/NativeModules'); | ||
21 | 22 | ||
22 | const { | 23 | const { |
23 | DeprecatedAccessibilityRoles, | 24 | DeprecatedAccessibilityRoles, |
@@ -216,6 +217,13 @@ const TouchableWithoutFeedback = ((createReactClass({ | @@ -216,6 +217,13 @@ const TouchableWithoutFeedback = ((createReactClass({ | ||
216 | */ | 217 | */ |
217 | touchableHandlePress: function(e: PressEvent) { | 218 | touchableHandlePress: function(e: PressEvent) { |
218 | this.props.onPress && this.props.onPress(e); | 219 | this.props.onPress && this.props.onPress(e); |
220 | + | ||
221 | + let eventName = this.props.yh_clickData && this.props.yh_clickData.eventName | ||
222 | + let param = this.props.yh_clickData | ||
223 | + if (param) { | ||
224 | + delete param.eventName | ||
225 | + } | ||
226 | + eventName && YH_CommonHelper && YH_CommonHelper.logEvent(eventName, param) | ||
219 | }, | 227 | }, |
220 | 228 | ||
221 | touchableHandleActivePressIn: function(e: PressEvent) { | 229 | touchableHandleActivePressIn: function(e: PressEvent) { |
-
Please register or login to post a comment