rampkit-expo-dev 0.0.24 → 0.0.25

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.
@@ -366,6 +366,11 @@ function Overlay(props) {
366
366
  else if (typeof pager.setPageWithoutAnimation === "function") {
367
367
  pager.setPageWithoutAnimation(nextIndex);
368
368
  }
369
+ // Explicitly send vars to the new page after setting it
370
+ // This ensures the webview receives the latest state
371
+ requestAnimationFrame(() => {
372
+ sendVarsToWebView(nextIndex);
373
+ });
369
374
  return;
370
375
  }
371
376
  setIsTransitioning(true);
@@ -380,6 +385,10 @@ function Overlay(props) {
380
385
  // @ts-ignore: method exists on PagerView instance
381
386
  (_c = (_b = (_a = pagerRef.current) === null || _a === void 0 ? void 0 : _a.setPageWithoutAnimation) === null || _b === void 0 ? void 0 : _b.call(_a, nextIndex)) !== null && _c !== void 0 ? _c : (_d = pagerRef.current) === null || _d === void 0 ? void 0 : _d.setPage(nextIndex);
382
387
  requestAnimationFrame(() => {
388
+ // Explicitly send vars to the new page after the page switch completes
389
+ // This ensures the webview receives the latest state even if onPageSelected
390
+ // timing was off during the transition
391
+ sendVarsToWebView(nextIndex);
383
392
  react_native_1.Animated.timing(fadeOpacity, {
384
393
  toValue: 0,
385
394
  duration: 160,
@@ -476,7 +485,12 @@ function Overlay(props) {
476
485
  // ensure current page is synced with latest vars when selected
477
486
  if (__DEV__)
478
487
  console.log("[Rampkit] onPageSelected", pos);
479
- sendVarsToWebView(pos);
488
+ // Use requestAnimationFrame to ensure the webview is fully active and ready
489
+ // to receive injected JS. Without this delay, the first navigation back
490
+ // to a screen may not properly receive the updated variables.
491
+ requestAnimationFrame(() => {
492
+ sendVarsToWebView(pos);
493
+ });
480
494
  // Track screen change event
481
495
  if (props.onScreenChange && props.screens[pos]) {
482
496
  props.onScreenChange(pos, props.screens[pos].id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rampkit-expo-dev",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
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",