rampkit-expo-dev 0.0.78 → 0.0.80

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.
@@ -1716,7 +1716,14 @@ function Overlay(props) {
1716
1716
  },
1717
1717
  ],
1718
1718
  // Only the active screen receives touch events
1719
- pointerEvents: i === index ? 'auto' : 'none', children: (0, jsx_runtime_1.jsx)(react_native_webview_1.WebView, { ref: (r) => (webviewsRef.current[i] = r), style: { width: windowWidth, height: windowHeight }, originWhitelist: ["*"], source: { html: doc }, injectedJavaScriptBeforeContentLoaded: exports.injectedHardening + exports.injectedDynamicTapHandler + exports.injectedButtonAnimations, injectedJavaScript: exports.injectedNoSelect + exports.injectedVarsHandler + exports.injectedButtonAnimations, automaticallyAdjustContentInsets: false, contentInsetAdjustmentBehavior: "never", bounces: false, scrollEnabled: false, overScrollMode: "never", scalesPageToFit: false, showsHorizontalScrollIndicator: false, dataDetectorTypes: "none", allowsLinkPreview: false, allowsInlineMediaPlayback: true, mediaPlaybackRequiresUserAction: false, cacheEnabled: true, javaScriptEnabled: true, domStorageEnabled: true, hideKeyboardAccessoryView: true, onLoadEnd: () => {
1719
+ pointerEvents: i === index ? 'auto' : 'none', children: (0, jsx_runtime_1.jsx)(react_native_webview_1.WebView, { ref: (r) => (webviewsRef.current[i] = r), style: { width: windowWidth, height: windowHeight }, originWhitelist: ["*"], source: { html: doc }, injectedJavaScriptBeforeContentLoaded:
1720
+ // CRITICAL: Set visibility flag BEFORE content loads (matches iOS SDK behavior)
1721
+ // Only screen 0 starts as visible, others start hidden.
1722
+ // This prevents review/notification requests from firing on inactive screens at startup.
1723
+ `window.__rampkitScreenVisible = ${i === 0};
1724
+ window.__rampkitScreenIndex = ${i};
1725
+ console.log('[RampKit] Screen ${i} visibility initialized: ' + (${i === 0} ? 'ACTIVE' : 'INACTIVE'));
1726
+ ` + exports.injectedHardening + exports.injectedDynamicTapHandler + exports.injectedButtonAnimations, injectedJavaScript: exports.injectedNoSelect + exports.injectedVarsHandler + exports.injectedButtonAnimations, automaticallyAdjustContentInsets: false, contentInsetAdjustmentBehavior: "never", bounces: false, scrollEnabled: false, overScrollMode: "never", scalesPageToFit: false, showsHorizontalScrollIndicator: false, dataDetectorTypes: "none", allowsLinkPreview: false, allowsInlineMediaPlayback: true, mediaPlaybackRequiresUserAction: false, cacheEnabled: true, javaScriptEnabled: true, domStorageEnabled: true, hideKeyboardAccessoryView: true, onLoadEnd: () => {
1720
1727
  // Only initialize each screen ONCE to avoid repeated processing
1721
1728
  if (initializedScreensRef.current.has(i)) {
1722
1729
  if (__DEV__)
@@ -1745,25 +1752,12 @@ function Overlay(props) {
1745
1752
  // By sending state to all screens upfront, the DOM is already in its final state
1746
1753
  // before any navigation occurs.
1747
1754
  sendOnboardingStateToWebView(i);
1748
- // Set initial visibility flag (matches iOS SDK behavior).
1749
- // Only screen 0 starts as active - all others start inactive.
1750
- // This prevents actions like review requests from firing on all screens at startup.
1755
+ // Visibility flag is already set in injectedJavaScriptBeforeContentLoaded.
1756
+ // For screen 0, dispatch the activation event and process any pending actions.
1757
+ // Other screens will be activated when navigated to.
1751
1758
  if (i === 0) {
1752
- // First screen is immediately active
1753
1759
  activateScreen(i);
1754
1760
  }
1755
- else {
1756
- // Other screens start inactive - inject the flag but don't dispatch event
1757
- const wv = webviewsRef.current[i];
1758
- if (wv) {
1759
- // @ts-ignore: injectJavaScript exists on WebView instance
1760
- wv.injectJavaScript(`(function() {
1761
- window.__rampkitScreenVisible = false;
1762
- window.__rampkitScreenIndex = ${i};
1763
- console.log('🔒 Screen ${i} loaded but INACTIVE');
1764
- })();`);
1765
- }
1766
- }
1767
1761
  }, onMessage: (ev) => {
1768
1762
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1769
1763
  const raw = ev.nativeEvent.data;
@@ -1924,10 +1918,22 @@ function Overlay(props) {
1924
1918
  }
1925
1919
  if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:continue" ||
1926
1920
  (data === null || data === void 0 ? void 0 : data.type) === "continue") {
1921
+ // Only process continue from the active screen
1922
+ if (!isScreenActive(i)) {
1923
+ if (__DEV__)
1924
+ console.log(`[RampKit] Ignoring continue from inactive screen ${i}`);
1925
+ return;
1926
+ }
1927
1927
  handleAdvance(i, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
1928
1928
  return;
1929
1929
  }
1930
1930
  if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:navigate") {
1931
+ // Only process navigate from the active screen
1932
+ if (!isScreenActive(i)) {
1933
+ if (__DEV__)
1934
+ console.log(`[RampKit] Ignoring navigate from inactive screen ${i}`);
1935
+ return;
1936
+ }
1931
1937
  const target = data === null || data === void 0 ? void 0 : data.targetScreenId;
1932
1938
  if (target === "__goBack__") {
1933
1939
  handleGoBack(i, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
@@ -1947,6 +1953,12 @@ function Overlay(props) {
1947
1953
  return;
1948
1954
  }
1949
1955
  if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:goBack") {
1956
+ // Only process goBack from the active screen
1957
+ if (!isScreenActive(i)) {
1958
+ if (__DEV__)
1959
+ console.log(`[RampKit] Ignoring goBack from inactive screen ${i}`);
1960
+ return;
1961
+ }
1950
1962
  handleGoBack(i, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
1951
1963
  return;
1952
1964
  }
@@ -1969,6 +1981,12 @@ function Overlay(props) {
1969
1981
  if (raw === "rampkit:tap" ||
1970
1982
  raw === "next" ||
1971
1983
  raw === "continue") {
1984
+ // Only process from the active screen
1985
+ if (!isScreenActive(i)) {
1986
+ if (__DEV__)
1987
+ console.log(`[RampKit] Ignoring ${raw} from inactive screen ${i}`);
1988
+ return;
1989
+ }
1972
1990
  handleAdvance(i);
1973
1991
  return;
1974
1992
  }
@@ -2023,10 +2041,22 @@ function Overlay(props) {
2023
2041
  return;
2024
2042
  }
2025
2043
  if (raw === "rampkit:goBack") {
2044
+ // Only process from the active screen
2045
+ if (!isScreenActive(i)) {
2046
+ if (__DEV__)
2047
+ console.log(`[RampKit] Ignoring goBack (raw) from inactive screen ${i}`);
2048
+ return;
2049
+ }
2026
2050
  handleGoBack(i);
2027
2051
  return;
2028
2052
  }
2029
2053
  if (raw.startsWith("rampkit:navigate:")) {
2054
+ // Only process from the active screen
2055
+ if (!isScreenActive(i)) {
2056
+ if (__DEV__)
2057
+ console.log(`[RampKit] Ignoring navigate (raw) from inactive screen ${i}`);
2058
+ return;
2059
+ }
2030
2060
  const target = raw.slice("rampkit:navigate:".length);
2031
2061
  if (target === "__goBack__") {
2032
2062
  handleGoBack(i);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rampkit-expo-dev",
3
- "version": "0.0.78",
3
+ "version": "0.0.80",
4
4
  "description": "The Expo SDK for RampKit. Build, test, and personalize app onboardings with instant updates.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",