@getuserfeedback/react-native 3.0.40 → 3.0.41
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/dist/index.js +1 -0
- package/dist/native-view-host-projection.d.ts +9 -0
- package/dist/native-view-host-projection.js +42 -0
- package/dist/native-view-record-controller.d.ts +1 -1
- package/dist/native-view-record-controller.js +0 -2
- package/dist/provider-widget-host-lifecycle.d.ts +2 -1
- package/dist/provider-widget-host-lifecycle.js +1 -0
- package/dist/provider-widget-host-overlay.d.ts +4 -2
- package/dist/provider-widget-host-overlay.js +12 -6
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -694,6 +694,7 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
|
|
|
694
694
|
return createElement(GetUserFeedbackNativeContext.Provider, {
|
|
695
695
|
value: contextValue,
|
|
696
696
|
}, children, createElement(ProviderWidgetHostOverlay, {
|
|
697
|
+
frameAppearance: widgetHostVisibility.frameAppearance,
|
|
697
698
|
isVisible: isWidgetHostVisible,
|
|
698
699
|
nativeView: NativeView,
|
|
699
700
|
onRequestDismiss: handleWidgetHostDismiss,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ComponentType, type ReactElement } from "react";
|
|
2
|
+
import type { NativeViewRecordController } from "./native-view-record-controller.js";
|
|
3
|
+
export type NativeViewHostProjectionProps = {
|
|
4
|
+
controller: NativeViewRecordController;
|
|
5
|
+
onInvalidMessage?: (error: Error, value: unknown) => void;
|
|
6
|
+
webViewComponent?: ComponentType<Record<string, unknown>>;
|
|
7
|
+
webViewProps?: Record<string, unknown>;
|
|
8
|
+
};
|
|
9
|
+
export declare function NativeViewHostProjection({ controller, onInvalidMessage, webViewComponent, webViewProps, }: NativeViewHostProjectionProps): ReactElement;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createElement, Fragment, useCallback, useEffect, useRef, useSyncExternalStore, } from "react";
|
|
2
|
+
import { ViewWebViewHost } from "./view-webview-host.js";
|
|
3
|
+
function NativeViewHostProjectionEntry({ controller, onInvalidMessage, record, webViewComponent, webViewProps, }) {
|
|
4
|
+
const detachConnectionRef = useRef(null);
|
|
5
|
+
const detachConnection = useCallback(() => {
|
|
6
|
+
const detach = detachConnectionRef.current;
|
|
7
|
+
detachConnectionRef.current = null;
|
|
8
|
+
detach === null || detach === void 0 ? void 0 : detach();
|
|
9
|
+
}, []);
|
|
10
|
+
const handleConnected = useCallback((connection) => {
|
|
11
|
+
detachConnection();
|
|
12
|
+
const controllerDetach = controller.attachViewReadinessConnection({
|
|
13
|
+
allocationId: record.allocationId,
|
|
14
|
+
connection,
|
|
15
|
+
});
|
|
16
|
+
detachConnectionRef.current = controllerDetach;
|
|
17
|
+
}, [controller, detachConnection, record.allocationId]);
|
|
18
|
+
useEffect(() => detachConnection, [detachConnection]);
|
|
19
|
+
return createElement(ViewWebViewHost, {
|
|
20
|
+
generation: record.generation,
|
|
21
|
+
onConnected: handleConnected,
|
|
22
|
+
onDisconnected: detachConnection,
|
|
23
|
+
onInvalidMessage,
|
|
24
|
+
srcdoc: record.srcdoc,
|
|
25
|
+
viewId: record.viewId,
|
|
26
|
+
webViewComponent,
|
|
27
|
+
webViewProps,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export function NativeViewHostProjection({ controller, onInvalidMessage, webViewComponent, webViewProps, }) {
|
|
31
|
+
const records = useSyncExternalStore(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
|
|
32
|
+
return createElement(Fragment, null, records.map((record) => createElement(NativeViewHostProjectionEntry, {
|
|
33
|
+
controller,
|
|
34
|
+
onInvalidMessage,
|
|
35
|
+
record,
|
|
36
|
+
webViewComponent,
|
|
37
|
+
webViewProps,
|
|
38
|
+
key: record.allocationId,
|
|
39
|
+
})));
|
|
40
|
+
}
|
|
41
|
+
// TODO(migration): Compose CoreWebViewHost, a mount-stable NativeViewRecordController, and this projection behind one private native runtime root while the provider runtime remains active.
|
|
42
|
+
// [from=private-native-view-rendering-proof] [to=private-native-runtime-composition] [scope=slice] [priority=high] [impact=high] [risk=high] [epic=runtime-neutral-view-host-orchestration] [epic_order=50]
|
|
@@ -3,7 +3,7 @@ import type { CoreWebViewHostConnection } from "./core-webview-host-controller.j
|
|
|
3
3
|
import type { ViewWebViewHostConnection } from "./view-webview-host-controller.js";
|
|
4
4
|
type NativeViewActivationState = "idle" | "prerendering" | "activation-requested" | "prerendering-activation-requested" | "prerendered" | "active";
|
|
5
5
|
type NativeViewSizeReport = Omit<EventViewSize, "gen" | "t" | "viewId">;
|
|
6
|
-
type NativeViewRecord = Readonly<{
|
|
6
|
+
export type NativeViewRecord = Readonly<{
|
|
7
7
|
allocationId: number;
|
|
8
8
|
activationState: NativeViewActivationState;
|
|
9
9
|
generation: number;
|
|
@@ -348,5 +348,3 @@ function toViewSizeReport(event) {
|
|
|
348
348
|
layoutTransactionId: event.layoutTransactionId,
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
|
-
// TODO(migration): Render the controller's identity-safe records through ViewWebViewHost and attach each connected view transport. Keep the provider runtime active during this proof.
|
|
352
|
-
// [from=private-native-view-readiness-routing] [to=private-native-view-rendering-proof] [scope=slice] [priority=high] [impact=high] [risk=high] [epic=runtime-neutral-view-host-orchestration] [epic_order=40]
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { type InstanceViewHostSnapshotsChangedDetail, type ViewHostSnapshot, type WidgetLayoutTransitionPolicy } from "@getuserfeedback/protocol/host";
|
|
1
|
+
import { type InstanceViewHostSnapshotsChangedDetail, type ViewHostSnapshot, type WidgetFrameAppearance, type WidgetLayoutTransitionPolicy } from "@getuserfeedback/protocol/host";
|
|
2
2
|
type ProviderWidgetHostReadyState = {
|
|
3
3
|
hostEpoch: number;
|
|
4
4
|
readySequence: number;
|
|
5
5
|
sourceKey: string;
|
|
6
6
|
};
|
|
7
7
|
export type ProviderWidgetHostVisibility = {
|
|
8
|
+
frameAppearance?: WidgetFrameAppearance;
|
|
8
9
|
flowHeight?: number;
|
|
9
10
|
flowHandleId?: string;
|
|
10
11
|
hostSourceVersion: number | null;
|
|
@@ -24,6 +24,7 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
|
|
|
24
24
|
nextTransitionPolicySequence = transitionPolicySequence;
|
|
25
25
|
}
|
|
26
26
|
return {
|
|
27
|
+
frameAppearance: snapshot.frameAppearance,
|
|
27
28
|
flowHeight: snapshot.height,
|
|
28
29
|
flowHandleId: snapshot.flowHandleId,
|
|
29
30
|
hostSourceVersion,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type WidgetLayoutComparableSizeUpdate, type WidgetLayoutSizeUpdate, type WidgetLayoutTimedCapableTransitionPlan, type WidgetLayoutTransitionPolicy } from "@getuserfeedback/protocol/host";
|
|
1
|
+
import { type WidgetFrameAppearance, type WidgetLayoutComparableSizeUpdate, type WidgetLayoutSizeUpdate, type WidgetLayoutTimedCapableTransitionPlan, type WidgetLayoutTransitionPolicy } from "@getuserfeedback/protocol/host";
|
|
2
2
|
import { type ComponentType, type ReactElement, type ReactNode } from "react";
|
|
3
3
|
import type { WidgetHostProps } from "./widget-host.js";
|
|
4
4
|
type NativeViewComponent = ComponentType<Record<string, unknown>>;
|
|
@@ -25,11 +25,13 @@ export declare function toProviderWidgetHostStyle({ isVisible, webViewStyle, }:
|
|
|
25
25
|
webViewStyle: unknown;
|
|
26
26
|
}): unknown;
|
|
27
27
|
export declare function toProviderWidgetSheetStyle(input: {
|
|
28
|
+
frameAppearance?: WidgetFrameAppearance;
|
|
28
29
|
isVisible: boolean;
|
|
29
30
|
sheetHostLayoutUpdate: WidgetLayoutComparableSizeUpdate | undefined;
|
|
30
31
|
}): unknown;
|
|
31
|
-
export declare function ProviderWidgetHostOverlay({ children, isVisible, nativeView, onRequestDismiss, sheetHostLayoutUpdate, }: {
|
|
32
|
+
export declare function ProviderWidgetHostOverlay({ children, frameAppearance, isVisible, nativeView, onRequestDismiss, sheetHostLayoutUpdate, }: {
|
|
32
33
|
children?: ReactNode;
|
|
34
|
+
frameAppearance?: WidgetFrameAppearance;
|
|
33
35
|
isVisible: boolean;
|
|
34
36
|
nativeView: NativeViewComponent;
|
|
35
37
|
onRequestDismiss: () => void;
|
|
@@ -24,15 +24,17 @@ const WIDGET_SHEET_BACKDROP_STYLE = {
|
|
|
24
24
|
right: 0,
|
|
25
25
|
top: 0,
|
|
26
26
|
};
|
|
27
|
-
const
|
|
27
|
+
const WIDGET_SHEET_BASE_STYLE = {
|
|
28
28
|
backgroundColor: "#ffffff",
|
|
29
|
-
borderTopLeftRadius: 24,
|
|
30
|
-
borderTopRightRadius: 24,
|
|
31
29
|
bottom: 0,
|
|
32
30
|
left: 0,
|
|
33
31
|
overflow: "hidden",
|
|
34
32
|
position: "absolute",
|
|
35
33
|
right: 0,
|
|
34
|
+
};
|
|
35
|
+
const WIDGET_SHEET_FRAME_STYLE = {
|
|
36
|
+
borderTopLeftRadius: 24,
|
|
37
|
+
borderTopRightRadius: 24,
|
|
36
38
|
shadowColor: "#000000",
|
|
37
39
|
shadowOffset: { height: -4, width: 0 },
|
|
38
40
|
shadowOpacity: 0.16,
|
|
@@ -191,10 +193,12 @@ export function toProviderWidgetHostStyle({ isVisible, webViewStyle, }) {
|
|
|
191
193
|
: VISIBLE_WIDGET_HOST_STYLE;
|
|
192
194
|
}
|
|
193
195
|
export function toProviderWidgetSheetStyle(input) {
|
|
194
|
-
var _a;
|
|
196
|
+
var _a, _b;
|
|
195
197
|
const sheetHostViewport = (_a = input.sheetHostLayoutUpdate) === null || _a === void 0 ? void 0 : _a.size;
|
|
196
198
|
return input.isVisible && sheetHostViewport !== undefined
|
|
197
|
-
? Object.assign(Object.assign({},
|
|
199
|
+
? Object.assign(Object.assign(Object.assign({}, WIDGET_SHEET_BASE_STYLE), (((_b = input.frameAppearance) === null || _b === void 0 ? void 0 : _b.kind) === "none"
|
|
200
|
+
? {}
|
|
201
|
+
: WIDGET_SHEET_FRAME_STYLE)), { height: sheetHostViewport.height }) : HIDDEN_WIDGET_HOST_STYLE;
|
|
198
202
|
}
|
|
199
203
|
function useProviderWidgetSheetPresentation(input) {
|
|
200
204
|
var _a, _b, _c, _d;
|
|
@@ -206,6 +210,7 @@ function useProviderWidgetSheetPresentation(input) {
|
|
|
206
210
|
? animationRuntime.Animated.createAnimatedComponent(input.nativeView)
|
|
207
211
|
: input.nativeView, [animationRuntime, input.nativeView]);
|
|
208
212
|
const staticStyle = toProviderWidgetSheetStyle({
|
|
213
|
+
frameAppearance: input.frameAppearance,
|
|
209
214
|
isVisible: input.isVisible,
|
|
210
215
|
sheetHostLayoutUpdate: input.sheetHostLayoutUpdate,
|
|
211
216
|
});
|
|
@@ -277,7 +282,7 @@ function useProviderWidgetSheetPresentation(input) {
|
|
|
277
282
|
style: Object.assign(Object.assign({}, staticStyle), { height: (_d = animatedHeightRef.current) !== null && _d !== void 0 ? _d : height }),
|
|
278
283
|
};
|
|
279
284
|
}
|
|
280
|
-
export function ProviderWidgetHostOverlay({ children, isVisible, nativeView, onRequestDismiss, sheetHostLayoutUpdate, }) {
|
|
285
|
+
export function ProviderWidgetHostOverlay({ children, frameAppearance, isVisible, nativeView, onRequestDismiss, sheetHostLayoutUpdate, }) {
|
|
281
286
|
const dragStartYRef = useRef(undefined);
|
|
282
287
|
const handleDragGrant = useCallback((event) => {
|
|
283
288
|
dragStartYRef.current = toResponderPageY(event);
|
|
@@ -332,6 +337,7 @@ export function ProviderWidgetHostOverlay({ children, isVisible, nativeView, onR
|
|
|
332
337
|
const isSheetVisible = isVisible && sheetHostViewport !== undefined;
|
|
333
338
|
const pointerEvents = isSheetVisible ? "auto" : "none";
|
|
334
339
|
const sheetPresentation = useProviderWidgetSheetPresentation({
|
|
340
|
+
frameAppearance,
|
|
335
341
|
isVisible,
|
|
336
342
|
nativeView,
|
|
337
343
|
sheetHostLayoutUpdate,
|
package/dist/version.js
CHANGED
|
@@ -3,4 +3,4 @@ const reactNativeSdkVersion = typeof __GX_REACT_NATIVE_SDK_VERSION__ === "string
|
|
|
3
3
|
: "";
|
|
4
4
|
// Build scripts patch this fallback to the package version for published artifacts.
|
|
5
5
|
// Source-linked workspace usage keeps the local fallback.
|
|
6
|
-
export const REACT_NATIVE_SDK_VERSION = reactNativeSdkVersion.length > 0 ? reactNativeSdkVersion : "3.0.
|
|
6
|
+
export const REACT_NATIVE_SDK_VERSION = reactNativeSdkVersion.length > 0 ? reactNativeSdkVersion : "3.0.41";
|