-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2720 from gluestack/release/[email protected]
Release/image [email protected]
- Loading branch information
Showing
9 changed files
with
138 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
example/storybook-nativewind/src/extra-components/nativewind/VadimStream.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
'use client'; | ||
import { Box } from '@/components/ui/box'; | ||
import React, { useEffect } from 'react'; | ||
|
||
declare global { | ||
interface Window { | ||
onYouTubeIframeAPIReady: () => void; | ||
YT: any; | ||
} | ||
} | ||
|
||
const VadimStream = () => { | ||
useEffect(() => { | ||
// Only load the API if it hasn't been loaded yet | ||
if (!document.getElementById('youtube-api')) { | ||
const tag = document.createElement('script'); | ||
tag.id = 'youtube-api'; | ||
tag.src = 'https://www.youtube.com/iframe_api'; | ||
const firstScriptTag = document.getElementsByTagName('script')[0]; | ||
firstScriptTag.parentNode?.insertBefore(tag, firstScriptTag); | ||
} | ||
|
||
// Initialize players when API is ready | ||
const initializePlayers = () => { | ||
new window.YT.Player('player1', { | ||
events: { | ||
onStateChange: (event: any) => { | ||
if (event.data === window.YT.PlayerState.PLAYING) { | ||
const player2Frame = document.getElementById( | ||
'player2' | ||
) as HTMLIFrameElement; | ||
player2Frame?.contentWindow?.postMessage( | ||
'{"event":"command","func":"pauseVideo","args":""}', | ||
'*' | ||
); | ||
} | ||
}, | ||
}, | ||
}); | ||
|
||
new window.YT.Player('player2', { | ||
events: { | ||
onStateChange: (event: any) => { | ||
if (event.data === window.YT.PlayerState.PLAYING) { | ||
const player1Frame = document.getElementById( | ||
'player1' | ||
) as HTMLIFrameElement; | ||
player1Frame?.contentWindow?.postMessage( | ||
'{"event":"command","func":"pauseVideo","args":""}', | ||
'*' | ||
); | ||
} | ||
}, | ||
}, | ||
}); | ||
}; | ||
|
||
// If API is already loaded, initialize players directly | ||
if (window.YT && window.YT.Player) { | ||
initializePlayers(); | ||
} else { | ||
// Otherwise wait for API to load | ||
window.onYouTubeIframeAPIReady = initializePlayers; | ||
} | ||
|
||
return () => { | ||
// Only reset the ready handler, don't remove the script | ||
window.onYouTubeIframeAPIReady = () => {}; | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<Box className="relative flex-1 w-full h-full gap-5 flex-col md:flex-row"> | ||
<Box className="flex-1 border border-outline-200 rounded-lg overflow-hidden aspect-video"> | ||
<iframe | ||
id="player1" | ||
width="100%" | ||
height="100%" | ||
src="https://www.youtube.com/embed/FBXUPJ9_Xl0?enablejsapi=1" | ||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" | ||
allowFullScreen | ||
/> | ||
</Box> | ||
<Box className="flex-1 border border-outline-200 rounded-lg overflow-hidden aspect-video"> | ||
<iframe | ||
id="player2" | ||
width="100%" | ||
height="100%" | ||
src="https://www.youtube.com/embed/9ErkOcDWJxI?enablejsapi=1" | ||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" | ||
allowFullScreen | ||
/> | ||
</Box> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default VadimStream; |
16 changes: 16 additions & 0 deletions
16
...ook-nativewind/src/guides/tutorials/building-ecommerce-app/index.nw.stories.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
title: Learn to build Ecommerce App using gluestack | ||
|
||
description: Tutorial to build Ecommerce App using gluestack-ui from Youtube guru notJust.dev (Vadim) | ||
--- | ||
|
||
import { Meta } from '@storybook/addon-docs'; | ||
import VadimStream from '../../../extra-components/nativewind/VadimStream'; | ||
|
||
<Meta title="with-nativewind/Guides/Tutorials/Building Ecommerce App" /> | ||
|
||
# Learn about gluestack from Youtube guru [notJust.dev](https://www.youtube.com/@notjustdev) | ||
|
||
Vadim, popularly known as "not-just-dev" on YouTube, offers insightful and practical videos that explore a wide range of developer tools and frameworks, including Gluestack-UI. | ||
|
||
<VadimStream /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters