Skip to content

Commit

Permalink
fix: demo app can't be displayed in doc site. (#695)
Browse files Browse the repository at this point in the history
  • Loading branch information
dohooo authored Oct 5, 2024
1 parent 9b0cf4d commit 846cc64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 0 additions & 6 deletions example/app/app/+html.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ export default function Root({ children }: { children: React.ReactNode }) {
content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1"
/>

{/* This CSP used to control which domain could embed this App. For now, we're using this App in doc site. */}
<meta
httpEquiv="Content-Security-Policy"
content="frame-ancestors 'self' https://app.rn-carousel.dev http://localhost:8002"
/>

{/*
Disable body scrolling on web. This makes ScrollView components work closer to how they do on native.
However, body scrolling is often nice to have for mobile web. If you want to enable it, remove this line.
Expand Down
11 changes: 10 additions & 1 deletion example/app/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,19 @@ function RootLayoutNav() {
const { inDoc } = useInDoc();

useEffect(() => {
console.log(
{
IS_WEB,
inDoc,
},
"====",
);
if (IS_WEB && inDoc) {
window.addEventListener("load", () => {
console.log("events called!");
const carouselComponent = document.getElementById("carousel-component");

console.log("carouselComponent exists!");
console.log(carouselComponent);
if (carouselComponent) {
console.log(carouselComponent.offsetHeight);
window.parent.postMessage(
Expand Down

0 comments on commit 846cc64

Please sign in to comment.