Skip to content

Commit

Permalink
fix: demo app can't be displayed in doc site.
Browse files Browse the repository at this point in the history
  • Loading branch information
dohooo committed Oct 5, 2024
1 parent 849f941 commit c64cb6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 30 deletions.
5 changes: 3 additions & 2 deletions example/app/app/+html.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ export default function Root({ children }: { children: React.ReactNode }) {
dangerouslySetInnerHTML={{
__html: `
window.addEventListener("load", () => {
console.log("load called!");
console.log(window.location.search);
// get in_doc search param and condition if it's set to true
const inDoc = window.location.search.includes("in_doc=true");
console.log("inDoc", inDoc);
if (!inDoc) {
return;
}
console.log("events called!");
const carouselComponent = document.getElementById("carousel-component");
console.log("carouselComponent exists!");
console.log(carouselComponent);
Expand Down
28 changes: 0 additions & 28 deletions example/app/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,34 +57,6 @@ function RootLayoutNav() {
const [isRTL, setIsRTL] = useState(I18nManager.isRTL);
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(
{
type: "carouselHeight",
height: carouselComponent.offsetHeight,
},
"*",
);
}
});
}
}, [inDoc]);

const backgroundColor = inDoc
? tamaguiConfig.themes.dark.background.val
: tamaguiConfig.themes.light.background.val;
Expand Down

0 comments on commit c64cb6d

Please sign in to comment.