@lodev09/react-native-true-sheet 4.0.0-beta.6 → 4.0.0-beta.7
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/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayView.kt +106 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayViewManager.kt +45 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetPackage.kt +2 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetStateUpdater.kt +18 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +3 -25
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetOverlayRootView.kt +137 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/ViewUtils.kt +19 -0
- package/android/src/main/jni/TrueSheetSpec.h +1 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetLayoutUtils.h +46 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewComponentDescriptor.h +21 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.cpp +17 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.h +36 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.cpp +4 -35
- package/ios/TrueSheetContentView.h +3 -1
- package/ios/TrueSheetContentView.mm +11 -0
- package/ios/TrueSheetOverlayView.h +32 -0
- package/ios/TrueSheetOverlayView.mm +141 -0
- package/ios/TrueSheetView.mm +17 -0
- package/ios/TrueSheetViewController.mm +27 -13
- package/ios/core/TrueSheetOverlayContainerView.h +31 -0
- package/ios/core/TrueSheetOverlayContainerView.mm +35 -0
- package/ios/tvos/TrueSheetStubs.mm +12 -0
- package/lib/module/TrueSheetOverlay.js +30 -0
- package/lib/module/TrueSheetOverlay.js.map +1 -0
- package/lib/module/TrueSheetOverlay.web.js +35 -0
- package/lib/module/TrueSheetOverlay.web.js.map +1 -0
- package/lib/module/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/mocks/index.js +10 -0
- package/lib/module/mocks/index.js.map +1 -1
- package/lib/typescript/src/TrueSheetOverlay.d.ts +8 -0
- package/lib/typescript/src/TrueSheetOverlay.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetOverlay.web.d.ts +8 -0
- package/lib/typescript/src/TrueSheetOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/fabric/TrueSheetOverlayViewNativeComponent.d.ts +6 -0
- package/lib/typescript/src/fabric/TrueSheetOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mocks/index.d.ts +4 -0
- package/lib/typescript/src/mocks/index.d.ts.map +1 -1
- package/package.json +9 -1
- package/react-native.config.js +1 -0
- package/src/TrueSheetOverlay.tsx +24 -0
- package/src/TrueSheetOverlay.web.tsx +33 -0
- package/src/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/src/index.ts +1 -0
- package/src/mocks/index.ts +7 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference lib="dom" />
|
|
2
|
+
import { useLayoutEffect, useState } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { StyleSheet, View, type ViewProps } from 'react-native';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Renders its children in a layer above every presented sheet — for
|
|
8
|
+
* toasts, dialogs, and other content a sheet must not cover.
|
|
9
|
+
* Fills the window; touches that miss its children pass through to the views beneath.
|
|
10
|
+
*/
|
|
11
|
+
export const TrueSheetOverlay = ({ style, ...rest }: ViewProps) => {
|
|
12
|
+
// Portal target appended to the body so it stacks above the sheets' portal
|
|
13
|
+
const [container] = useState(() =>
|
|
14
|
+
typeof document !== 'undefined' ? document.createElement('div') : null
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
useLayoutEffect(() => {
|
|
18
|
+
if (!container) return;
|
|
19
|
+
|
|
20
|
+
container.style.cssText = 'position:fixed;inset:0;pointer-events:none';
|
|
21
|
+
document.body.appendChild(container);
|
|
22
|
+
return () => {
|
|
23
|
+
container.remove();
|
|
24
|
+
};
|
|
25
|
+
}, [container]);
|
|
26
|
+
|
|
27
|
+
if (!container) return null;
|
|
28
|
+
|
|
29
|
+
return createPortal(
|
|
30
|
+
<View pointerEvents="box-none" {...rest} style={[StyleSheet.absoluteFill, style]} />,
|
|
31
|
+
container
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ViewProps } from 'react-native';
|
|
2
|
+
import { codegenNativeComponent } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface NativeProps extends ViewProps {
|
|
5
|
+
// No props needed - sized to the window from native
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// interfaceOnly: shadow node/state/descriptor are custom (common/cpp) so the
|
|
9
|
+
// overlay is sized to the window
|
|
10
|
+
export default codegenNativeComponent<NativeProps>('TrueSheetOverlayView', {
|
|
11
|
+
interfaceOnly: true,
|
|
12
|
+
});
|
package/src/index.ts
CHANGED
package/src/mocks/index.ts
CHANGED
|
@@ -66,6 +66,13 @@ export function TrueSheetPeek({ children, ...rest }: ViewProps) {
|
|
|
66
66
|
return React.createElement(View, rest, children);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Mock TrueSheetOverlay component for testing.
|
|
71
|
+
*/
|
|
72
|
+
export function TrueSheetOverlay({ children, ...rest }: ViewProps) {
|
|
73
|
+
return React.createElement(View, rest, children);
|
|
74
|
+
}
|
|
75
|
+
|
|
69
76
|
/**
|
|
70
77
|
* Mock TrueSheetProvider for testing.
|
|
71
78
|
*/
|