@dynatrace/react-native-plugin 2.271.2 → 2.271.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1169,9 +1169,11 @@ If you are struggling with a problem, submit a support ticket to Dynatrace (supp
1169
1169
  <br/><br/>
1170
1170
  ## Changelog
1171
1171
 
1172
- 2.271.2
1172
+ 2.271.3
1173
1173
  * Update Android (8.271.1.1003) & iOS Agent (8.271.2.1007)
1174
1174
  * Fixed createElement logic for older React Native versions
1175
+ * Fixed asynchronous handler for Touchables
1176
+ * Updated instrumentation of RefreshControl
1175
1177
 
1176
1178
  2.269.1
1177
1179
  * Update Android (8.269.1.1009) & iOS Agent (8.269.1.1007)
@@ -7,6 +7,7 @@ const Logger_1 = require("./Logger");
7
7
  const Picker_1 = require("./Picker");
8
8
  const Touchable_1 = require("./Touchable");
9
9
  const Dynatrace_1 = require("./Dynatrace");
10
+ const RefreshControl_1 = require("./RefreshControl");
10
11
  const instrumentCreateElement = (reactModule) => {
11
12
  if (reactModule != null && reactModule.createElement != null) {
12
13
  const reactCreateElement = reactModule.createElement;
@@ -30,7 +31,10 @@ const instrumentCreateElement = (reactModule) => {
30
31
  exports.instrumentCreateElement = instrumentCreateElement;
31
32
  const modifyElement = (type, props, ...children) => {
32
33
  if (props != null) {
33
- if (type._dtInfo.type === Types_1.Types.Button ||
34
+ if (type._dtInfo.type === Types_1.Types.RefreshControl && props.onRefresh != null) {
35
+ (0, RefreshControl_1.RefreshControlHelper)(Dynatrace_1.Dynatrace, Logger_1.Logger).attachOnRefresh(props);
36
+ }
37
+ else if (type._dtInfo.type === Types_1.Types.Button ||
34
38
  type._dtInfo.type === Types_1.Types.Text ||
35
39
  type._dtInfo.type === Types_1.Types.Pressable ||
36
40
  (0, Types_1.isTypeTouchable)(type._dtInfo.type)) {
@@ -1,20 +1,29 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.PickerHelper = void 0;
4
13
  const PickerHelper = (Dynatrace, Logger) => ({
5
14
  attachToOnValueChange(onValueChange, children) {
6
- return (itemValue, itemNumber) => {
15
+ return (itemValue, itemNumber) => __awaiter(this, void 0, void 0, function* () {
7
16
  const value = this.getPickerItemValue(children, itemNumber, itemValue);
8
17
  if (value !== undefined) {
9
18
  const action = Dynatrace.enterAutoAction(`Picked Value: ${value}`);
10
19
  if (onValueChange !== undefined) {
11
- onValueChange(itemValue, itemNumber);
20
+ yield onValueChange(itemValue, itemNumber);
12
21
  }
13
22
  if (action != null) {
14
23
  action.leaveAction();
15
24
  }
16
25
  }
17
- };
26
+ });
18
27
  },
19
28
  getPickerItemValue: (children, index, value) => {
20
29
  if (children != null && index >= 0) {
@@ -1,32 +1,25 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.RefreshControlHelper = void 0;
4
13
  const RefreshControlHelper = (Dynatrace, Logger) => ({
5
- attachToRender(refreshControl) {
6
- if (refreshControl.render !== undefined) {
7
- const renderOrig = refreshControl.render.bind(refreshControl);
8
- refreshControl.render = () => this.renderRefreshControl(renderOrig);
9
- }
10
- },
11
- renderRefreshControl(renderOrig) {
12
- const refreshControlRender = renderOrig();
13
- if (refreshControlRender != null &&
14
- refreshControlRender.props != null &&
15
- refreshControlRender.props.onRefresh) {
16
- return Object.assign(Object.assign({}, refreshControlRender), { props: Object.assign(Object.assign({}, refreshControlRender.props), { onRefresh: () => {
17
- this.onRefresh(refreshControlRender);
18
- } }) });
19
- }
20
- else {
21
- return refreshControlRender;
22
- }
23
- },
24
- onRefresh: (refreshControl) => {
25
- const action = Dynatrace.enterAutoAction('Swipe to Refesh');
26
- if (refreshControl.props.onRefresh !== undefined) {
27
- refreshControl.props.onRefresh();
28
- }
29
- action.leaveAction();
14
+ attachOnRefresh: (refreshControlProps) => {
15
+ const origOnRefresh = refreshControlProps.onRefresh;
16
+ refreshControlProps.onRefresh = () => __awaiter(void 0, void 0, void 0, function* () {
17
+ const action = Dynatrace.enterAutoAction('Swipe to Refesh');
18
+ if (origOnRefresh != null) {
19
+ yield origOnRefresh();
20
+ }
21
+ action.leaveAction();
22
+ });
30
23
  },
31
24
  });
32
25
  exports.RefreshControlHelper = RefreshControlHelper;
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.TouchableHelper = void 0;
4
13
  const Configuration_1 = require("./configuration/Configuration");
@@ -9,17 +18,17 @@ const TouchableHelper = (Dynatrace, Logger) => ({
9
18
  : props.onPress;
10
19
  const nameOfAction = this._findActionName(props, children);
11
20
  const isButton = this._isPropsButton(props);
12
- return (event) => {
21
+ return (event) => __awaiter(this, void 0, void 0, function* () {
13
22
  if (nameOfAction == null) {
14
23
  Logger.logDebug('TouchableHelper: Skipping creation of action as no name was found!');
15
24
  if (origFunction != null) {
16
- origFunction(event);
25
+ yield origFunction(event);
17
26
  }
18
27
  }
19
28
  else if (!Configuration_1.Configuration.isConfigurationAvailable()) {
20
29
  Logger.logInfo('TouchableHelper: React Native plugin has not been started yet! Touch will not be reported!');
21
30
  if (origFunction != null) {
22
- origFunction(event);
31
+ yield origFunction(event);
23
32
  }
24
33
  }
25
34
  else {
@@ -29,11 +38,11 @@ const TouchableHelper = (Dynatrace, Logger) => ({
29
38
  }
30
39
  const action = Dynatrace.enterAutoAction(`Touch on ${finalNameOfAction}`);
31
40
  if (origFunction != null) {
32
- origFunction(event);
41
+ yield origFunction(event);
33
42
  }
34
43
  action.leaveAction();
35
44
  }
36
- };
45
+ });
37
46
  },
38
47
  _findActionName(props, children) {
39
48
  if (this._isDynatraceProperties(props)) {
@@ -18,6 +18,7 @@ var Types;
18
18
  Types[Types["TouchableNativeFeedbackGestureHandler"] = 12] = "TouchableNativeFeedbackGestureHandler";
19
19
  Types[Types["TouchableWithoutFeedbackGestureHandler"] = 13] = "TouchableWithoutFeedbackGestureHandler";
20
20
  Types[Types["RectButtonGestureHandler"] = 14] = "RectButtonGestureHandler";
21
+ Types[Types["RefreshControl"] = 15] = "RefreshControl";
21
22
  })(Types = exports.Types || (exports.Types = {}));
22
23
  const isTypeReactNativeTouchable = (type) => type === Types.TouchableHighlight
23
24
  || type === Types.TouchableNativeFeedback
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.RefreshControl = void 0;
4
5
  const ReactNative = require("react-native");
5
- const Dynatrace_1 = require("../instrumentor/base/Dynatrace");
6
- const Logger_1 = require("../instrumentor/base/Logger");
7
- const RefreshControl_1 = require("../instrumentor/base/RefreshControl");
8
- class RefreshControl extends ReactNative.RefreshControl {
9
- constructor(props, context) {
10
- super(props, context);
11
- (0, RefreshControl_1.RefreshControlHelper)(Dynatrace_1.Dynatrace, Logger_1.Logger).attachToRender(this);
12
- }
6
+ const Types_1 = require("../instrumentor/model/Types");
7
+ if (typeof ReactNative.RefreshControl === 'object') {
8
+ exports.RefreshControl = Object.assign({ _dtInfo: { type: Types_1.Types.RefreshControl } }, ReactNative.RefreshControl);
9
+ }
10
+ else {
11
+ exports.RefreshControl = (_a = class RefreshControl extends ReactNative.RefreshControl {
12
+ },
13
+ _a._dtInfo = { type: Types_1.Types.RefreshControl },
14
+ _a);
13
15
  }
14
- exports.RefreshControl = RefreshControl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynatrace/react-native-plugin",
3
- "version": "2.271.2",
3
+ "version": "2.271.3",
4
4
  "description": "This plugin gives you the ability to use the Dynatrace Mobile agent in your react native application.",
5
5
  "main": "index.js",
6
6
  "types": "typings/react-native-dynatrace.d.ts",