feat: apple view filtering (#10681)

[skip ci]
This commit is contained in:
Nathan Walker
2025-01-29 16:56:54 -08:00
committed by GitHub
parent f9e7088d07
commit 20fc1cc1d4
7 changed files with 14 additions and 8 deletions

View File

@@ -42,7 +42,7 @@ export type { ImageAssetOptions } from './image-asset';
export { ImageSource } from './image-source';
export { ModuleNameResolver, _setResolver } from './module-name-resolver';
export type { ModuleListProvider, PlatformContext } from './module-name-resolver';
export { isAndroid, isIOS, Screen, Device, platformNames } from './platform';
export { isAndroid, isIOS, isVisionOS, isApple, Screen, Device, platformNames } from './platform';
export type { IDevice } from './platform';
export { profile, enable as profilingEnable, disable as profilingDisable, time as profilingTime, uptime as profilingUptime, start as profilingStart, stop as profilingStop, isRunning as profilingIsRunning, dumpProfiles as profilingDumpProfiles, resetProfiles as profilingResetProfiles, startCPUProfile as profilingStartCPU, stopCPUProfile as profilingStopCPU } from './profiling';
export type { InstrumentationMode, TimerInfo } from './profiling';

View File

@@ -33,7 +33,7 @@ export type { ImageAssetOptions } from './image-asset';
export { ImageSource } from './image-source';
export { ModuleNameResolver, _setResolver } from './module-name-resolver';
export type { ModuleListProvider, PlatformContext } from './module-name-resolver';
export { isAndroid, isIOS, Screen, Device, platformNames } from './platform';
export { isAndroid, isIOS, isVisionOS, isApple, Screen, Device, platformNames } from './platform';
export type { IDevice } from './platform';
// Profiling

View File

@@ -5,6 +5,7 @@ export const platformNames = {
android: 'Android',
ios: 'iOS',
visionos: 'visionOS',
apple: 'apple',
};
export const isAndroid = !!__ANDROID__;

View File

@@ -17,6 +17,7 @@ import { xml2ui } from './xml2ui';
export const ios = platformNames.ios.toLowerCase();
export const android = platformNames.android.toLowerCase();
export const visionos = platformNames.visionos.toLowerCase();
export const apple = platformNames.apple.toLowerCase();
export const defaultNameSpaceMatcher = /tns\.xsd$/i;
export interface LoadOptions {

View File

@@ -6,7 +6,7 @@ import { getComponentModule } from './component-builder';
import type { ComponentModule } from './component-builder';
import { Device } from '../../platform';
import { profile } from '../../profiling';
import { android, ios, visionos, loadCustomComponent, defaultNameSpaceMatcher, getExports, Builder } from './index';
import { android, ios, visionos, apple, loadCustomComponent, defaultNameSpaceMatcher, getExports, Builder } from './index';
export namespace xml2ui {
/**
@@ -135,14 +135,15 @@ export namespace xml2ui {
if (value) {
const toLower = value.toLowerCase();
return toLower === android || toLower === ios || toLower === visionos;
return toLower === android || toLower === ios || toLower === visionos || toLower === apple;
}
return false;
}
private static isCurentPlatform(value: string): boolean {
return value && value.toLowerCase() === Device.os.toLowerCase();
value = value && value.toLowerCase();
return value === apple ? __APPLE__ : value === Device.os.toLowerCase();
}
}