@returningai/react-native-widget-sdk 0.1.2 → 0.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.3
4
+
5
+ - Covers the WebView with the themed shell until `rai-ready`. RN CLI / iOS 26
6
+ assigns origin with a GET of `/`, which painted a white document before the
7
+ HTML shell ran. The WebView stays opacity 0 over the shell background so that
8
+ flash is gone.
9
+
3
10
  ## 0.1.2
4
11
 
5
12
  - RN CLI / iOS 26 / Fabric: widgets now reach `rai-ready` like Expo. Live
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@returningai/react-native-widget-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "React Native SDK for embedding ReturningAI custom product widgets.",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -568,19 +568,21 @@ export function ReturningAIWidget(props: ReturningAIWidgetProps): ReactElement {
568
568
  }, []);
569
569
 
570
570
  const autoHeight = props.configuration.display.autoHeight;
571
- const showLoading = props.loadingBuilder !== undefined && isLoading && error === null;
572
- const webViewStyle = autoHeight ? { height, width: "100%" as const } : styles.flex;
571
+ const coverUntilReady = isLoading && error === null;
573
572
  const resolvedTheme = resolveReturningAIWidgetTheme(
574
573
  props.configuration.theme,
575
574
  platformBrightness,
576
575
  );
576
+ const shellBackground = argbToCss(
577
+ returningAIShellBackgroundColor(resolvedTheme, props.configuration.display.backgroundColor),
578
+ );
579
+ const webViewStyle = [
580
+ autoHeight ? { height, width: "100%" as const } : styles.flex,
581
+ { backgroundColor: shellBackground, opacity: coverUntilReady ? 0 : 1 },
582
+ ];
577
583
  const rootStyle = [
578
584
  autoHeight ? { height } : styles.root,
579
- {
580
- backgroundColor: argbToCss(
581
- returningAIShellBackgroundColor(resolvedTheme, props.configuration.display.backgroundColor),
582
- ),
583
- },
585
+ { backgroundColor: shellBackground },
584
586
  props.style,
585
587
  ];
586
588
 
@@ -599,6 +601,7 @@ export function ReturningAIWidget(props: ReturningAIWidgetProps): ReactElement {
599
601
  ref: attachWebView,
600
602
  source,
601
603
  style: webViewStyle,
604
+ containerStyle: { flex: 1, backgroundColor: shellBackground },
602
605
  onMessage,
603
606
  onShouldStartLoadWithRequest,
604
607
  onError,
@@ -627,15 +630,20 @@ export function ReturningAIWidget(props: ReturningAIWidgetProps): ReactElement {
627
630
  testID: "returningai-webview",
628
631
  });
629
632
 
630
- if (!showLoading && error === null) {
631
- return createElement(View, { style: rootStyle }, webView);
632
- }
633
-
634
633
  return createElement(
635
634
  View,
636
635
  { style: rootStyle },
637
636
  webView,
638
- showLoading ? createElement(View, { style: styles.overlay }, props.loadingBuilder?.()) : null,
637
+ coverUntilReady
638
+ ? createElement(
639
+ View,
640
+ {
641
+ style: [styles.overlay, { backgroundColor: shellBackground }],
642
+ testID: "returningai-loading-cover",
643
+ },
644
+ props.loadingBuilder?.() ?? null,
645
+ )
646
+ : null,
639
647
  error !== null
640
648
  ? createElement(
641
649
  View,
@@ -13,7 +13,7 @@
13
13
  */
14
14
  export const RETURNING_AI_REACT_NATIVE_PACKAGE = {
15
15
  /** Semver of `@returningai/react-native-widget-sdk`. */
16
- version: "0.1.2",
16
+ version: "0.1.3",
17
17
  /** Documented Expo SDK major this package targets. */
18
18
  expoSdk: 57,
19
19
  /** Documented React Native minor this package targets. */