* feat(companion): TypeScript best practices improvements - Add separate tsconfig.extension.json for extension code typechecking - Add typecheck scripts: typecheck, typecheck:extension, typecheck:all - Create ambient declarations for browser extension APIs (browser.d.ts) - Create type definitions for attendee and google-calendar types - Replace all @ts-ignore with @ts-expect-error or remove where ambient declarations cover them - Replace any types with proper types in AuthContext, webAuth, buildPartialUpdatePayload - Fix implicit any errors in extension content.ts - Update deepEqual function to use unknown instead of any for better type safety All typechecks now pass for both app and extension code. * feat(companion): enable full TypeScript strict mode (#26208) * feat(companion): enable strictNullChecks and strictFunctionTypes Phase 1 of strict mode enablement for the companion app. Changes: - Enable strictNullChecks and strictFunctionTypes in tsconfig.json - Fix null check for scheduleDetails in fetchScheduleDetails - Add explicit type annotations to limits arrays in event-type-detail.tsx - Filter conferencing options with null appId before passing to buildLocationOptions - Update LimitsTab interface to use union type for field parameter - Add optional chaining for onEdit, onDuplicate, onDelete in EventTypeListItem.ios.tsx - Add explicit type annotations to options arrays in AvailabilityListScreen.tsx - Add explicit type annotations to dateOptions and timeOptions in RescheduleScreen.tsx - Fix type guard return types in calcom.ts to explicitly return boolean All typechecks pass for both app and extension code. * feat(companion): enable full strict mode and fix any types (Phase 2 + Step 7) Phase 2: Enable full strict mode - Replace strictNullChecks + strictFunctionTypes with strict: true - Fix implicit any errors in Alert.prompt callbacks (BookingDetailScreen, useBookingActions) Step 7: Fix metadata any types in type definition files - Update UserProfile.metadata to Record<string, unknown> - Update CreateEventTypeInput.metadata to Record<string, unknown> - Update Booking.responses to Record<string, unknown> All typechecks pass for both app and extension code with full strict mode enabled. * use JSON.stringify() * fix restores the recursive key comparison with sorted keys * prevents false positives when objects have different keys * feat(companion): add tree shaking optimization scripts (#26212) * feat(companion): add tree shaking optimization scripts Add npm scripts to enable Expo's experimental tree shaking for production builds: - export: Basic expo export command - export:ios / export:android: Platform-specific exports - export:optimized: Export with tree shaking enabled (all platforms) - export:optimized:ios / export:optimized:android: Platform-specific with tree shaking Bundle size improvement measured: - Baseline: 5.48 MB (1804 modules) - With tree shaking: 5.25 MB (1831 modules) - Reduction: ~230 KB (4.2% smaller) Also documented tree shaking configuration options in .env.example for: - npm scripts (recommended) - Manual env var setting - EAS build profile configuration * revert .env.example file * revert .env.example file
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import { Platform, ViewStyle } from "react-native";
|
|
|
|
interface ShadowConfig {
|
|
color?: string;
|
|
offsetY?: number;
|
|
offsetX?: number;
|
|
opacity?: number;
|
|
radius?: number;
|
|
elevation?: number;
|
|
}
|
|
|
|
export function createShadow(config: ShadowConfig = {}): ViewStyle {
|
|
const {
|
|
color = "#000",
|
|
offsetX = 0,
|
|
offsetY = 2,
|
|
opacity = 0.1,
|
|
radius = 8,
|
|
elevation = 4,
|
|
} = config;
|
|
|
|
if (Platform.OS === "web") {
|
|
const alpha = Math.round(opacity * 255)
|
|
.toString(16)
|
|
.padStart(2, "0");
|
|
return {
|
|
boxShadow: `${offsetX}px ${offsetY}px ${radius}px rgba(0, 0, 0, ${opacity})`,
|
|
} as ViewStyle;
|
|
}
|
|
|
|
return {
|
|
shadowColor: color,
|
|
shadowOffset: { width: offsetX, height: offsetY },
|
|
shadowOpacity: opacity,
|
|
shadowRadius: radius,
|
|
elevation,
|
|
};
|
|
}
|
|
|
|
export const shadows = {
|
|
sm: () => createShadow({ offsetY: 1, radius: 3, opacity: 0.1, elevation: 2 }),
|
|
md: () => createShadow({ offsetY: 4, radius: 6, opacity: 0.1, elevation: 4 }),
|
|
lg: () => createShadow({ offsetY: 10, radius: 15, opacity: 0.15, elevation: 8 }),
|
|
xl: () => createShadow({ offsetY: 20, radius: 25, opacity: 0.25, elevation: 24 }),
|
|
none: (): ViewStyle => ({}),
|
|
};
|