chore: use __ANDROID__ and __IOS__ throughout (#10446)

Standardizes usage for more macro style removal during bundling for target platforms.
[skip ci]
This commit is contained in:
farfromrefuge
2023-11-25 16:34:25 +00:00
committed by GitHub
parent 48b1856d6c
commit 40b2a6a6db
21 changed files with 52 additions and 52 deletions

View File

@@ -55,7 +55,7 @@ export const iosAccessibilityMaxFontScaleProperty = new InheritedCssProperty<Sty
}); });
iosAccessibilityMaxFontScaleProperty.register(Style); iosAccessibilityMaxFontScaleProperty.register(Style);
export const accessibilityHiddenProperty = new (global.isIOS ? InheritedCssProperty : CssProperty)({ export const accessibilityHiddenProperty = new (__IOS__ ? InheritedCssProperty : CssProperty)({
name: 'accessibilityHidden', name: 'accessibilityHidden',
cssName: 'a11y-hidden', cssName: 'a11y-hidden',
valueConverter: booleanConverter, valueConverter: booleanConverter,

View File

@@ -1,4 +1,4 @@
export const VALID_FONT_SCALES = global.isIOS // iOS supports a wider number of font scales than Android does. export const VALID_FONT_SCALES = __IOS__ // iOS supports a wider number of font scales than Android does.
? [0.5, 0.7, 0.85, 1, 1.15, 1.3, 1.5, 2, 2.5, 3, 3.5, 4] ? [0.5, 0.7, 0.85, 1, 1.15, 1.3, 1.5, 2, 2.5, 3, 3.5, 4]
: [0.85, 1, 1.15, 1.3]; : [0.85, 1, 1.15, 1.3];

View File

@@ -11,7 +11,7 @@ let fileAccess: IFileSystemAccess;
*/ */
export function getFileAccess(): IFileSystemAccess { export function getFileAccess(): IFileSystemAccess {
if (!fileAccess) { if (!fileAccess) {
if (global.isAndroid && SDK_VERSION >= 29) { if (__ANDROID__ && SDK_VERSION >= 29) {
fileAccess = new FileSystemAccess29(); fileAccess = new FileSystemAccess29();
} else { } else {
fileAccess = new FileSystemAccess(); fileAccess = new FileSystemAccess();
@@ -275,7 +275,7 @@ function getAndroidDirectory(value: AndroidDirectory): { path: string; column: a
class Android { class Android {
createFile(options: { relativePath?: string; name: string; mime: string; directory: AndroidDirectory }): File { createFile(options: { relativePath?: string; name: string; mime: string; directory: AndroidDirectory }): File {
if (!global.isAndroid) { if (!__ANDROID__) {
throw new Error(`createFile is available on Android only!`); throw new Error(`createFile is available on Android only!`);
} }
@@ -326,7 +326,7 @@ export class File extends FileSystemEntity {
throw error; throw error;
}; };
if (global.isAndroid && copy) { if (__ANDROID__ && copy) {
if (path.startsWith('content:')) { if (path.startsWith('content:')) {
const fileInfo = getFileAccess().getFile(path, onError); const fileInfo = getFileAccess().getFile(path, onError);
// falls back to creating a temp file without a known extension. // falls back to creating a temp file without a known extension.
@@ -897,7 +897,7 @@ export namespace knownFolders {
export namespace ios { export namespace ios {
function _checkPlatform(knownFolderName: string) { function _checkPlatform(knownFolderName: string) {
if (!global.isIOS) { if (!__IOS__) {
throw new Error(`The "${knownFolderName}" known folder is available on iOS only!`); throw new Error(`The "${knownFolderName}" known folder is available on iOS only!`);
} }
} }

View File

@@ -27,7 +27,7 @@ export class ContentView extends CustomLayoutView implements AddChildFromBuilder
} }
this._onContentChanged(oldView, value); this._onContentChanged(oldView, value);
if (global.isIOS && oldView !== value) { if (__IOS__ && oldView !== value) {
this.requestLayout(); this.requestLayout();
} }
} }

View File

@@ -991,7 +991,7 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
private resetNativeViewInternal(): void { private resetNativeViewInternal(): void {
// const nativeView = this.nativeViewProtected; // const nativeView = this.nativeViewProtected;
// if (nativeView && global.isAndroid) { // if (nativeView && __ANDROID__) {
// const recycle = this.recycleNativeView; // const recycle = this.recycleNativeView;
// if (recycle === "always" || (recycle === "auto" && !this._disableNativeViewRecycling)) { // if (recycle === "always" || (recycle === "auto" && !this._disableNativeViewRecycling)) {
// resetNativeView(this); // resetNativeView(this);
@@ -1038,7 +1038,7 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
// or for backward compatibility - set before _setupUI in iOS constructor. // or for backward compatibility - set before _setupUI in iOS constructor.
let nativeView = this.nativeViewProtected; let nativeView = this.nativeViewProtected;
// if (global.isAndroid) { // if (__ANDROID__) {
// const recycle = this.recycleNativeView; // const recycle = this.recycleNativeView;
// if (recycle === "always" || (recycle === "auto" && !this._disableNativeViewRecycling)) { // if (recycle === "always" || (recycle === "auto" && !this._disableNativeViewRecycling)) {
// nativeView = <android.view.View>getNativeView(context, this.typeName); // nativeView = <android.view.View>getNativeView(context, this.typeName);
@@ -1048,7 +1048,7 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
nativeView = this.createNativeView(); nativeView = this.createNativeView();
} }
if (global.isAndroid) { if (__ANDROID__) {
// this check is also unecessary as this code should never be reached with _androidView != null unless reusable = true // this check is also unecessary as this code should never be reached with _androidView != null unless reusable = true
// also adding this check for feature flag safety // also adding this check for feature flag safety
if (this._androidView !== nativeView || !this.reusable) { if (this._androidView !== nativeView || !this.reusable) {
@@ -1172,7 +1172,7 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
} }
// const nativeView = this.nativeViewProtected; // const nativeView = this.nativeViewProtected;
// if (nativeView && global.isAndroid) { // if (nativeView && __ANDROID__) {
// const recycle = this.recycleNativeView; // const recycle = this.recycleNativeView;
// let shouldRecycle = false; // let shouldRecycle = false;
// if (recycle === "always") { // if (recycle === "always") {
@@ -1182,7 +1182,7 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
// shouldRecycle = propertiesSet <= this.recyclePropertyCounter; // shouldRecycle = propertiesSet <= this.recyclePropertyCounter;
// } // }
// // const nativeParent = global.isAndroid ? (<android.view.View>nativeView).getParent() : (<UIView>nativeView).superview; // // const nativeParent = __ANDROID__ ? (<android.view.View>nativeView).getParent() : (<UIView>nativeView).superview;
// const nativeParent = (<android.view.View>nativeView).getParent(); // const nativeParent = (<android.view.View>nativeView).getParent();
// const animation = (<android.view.View>nativeView).getAnimation(); // const animation = (<android.view.View>nativeView).getAnimation();
// if (shouldRecycle && !nativeParent && !animation) { // if (shouldRecycle && !nativeParent && !animation) {
@@ -1433,7 +1433,7 @@ bindingContextProperty.register(ViewBase);
export const hiddenProperty = new Property<ViewBase, boolean>({ export const hiddenProperty = new Property<ViewBase, boolean>({
name: 'hidden', name: 'hidden',
defaultValue: false, defaultValue: false,
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: booleanConverter, valueConverter: booleanConverter,
valueChanged: (target, oldValue, newValue) => { valueChanged: (target, oldValue, newValue) => {
if (target) { if (target) {

View File

@@ -271,7 +271,7 @@ export function getButtonColors(): { color: Color; backgroundColor: Color } {
if (!button) { if (!button) {
const Button = require('../button').Button; const Button = require('../button').Button;
button = new Button(); button = new Button();
if (global.isIOS) { if (__IOS__) {
button._setupUI(<any>{}); button._setupUI(<any>{});
} }
} }
@@ -290,7 +290,7 @@ export function getLabelColor(): Color {
if (!label) { if (!label) {
const Label = require('../label').Label; const Label = require('../label').Label;
label = new Label(); label = new Label();
if (global.isIOS) { if (__IOS__) {
label._setupUI(<any>{}); label._setupUI(<any>{});
} }
} }
@@ -307,7 +307,7 @@ export function getTextFieldColor(): Color {
if (!textField) { if (!textField) {
const TextField = require('../text-field').TextField; const TextField = require('../text-field').TextField;
textField = new TextField(); textField = new TextField();
if (global.isIOS) { if (__IOS__) {
textField._setupUI(<any>{}); textField._setupUI(<any>{});
} }
} }

View File

@@ -557,11 +557,11 @@ export class FrameBase extends CustomLayoutView {
public _getNavigationTransition(entry: NavigationEntry): NavigationTransition { public _getNavigationTransition(entry: NavigationEntry): NavigationTransition {
if (entry) { if (entry) {
if (global.isIOS && entry.transitioniOS !== undefined) { if (__IOS__ && entry.transitioniOS !== undefined) {
return entry.transitioniOS; return entry.transitioniOS;
} }
if (global.isAndroid && entry.transitionAndroid !== undefined) { if (__ANDROID__ && entry.transitionAndroid !== undefined) {
return entry.transitionAndroid; return entry.transitionAndroid;
} }
@@ -768,5 +768,5 @@ export const defaultPage = new Property<FrameBase, string>({
}); });
defaultPage.register(FrameBase); defaultPage.register(FrameBase);
export const actionBarVisibilityProperty = new Property<FrameBase, 'auto' | 'never' | 'always'>({ name: 'actionBarVisibility', defaultValue: 'auto', affectsLayout: global.isIOS }); export const actionBarVisibilityProperty = new Property<FrameBase, 'auto' | 'never' | 'always'>({ name: 'actionBarVisibility', defaultValue: 'auto', affectsLayout: __IOS__ });
actionBarVisibilityProperty.register(FrameBase); actionBarVisibilityProperty.register(FrameBase);

View File

@@ -65,7 +65,7 @@ export class TouchManager {
const handleDown = (view?.touchAnimation && (<TouchAnimationOptions>view?.touchAnimation).down) || (TouchManager.animations && TouchManager.animations.down); const handleDown = (view?.touchAnimation && (<TouchAnimationOptions>view?.touchAnimation).down) || (TouchManager.animations && TouchManager.animations.down);
const handleUp = (view?.touchAnimation && (<TouchAnimationOptions>view?.touchAnimation).up) || (TouchManager.animations && TouchManager.animations.up); const handleUp = (view?.touchAnimation && (<TouchAnimationOptions>view?.touchAnimation).up) || (TouchManager.animations && TouchManager.animations.up);
if (global.isIOS) { if (__IOS__) {
if (view?.ios?.addTargetActionForControlEvents) { if (view?.ios?.addTargetActionForControlEvents) {
// can use UIControlEvents // can use UIControlEvents
if (!TouchManager.touchHandlers) { if (!TouchManager.touchHandlers) {
@@ -215,7 +215,7 @@ export let TouchControlHandler: {
ensureTouchControlHandlers(); ensureTouchControlHandlers();
function ensureTouchControlHandlers() { function ensureTouchControlHandlers() {
if (global.isIOS) { if (__IOS__) {
@NativeClass @NativeClass
class TouchHandlerImpl extends NSObject { class TouchHandlerImpl extends NSObject {
private _owner: WeakRef<View>; private _owner: WeakRef<View>;

View File

@@ -153,7 +153,7 @@ isLoadingProperty.register(ImageBase);
export const stretchProperty = new Property<ImageBase, CoreTypes.ImageStretchType>({ export const stretchProperty = new Property<ImageBase, CoreTypes.ImageStretchType>({
name: 'stretch', name: 'stretch',
defaultValue: 'aspectFit', defaultValue: 'aspectFit',
affectsLayout: global.isIOS, affectsLayout: __IOS__,
}); });
stretchProperty.register(ImageBase); stretchProperty.register(ImageBase);

View File

@@ -53,7 +53,7 @@ dockProperty.register(View);
export const stretchLastChildProperty = new Property<DockLayoutBase, boolean>({ export const stretchLastChildProperty = new Property<DockLayoutBase, boolean>({
name: 'stretchLastChild', name: 'stretchLastChild',
defaultValue: true, defaultValue: true,
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: booleanConverter, valueConverter: booleanConverter,
}); });
stretchLastChildProperty.register(DockLayoutBase); stretchLastChildProperty.register(DockLayoutBase);

View File

@@ -222,7 +222,7 @@ export const flexDirectionProperty = new CssProperty<Style, FlexDirection>({
name: 'flexDirection', name: 'flexDirection',
cssName: 'flex-direction', cssName: 'flex-direction',
defaultValue: FlexDirection.ROW, defaultValue: FlexDirection.ROW,
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: FlexDirection.parse, valueConverter: FlexDirection.parse,
}); });
flexDirectionProperty.register(Style); flexDirectionProperty.register(Style);
@@ -231,7 +231,7 @@ export const flexWrapProperty = new CssProperty<Style, FlexWrap>({
name: 'flexWrap', name: 'flexWrap',
cssName: 'flex-wrap', cssName: 'flex-wrap',
defaultValue: 'nowrap', defaultValue: 'nowrap',
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: FlexWrap.parse, valueConverter: FlexWrap.parse,
}); });
flexWrapProperty.register(Style); flexWrapProperty.register(Style);
@@ -240,7 +240,7 @@ export const justifyContentProperty = new CssProperty<Style, JustifyContent>({
name: 'justifyContent', name: 'justifyContent',
cssName: 'justify-content', cssName: 'justify-content',
defaultValue: JustifyContent.FLEX_START, defaultValue: JustifyContent.FLEX_START,
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: JustifyContent.parse, valueConverter: JustifyContent.parse,
}); });
justifyContentProperty.register(Style); justifyContentProperty.register(Style);
@@ -249,7 +249,7 @@ export const alignItemsProperty = new CssProperty<Style, AlignItems>({
name: 'alignItems', name: 'alignItems',
cssName: 'align-items', cssName: 'align-items',
defaultValue: AlignItems.STRETCH, defaultValue: AlignItems.STRETCH,
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: AlignItems.parse, valueConverter: AlignItems.parse,
}); });
alignItemsProperty.register(Style); alignItemsProperty.register(Style);
@@ -258,7 +258,7 @@ export const alignContentProperty = new CssProperty<Style, AlignContent>({
name: 'alignContent', name: 'alignContent',
cssName: 'align-content', cssName: 'align-content',
defaultValue: AlignContent.STRETCH, defaultValue: AlignContent.STRETCH,
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: AlignContent.parse, valueConverter: AlignContent.parse,
}); });
alignContentProperty.register(Style); alignContentProperty.register(Style);

View File

@@ -16,7 +16,7 @@ const converter = makeParser<CoreTypes.OrientationType>(makeValidator('horizonta
export const orientationProperty = new Property<StackLayoutBase, CoreTypes.OrientationType>({ export const orientationProperty = new Property<StackLayoutBase, CoreTypes.OrientationType>({
name: 'orientation', name: 'orientation',
defaultValue: 'vertical', defaultValue: 'vertical',
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: converter, valueConverter: converter,
}); });
orientationProperty.register(StackLayoutBase); orientationProperty.register(StackLayoutBase);

View File

@@ -21,7 +21,7 @@ WrapLayoutBase.prototype.recycleNativeView = 'auto';
export const itemWidthProperty = new Property<WrapLayoutBase, CoreTypes.LengthType>({ export const itemWidthProperty = new Property<WrapLayoutBase, CoreTypes.LengthType>({
name: 'itemWidth', name: 'itemWidth',
defaultValue: 'auto', defaultValue: 'auto',
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: (v) => Length.parse(v), valueConverter: (v) => Length.parse(v),
valueChanged: (target, oldValue, newValue) => (target.effectiveItemWidth = Length.toDevicePixels(newValue, -1)), valueChanged: (target, oldValue, newValue) => (target.effectiveItemWidth = Length.toDevicePixels(newValue, -1)),
}); });
@@ -30,7 +30,7 @@ itemWidthProperty.register(WrapLayoutBase);
export const itemHeightProperty = new Property<WrapLayoutBase, CoreTypes.LengthType>({ export const itemHeightProperty = new Property<WrapLayoutBase, CoreTypes.LengthType>({
name: 'itemHeight', name: 'itemHeight',
defaultValue: 'auto', defaultValue: 'auto',
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: (v) => Length.parse(v), valueConverter: (v) => Length.parse(v),
valueChanged: (target, oldValue, newValue) => (target.effectiveItemHeight = Length.toDevicePixels(newValue, -1)), valueChanged: (target, oldValue, newValue) => (target.effectiveItemHeight = Length.toDevicePixels(newValue, -1)),
}); });
@@ -40,7 +40,7 @@ const converter = makeParser<CoreTypes.OrientationType>(makeValidator<CoreTypes.
export const orientationProperty = new Property<WrapLayoutBase, CoreTypes.OrientationType>({ export const orientationProperty = new Property<WrapLayoutBase, CoreTypes.OrientationType>({
name: 'orientation', name: 'orientation',
defaultValue: CoreTypes.Orientation.horizontal, defaultValue: CoreTypes.Orientation.horizontal,
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: converter, valueConverter: converter,
}); });
orientationProperty.register(WrapLayoutBase); orientationProperty.register(WrapLayoutBase);

View File

@@ -185,7 +185,7 @@ export interface PageBase {
*/ */
export const actionBarHiddenProperty = new Property<PageBase, boolean>({ export const actionBarHiddenProperty = new Property<PageBase, boolean>({
name: 'actionBarHidden', name: 'actionBarHidden',
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: booleanConverter, valueConverter: booleanConverter,
}); });
actionBarHiddenProperty.register(PageBase); actionBarHiddenProperty.register(PageBase);
@@ -196,7 +196,7 @@ actionBarHiddenProperty.register(PageBase);
export const backgroundSpanUnderStatusBarProperty = new Property<PageBase, boolean>({ export const backgroundSpanUnderStatusBarProperty = new Property<PageBase, boolean>({
name: 'backgroundSpanUnderStatusBar', name: 'backgroundSpanUnderStatusBar',
defaultValue: false, defaultValue: false,
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: booleanConverter, valueConverter: booleanConverter,
}); });
backgroundSpanUnderStatusBarProperty.register(PageBase); backgroundSpanUnderStatusBarProperty.register(PageBase);

View File

@@ -20,7 +20,7 @@ SearchBarBase.prototype.recycleNativeView = 'auto';
export const textProperty = new Property<SearchBarBase, string>({ export const textProperty = new Property<SearchBarBase, string>({
name: 'text', name: 'text',
defaultValue: '', defaultValue: '',
affectsLayout: global.isIOS, affectsLayout: __IOS__,
}); });
textProperty.register(SearchBarBase); textProperty.register(SearchBarBase);

View File

@@ -39,7 +39,7 @@ export const valueProperty = new CoercibleProperty<SliderBase, number>({
return value; return value;
}, },
valueConverter: (v) => (global.isIOS ? parseFloat(v) : parseInt(v)), valueConverter: (v) => (__IOS__ ? parseFloat(v) : parseInt(v)),
}); });
valueProperty.register(SliderBase); valueProperty.register(SliderBase);
@@ -53,7 +53,7 @@ export const minValueProperty = new Property<SliderBase, number>({
maxValueProperty.coerce(target); maxValueProperty.coerce(target);
valueProperty.coerce(target); valueProperty.coerce(target);
}, },
valueConverter: (v) => (global.isIOS ? parseFloat(v) : parseInt(v)), valueConverter: (v) => (__IOS__ ? parseFloat(v) : parseInt(v)),
}); });
minValueProperty.register(SliderBase); minValueProperty.register(SliderBase);
@@ -72,6 +72,6 @@ export const maxValueProperty = new CoercibleProperty<SliderBase, number>({
return value; return value;
}, },
valueChanged: (target, oldValue, newValue) => valueProperty.coerce(target), valueChanged: (target, oldValue, newValue) => valueProperty.coerce(target),
valueConverter: (v) => (global.isIOS ? parseFloat(v) : parseInt(v)), valueConverter: (v) => (__IOS__ ? parseFloat(v) : parseInt(v)),
}); });
maxValueProperty.register(SliderBase); maxValueProperty.register(SliderBase);

View File

@@ -216,7 +216,7 @@ export function traceMissingIcon(icon: string) {
export const selectedIndexProperty = new CoercibleProperty<TabViewBase, number>({ export const selectedIndexProperty = new CoercibleProperty<TabViewBase, number>({
name: 'selectedIndex', name: 'selectedIndex',
defaultValue: -1, defaultValue: -1,
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueChanged: (target, oldValue, newValue) => { valueChanged: (target, oldValue, newValue) => {
target.onSelectedIndexChanged(oldValue, newValue); target.onSelectedIndexChanged(oldValue, newValue);
}, },
@@ -257,7 +257,7 @@ androidIconRenderingModeProperty.register(TabViewBase);
export const androidOffscreenTabLimitProperty = new Property<TabViewBase, number>({ export const androidOffscreenTabLimitProperty = new Property<TabViewBase, number>({
name: 'androidOffscreenTabLimit', name: 'androidOffscreenTabLimit',
defaultValue: 1, defaultValue: 1,
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: (v) => parseInt(v), valueConverter: (v) => parseInt(v),
}); });
androidOffscreenTabLimitProperty.register(TabViewBase); androidOffscreenTabLimitProperty.register(TabViewBase);

View File

@@ -225,7 +225,7 @@ export function isBold(fontWeight: FontWeightType): boolean {
export const textProperty = new Property<TextBaseCommon, string>({ export const textProperty = new Property<TextBaseCommon, string>({
name: 'text', name: 'text',
defaultValue: '', defaultValue: '',
affectsLayout: global.isAndroid, affectsLayout: __ANDROID__,
}); });
textProperty.register(TextBaseCommon); textProperty.register(TextBaseCommon);
@@ -286,7 +286,7 @@ textTransformProperty.register(Style);
export const textShadowProperty = new CssProperty<Style, string | ShadowCSSValues>({ export const textShadowProperty = new CssProperty<Style, string | ShadowCSSValues>({
name: 'textShadow', name: 'textShadow',
cssName: 'text-shadow', cssName: 'text-shadow',
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: (value) => { valueConverter: (value) => {
return parseCSSShadow(value); return parseCSSShadow(value);
}, },
@@ -296,7 +296,7 @@ textShadowProperty.register(Style);
export const textStrokeProperty = new CssProperty<Style, string | StrokeCSSValues>({ export const textStrokeProperty = new CssProperty<Style, string | StrokeCSSValues>({
name: 'textStroke', name: 'textStroke',
cssName: 'text-stroke', cssName: 'text-stroke',
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: (value) => { valueConverter: (value) => {
return parseCSSStroke(value); return parseCSSStroke(value);
}, },
@@ -308,7 +308,7 @@ export const whiteSpaceProperty = new CssProperty<Style, CoreTypes.WhiteSpaceTyp
name: 'whiteSpace', name: 'whiteSpace',
cssName: 'white-space', cssName: 'white-space',
defaultValue: 'initial', defaultValue: 'initial',
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: whiteSpaceConverter, valueConverter: whiteSpaceConverter,
}); });
whiteSpaceProperty.register(Style); whiteSpaceProperty.register(Style);
@@ -318,7 +318,7 @@ export const textOverflowProperty = new CssProperty<Style, CoreTypes.TextOverflo
name: 'textOverflow', name: 'textOverflow',
cssName: 'text-overflow', cssName: 'text-overflow',
defaultValue: 'initial', defaultValue: 'initial',
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: textOverflowConverter, valueConverter: textOverflowConverter,
}); });
textOverflowProperty.register(Style); textOverflowProperty.register(Style);
@@ -336,7 +336,7 @@ export const letterSpacingProperty = new InheritedCssProperty<Style, number>({
name: 'letterSpacing', name: 'letterSpacing',
cssName: 'letter-spacing', cssName: 'letter-spacing',
defaultValue: 0, defaultValue: 0,
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: (v) => parseFloat(v), valueConverter: (v) => parseFloat(v),
}); });
letterSpacingProperty.register(Style); letterSpacingProperty.register(Style);
@@ -344,7 +344,7 @@ letterSpacingProperty.register(Style);
export const lineHeightProperty = new InheritedCssProperty<Style, number>({ export const lineHeightProperty = new InheritedCssProperty<Style, number>({
name: 'lineHeight', name: 'lineHeight',
cssName: 'line-height', cssName: 'line-height',
affectsLayout: global.isIOS, affectsLayout: __IOS__,
valueConverter: (v) => parseFloat(v), valueConverter: (v) => parseFloat(v),
}); });
lineHeightProperty.register(Style); lineHeightProperty.register(Style);

View File

@@ -177,7 +177,7 @@ export class SharedTransition {
if (isNumber(pageEnd?.duration)) { if (isNumber(pageEnd?.duration)) {
// Android uses milliseconds/iOS uses seconds // Android uses milliseconds/iOS uses seconds
// users pass in milliseconds // users pass in milliseconds
transition.setDuration(global.isIOS ? pageEnd?.duration / 1000 : pageEnd?.duration); transition.setDuration(__IOS__ ? pageEnd?.duration / 1000 : pageEnd?.duration);
} }
return { instance: transition }; return { instance: transition };
} }
@@ -365,9 +365,9 @@ export function getPageStartDefaultsForType(type: TransitionNavigationType) {
} }
function getPlatformWidth() { function getPlatformWidth() {
return global.isAndroid ? Screen.mainScreen.widthPixels : Screen.mainScreen.widthDIPs; return __ANDROID__ ? Screen.mainScreen.widthPixels : Screen.mainScreen.widthDIPs;
} }
function getPlatformHeight() { function getPlatformHeight() {
return global.isAndroid ? Screen.mainScreen.heightPixels : Screen.mainScreen.heightDIPs; return __ANDROID__ ? Screen.mainScreen.heightPixels : Screen.mainScreen.heightDIPs;
} }

View File

@@ -61,7 +61,7 @@ export class ScopeError extends Error {
formattedMessage = message || inner.message || undefined; formattedMessage = message || inner.message || undefined;
} }
super(formattedMessage); super(formattedMessage);
this.stack = global.isAndroid ? 'Error: ' + this.message + '\n' + inner.stack.substr(inner.stack.indexOf('\n') + 1) : inner.stack; this.stack = __ANDROID__ ? 'Error: ' + this.message + '\n' + inner.stack.substr(inner.stack.indexOf('\n') + 1) : inner.stack;
this.message = formattedMessage; this.message = formattedMessage;
} }
} }

View File

@@ -8,7 +8,7 @@ export function platformCheck(parent?: string) {
{ {
get(_, prop) { get(_, prop) {
const propPretty = [parent, prop.toString()].join('.'); const propPretty = [parent, prop.toString()].join('.');
const hintPlatformCheck = global.isAndroid ? 'global.isIOS' : 'global.isAndroid'; const hintPlatformCheck = __ANDROID__ ? '__IOS__' : '__ANDROID__';
// prettier-ignore // prettier-ignore
const errorMsg = [ const errorMsg = [