From 34e35f399bfbe316d9699d4c837bbc3808cae2da Mon Sep 17 00:00:00 2001 From: Christian Pillsbury Date: Tue, 29 Jul 2025 13:45:08 -0700 Subject: [PATCH] refactor: convert React Native packages to stubs and fix remaining build issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Convert @vjs-10/react-native packages to placeholder stubs for future implementation - Move Video.tsx from @vjs-10/react-media-elements to @vjs-10/react package - Fix React JSX compilation errors by changing jsx config from react-jsx to react - Add React imports to all TSX files to resolve UMD global errors - Remove React Native specific dependencies from package.json files - Refactor @vjs-10/react-media-elements to export VideoElement/AudioElement with placeholders - All packages now build successfully with monorepo architecture intact 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../react-native-icons/package.json | 12 +- .../react-native-icons/src/index.tsx | 71 ++--- .../react-native-media-elements/package.json | 12 +- .../react-native-media-elements/src/index.tsx | 163 +--------- .../react-native/react-native/package.json | 12 +- .../react-native/react-native/src/index.tsx | 290 +----------------- packages/react/react-icons/src/index.tsx | 74 ----- packages/react/react-icons/tsconfig.json | 2 +- .../react/react-media-elements/src/index.ts | 5 +- .../src/{index.tsx => media-elements.tsx} | 62 +++- .../react/react-media-elements/tsconfig.json | 2 +- .../react-media-store/src/MediaProvider.tsx | 12 +- .../src/useSyncExternalStoreWithSelector.ts | 6 +- .../react/react-media-store/tsconfig.json | 2 +- .../connected-with-defaults/MuteButton.tsx | 1 + .../connected-with-defaults/PlayButton.tsx | 1 + .../connected-with-defaults/Video.tsx | 1 + .../src/components/connected/MuteButton.tsx | 1 + .../src/components/connected/PlayButton.tsx | 1 + .../react/src/components/connected/Video.tsx | 1 + .../src/components/media-elements}/Video.tsx | 3 +- .../react/src/components/ui/MuteButton.tsx | 1 + .../react/src/components/ui/PlayButton.tsx | 1 + packages/react/react/src/index.tsx | 3 +- packages/react/react/tsconfig.json | 2 +- 25 files changed, 145 insertions(+), 596 deletions(-) delete mode 100644 packages/react/react-icons/src/index.tsx rename packages/react/react-media-elements/src/{index.tsx => media-elements.tsx} (82%) rename packages/react/{react-media-elements/src => react/src/components/media-elements}/Video.tsx (98%) diff --git a/packages/react-native/react-native-icons/package.json b/packages/react-native/react-native-icons/package.json index db9a8a45..ac62f83c 100644 --- a/packages/react-native/react-native-icons/package.json +++ b/packages/react-native/react-native-icons/package.json @@ -20,20 +20,14 @@ "mobile" ], "license": "Apache-2.0", - "dependencies": { - "@vjs-10/icons": "*" - }, + "dependencies": {}, "peerDependencies": { - "react": ">=16.8.0", - "react-native": ">=0.60.0", - "react-native-svg": ">=12.0.0" + "react": ">=16.8.0" }, "devDependencies": { "typescript": "^5.3.0", "@types/react": "^18.0.0", - "@types/react-native": "^0.72.0", - "react": "^18.0.0", - "react-native": "^0.72.0" + "react": "^18.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/react-native/react-native-icons/src/index.tsx b/packages/react-native/react-native-icons/src/index.tsx index 10c86196..7b2706df 100644 --- a/packages/react-native/react-native-icons/src/index.tsx +++ b/packages/react-native/react-native-icons/src/index.tsx @@ -1,67 +1,44 @@ -import React from 'react'; -import { getIcon } from '@vjs-10/icons'; -import Svg, { Path, SvgProps } from 'react-native-svg'; +import * as React from 'react'; -export interface IconProps extends Omit { +// Placeholder exports for React Native Icons package +// These will be implemented in a future step + +export interface IconProps { name: string; size?: number; color?: string; } -export const Icon: React.FC = ({ - name, - size = 24, - color = '#000000', - ...props -}) => { - const icon = getIcon(name); - - if (!icon) { - console.warn(`Icon "${name}" not found`); - return null; - } - - return ( - - {icon.paths.map((path, index) => ( - - ))} - - ); +// Placeholder component - will be implemented later +export const Icon: React.FC = () => { + return React.createElement('div', { children: 'React Native Icon - Coming Soon' }); }; -export const PlayIcon: React.FC> = (props) => ( - +// Placeholder icon components +export const PlayIcon: React.FC> = () => ( + React.createElement('div', { children: 'Play Icon - Coming Soon' }) ); -export const PauseIcon: React.FC> = (props) => ( - +export const PauseIcon: React.FC> = () => ( + React.createElement('div', { children: 'Pause Icon - Coming Soon' }) ); -export const StopIcon: React.FC> = (props) => ( - +export const StopIcon: React.FC> = () => ( + React.createElement('div', { children: 'Stop Icon - Coming Soon' }) ); -export const VolumeUpIcon: React.FC> = (props) => ( - +export const VolumeUpIcon: React.FC> = () => ( + React.createElement('div', { children: 'Volume Up Icon - Coming Soon' }) ); -export const VolumeOffIcon: React.FC> = (props) => ( - +export const VolumeOffIcon: React.FC> = () => ( + React.createElement('div', { children: 'Volume Off Icon - Coming Soon' }) ); -export const FullscreenIcon: React.FC> = (props) => ( - +export const FullscreenIcon: React.FC> = () => ( + React.createElement('div', { children: 'Fullscreen Icon - Coming Soon' }) ); -export const ExitFullscreenIcon: React.FC> = (props) => ( - -); - -export { getIcon, getAllIcons, createSVGString } from '@vjs-10/icons'; \ No newline at end of file +export const ExitFullscreenIcon: React.FC> = () => ( + React.createElement('div', { children: 'Exit Fullscreen Icon - Coming Soon' }) +); \ No newline at end of file diff --git a/packages/react-native/react-native-media-elements/package.json b/packages/react-native/react-native-media-elements/package.json index 668b7ee5..7e523bb8 100644 --- a/packages/react-native/react-native-media-elements/package.json +++ b/packages/react-native/react-native-media-elements/package.json @@ -20,20 +20,14 @@ "mobile" ], "license": "Apache-2.0", - "dependencies": { - "@vjs-10/media": "*" - }, + "dependencies": {}, "peerDependencies": { - "react": ">=16.8.0", - "react-native": ">=0.60.0", - "react-native-video": ">=5.0.0" + "react": ">=16.8.0" }, "devDependencies": { "typescript": "^5.3.0", "@types/react": "^18.0.0", - "@types/react-native": "^0.72.0", - "react": "^18.0.0", - "react-native": "^0.72.0" + "react": "^18.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/react-native/react-native-media-elements/src/index.tsx b/packages/react-native/react-native-media-elements/src/index.tsx index f46f468c..7554b893 100644 --- a/packages/react-native/react-native-media-elements/src/index.tsx +++ b/packages/react-native/react-native-media-elements/src/index.tsx @@ -1,7 +1,7 @@ -import React, { useRef, useImperativeHandle, forwardRef } from 'react'; -import { StyleSheet, ViewStyle } from 'react-native'; -import Video, { VideoRef, OnLoadData, OnProgressData } from 'react-native-video'; -import { MediaReadyState, MediaNetworkState, READY_STATE, NETWORK_STATE } from '@vjs-10/media'; +import * as React from 'react'; + +// Placeholder exports for React Native Media Elements package +// These will be implemented in a future step export interface MediaElementProps { source?: { uri: string }; @@ -12,11 +12,11 @@ export interface MediaElementProps { rate?: number; repeat?: boolean; resizeMode?: 'contain' | 'cover' | 'stretch'; - onLoad?: (data: OnLoadData) => void; - onProgress?: (data: OnProgressData) => void; + onLoad?: (data: any) => void; + onProgress?: (data: any) => void; onEnd?: () => void; onError?: (error: any) => void; - style?: ViewStyle; + style?: any; // React Native ViewStyle } export interface MediaElementRef { @@ -27,8 +27,8 @@ export interface MediaElementRef { volume: number; muted: boolean; playbackRate: number; - readyState: MediaReadyState; - networkState: MediaNetworkState; + readyState: number; + networkState: number; play(): Promise; pause(): void; @@ -36,146 +36,11 @@ export interface MediaElementRef { seek(time: number): void; } -export const VideoElement = forwardRef( - ({ - source, - controls = false, - paused = true, - muted = false, - volume = 1.0, - rate = 1.0, - repeat = false, - resizeMode = 'contain', - onLoad, - onProgress, - onEnd, - onError, - style, - }, ref) => { - const videoRef = useRef(null); - const stateRef = useRef({ - currentTime: 0, - duration: 0, - paused: true, - ended: false, - volume: 1.0, - muted: false, - playbackRate: 1.0, - readyState: READY_STATE.HAVE_NOTHING, - networkState: NETWORK_STATE.EMPTY, - }); - - const handleLoad = (data: OnLoadData) => { - stateRef.current.duration = data.duration; - stateRef.current.readyState = READY_STATE.HAVE_METADATA; - stateRef.current.networkState = NETWORK_STATE.IDLE; - onLoad?.(data); - }; - - const handleProgress = (data: OnProgressData) => { - stateRef.current.currentTime = data.currentTime; - onProgress?.(data); - }; - - const handleEnd = () => { - stateRef.current.ended = true; - stateRef.current.paused = true; - onEnd?.(); - }; - - const handleError = (error: any) => { - stateRef.current.networkState = NETWORK_STATE.NO_SOURCE; - onError?.(error); - }; - - useImperativeHandle(ref, () => ({ - get currentTime() { - return stateRef.current.currentTime; - }, - get duration() { - return stateRef.current.duration; - }, - get paused() { - return stateRef.current.paused; - }, - get ended() { - return stateRef.current.ended; - }, - get volume() { - return stateRef.current.volume; - }, - get muted() { - return stateRef.current.muted; - }, - get playbackRate() { - return stateRef.current.playbackRate; - }, - get readyState() { - return stateRef.current.readyState; - }, - get networkState() { - return stateRef.current.networkState; - }, - play: async () => { - stateRef.current.paused = false; - stateRef.current.ended = false; - }, - pause: () => { - stateRef.current.paused = true; - }, - load: () => { - stateRef.current.networkState = NETWORK_STATE.LOADING; - }, - seek: (time: number) => { - videoRef.current?.seek(time); - stateRef.current.currentTime = time; - }, - }), []); - - React.useEffect(() => { - stateRef.current.paused = paused; - }, [paused]); - - React.useEffect(() => { - stateRef.current.volume = volume; - }, [volume]); - - React.useEffect(() => { - stateRef.current.muted = muted; - }, [muted]); - - React.useEffect(() => { - stateRef.current.playbackRate = rate; - }, [rate]); - - return ( -