advanced-games-library
Version:
Advanced Gaming Library for React Native - Four Complete Games with iOS Compatibility Fixes
101 lines (87 loc) • 3.16 kB
TypeScript
// React Native type overrides to fix component type conflicts
declare module 'react-native' {
import * as React from 'react';
// Basic components
export const View: React.ComponentType<any>;
export const Text: React.ComponentType<any>;
export const TouchableOpacity: React.ComponentType<any>;
export const TextInput: React.ComponentType<any>;
export const FlatList: React.ComponentType<any>;
export const Switch: React.ComponentType<any>;
export const ActivityIndicator: React.ComponentType<any>;
export const ScrollView: React.ComponentType<any>;
export const Image: React.ComponentType<any>;
export const Modal: React.ComponentType<any>;
export const SafeAreaView: React.ComponentType<any>;
export const StatusBar: React.ComponentType<any>;
// Style types
export interface ViewStyle {
[key: string]: any;
}
export interface TextStyle {
[key: string]: any;
}
export interface ImageStyle {
[key: string]: any;
}
// Animated
export const Animated: {
View: React.ComponentType<any>;
Text: React.ComponentType<any>;
Image: React.ComponentType<any>;
Value: any;
timing: any;
spring: any;
sequence: any;
loop: any;
parallel: any;
stagger: any;
delay: any;
};
// Alert
export const Alert: {
alert(title: string, message?: string, buttons?: any[]): void;
};
// Dimensions
export const Dimensions: {
get(dim: string): { width: number; height: number };
};
// StyleSheet
export const StyleSheet: {
create<T>(styles: T): T;
};
// AsyncStorage (mock for web)
export const AsyncStorage: {
getItem(key: string): Promise<string | null>;
setItem(key: string, value: string): Promise<void>;
removeItem(key: string): Promise<void>;
clear(): Promise<void>;
getAllKeys(): Promise<string[]>;
};
}
// React type overrides
declare module 'react' {
export type FC<P = {}> = React.FunctionComponent<P>;
export const useState: <T>(initialState?: T | (() => T)) => [T | undefined, (newState: T | ((prevState: T | undefined) => T)) => void];
export const useEffect: (effect: () => void | (() => void), deps?: any[]) => void;
export const useCallback: <T extends (...args: any[]) => any>(callback: T, deps: any[]) => T;
export const useRef: <T>(initialValue?: T) => { current: T | undefined };
export const useMemo: <T>(factory: () => T, deps: any[]) => T;
}
// Global type declarations
declare global {
interface Window {
addEventListener(type: string, listener: (event: Event) => void): void;
removeEventListener(type: string, listener: (event: Event) => void): void;
}
interface WeakRef<T> {
deref(): T | undefined;
}
var WeakRef: {
new <T>(target: T): WeakRef<T>;
};
function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): number;
function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): number;
function clearTimeout(id: number): void;
function clearInterval(id: number): void;
}