chore(lint): hoist SheetBackground combined style

This commit is contained in:
Mohamed Boudra
2026-04-24 02:01:18 +07:00
parent 34258780ec
commit 6c13bd9ab3
2 changed files with 34 additions and 27 deletions

View File

@@ -143,18 +143,18 @@ const styles = StyleSheet.create((theme) => ({
function SheetBackground({ style }: BottomSheetBackgroundProps) {
const { theme } = useUnistyles();
return (
<View
style={[
style,
{
backgroundColor: theme.colors.surface1,
borderTopLeftRadius: theme.borderRadius.xl,
borderTopRightRadius: theme.borderRadius.xl,
},
]}
/>
const combinedStyle = useMemo(
() => [
style,
{
backgroundColor: theme.colors.surface1,
borderTopLeftRadius: theme.borderRadius.xl,
borderTopRightRadius: theme.borderRadius.xl,
},
],
[style, theme.colors.surface1, theme.borderRadius.xl],
);
return <View style={combinedStyle} />;
}
export interface AdaptiveModalSheetProps {

View File

@@ -19,6 +19,26 @@ export class PackageVersionResolutionError extends Error {
}
}
function readMatchingPackageVersion(
packageJsonPath: string,
packageName: string,
moduleUrl: string,
): string | null {
let packageJson: PackageJson;
try {
packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8")) as PackageJson;
} catch {
return null;
}
if (packageJson.name !== packageName) {
return null;
}
if (typeof packageJson.version === "string" && packageJson.version.trim().length > 0) {
return packageJson.version.trim();
}
throw new PackageVersionResolutionError({ moduleUrl, packageName });
}
export function resolvePackageVersion(params: ResolvePackageVersionParams): string {
const moduleUrl = params.moduleUrl ?? import.meta.url;
let currentDir = path.dirname(fileURLToPath(moduleUrl));
@@ -26,22 +46,9 @@ export function resolvePackageVersion(params: ResolvePackageVersionParams): stri
while (true) {
const packageJsonPath = path.join(currentDir, "package.json");
if (existsSync(packageJsonPath)) {
try {
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8")) as PackageJson;
if (packageJson.name === params.packageName) {
if (typeof packageJson.version === "string" && packageJson.version.trim().length > 0) {
return packageJson.version.trim();
}
throw new PackageVersionResolutionError({
moduleUrl,
packageName: params.packageName,
});
}
} catch (error) {
if (error instanceof PackageVersionResolutionError) {
throw error;
}
// Continue searching parent directories.
const version = readMatchingPackageVersion(packageJsonPath, params.packageName, moduleUrl);
if (version !== null) {
return version;
}
}