posthog-react-native 2.1.0 → 2.1.2

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/lib/index.d.ts CHANGED
@@ -210,9 +210,7 @@ declare type PostHogAutocaptureOptions = {
210
210
  maxElementsCaptured?: number;
211
211
  ignoreLabels?: string[];
212
212
  propsToCapture?: string[];
213
- captureScreens?: boolean;
214
213
  navigation?: PostHogAutocaptureNavigationTrackerOptions;
215
- captureLifecycleEvents?: boolean;
216
214
  };
217
215
 
218
216
  declare function _useNavigationTracker(options?: PostHogAutocaptureNavigationTrackerOptions, client?: PostHog): void;
package/lib/index.esm.js CHANGED
@@ -1408,7 +1408,7 @@ var preloadSemiAsyncStorage = function () {
1408
1408
  return _preloadSemiAsyncStoragePromise;
1409
1409
  };
1410
1410
 
1411
- var version = "2.1.0";
1411
+ var version = "2.0.0";
1412
1412
 
1413
1413
  var PostHog =
1414
1414
  /** @class */
@@ -1776,20 +1776,14 @@ var autocaptureFromTouchEvent = function (e, posthog, options) {
1776
1776
  }
1777
1777
  };
1778
1778
 
1779
- function PostHogNavigationHook(_a) {
1779
+ function PostHogHooks(_a) {
1780
1780
  var options = _a.options;
1781
1781
  useNavigationTracker(options === null || options === void 0 ? void 0 : options.navigation);
1782
- return null;
1783
- }
1784
-
1785
- function PostHogLifecycleHook() {
1786
1782
  useLifecycleTracker();
1787
1783
  return null;
1788
1784
  }
1789
1785
 
1790
1786
  var PostHogProvider = function (_a) {
1791
- var _b, _c;
1792
-
1793
1787
  var children = _a.children,
1794
1788
  client = _a.client,
1795
1789
  options = _a.options,
@@ -1802,13 +1796,10 @@ var PostHogProvider = function (_a) {
1802
1796
  posthogRef.current = client ? client : apiKey ? new PostHog(apiKey, options) : undefined;
1803
1797
  }
1804
1798
 
1799
+ var autocaptureEnabled = !!autocapture;
1805
1800
  var autocaptureOptions = autocapture && typeof autocapture !== 'boolean' ? autocapture : {};
1806
1801
  var posthog = posthogRef.current;
1807
1802
  var captureTouches = posthog && (autocapture === true || (autocaptureOptions === null || autocaptureOptions === void 0 ? void 0 : autocaptureOptions.captureTouches));
1808
- var captureScreens = posthog && (autocapture === true || ((_b = autocaptureOptions === null || autocaptureOptions === void 0 ? void 0 : autocaptureOptions.captureScreens) !== null && _b !== void 0 ? _b : true)); // Default to true if not set
1809
-
1810
- var captureLifecycle = posthog && (autocapture === true || ((_c = autocaptureOptions === null || autocaptureOptions === void 0 ? void 0 : autocaptureOptions.captureLifecycleEvents) !== null && _c !== void 0 ? _c : true)); // Default to true if not set
1811
-
1812
1803
  var onTouch = useCallback(function (type, e) {
1813
1804
  // TODO: Improve this to ensure we only capture presses and not just ends of a drag for example
1814
1805
  if (!captureTouches) {
@@ -1818,7 +1809,8 @@ var PostHogProvider = function (_a) {
1818
1809
  if (type === 'end') {
1819
1810
  autocaptureFromTouchEvent(e, posthog, autocaptureOptions);
1820
1811
  }
1821
- }, [posthog, autocapture]);
1812
+ }, [posthog, autocapture]); // TODO: Improve this to ensure we only capture presses and not just ends of a drag for example
1813
+
1822
1814
  return /*#__PURE__*/React.createElement(View, {
1823
1815
  "ph-label": "PostHogProvider",
1824
1816
  style: style || {
@@ -1831,9 +1823,9 @@ var PostHogProvider = function (_a) {
1831
1823
  value: {
1832
1824
  client: posthogRef.current
1833
1825
  }
1834
- }, /*#__PURE__*/React.createElement(React.Fragment, null, captureScreens ? /*#__PURE__*/React.createElement(PostHogNavigationHook, {
1826
+ }, autocaptureEnabled ? /*#__PURE__*/React.createElement(PostHogHooks, {
1835
1827
  options: autocaptureOptions
1836
- }) : null, captureLifecycle ? /*#__PURE__*/React.createElement(PostHogLifecycleHook, null) : null), children));
1828
+ }) : null, children));
1837
1829
  };
1838
1830
 
1839
1831
  export { PostHog, PostHogProvider, PostHog as default, useFeatureFlag, useFeatureFlags, useLifecycleTracker, useNavigationTracker, usePostHog };