An ATproto social media client -- with an independent Appview.
at main 62 lines 1.7 kB view raw
1import {Platform} from 'react-native' 2 3import {isAndroid, isIOS, isNative, isWeb} from '#/platform/detection' 4 5/** 6 * Identity function on web. Returns nothing on other platforms. 7 * 8 * Note: Platform splitting does not tree-shake away the other platforms, 9 * so don't do stuff like e.g. rely on platform-specific imports. Use 10 * platform-split files instead. 11 */ 12export function web(value: any) { 13 if (isWeb) { 14 return value 15 } 16} 17 18/** 19 * Identity function on iOS. Returns nothing on other platforms. 20 * 21 * Note: Platform splitting does not tree-shake away the other platforms, 22 * so don't do stuff like e.g. rely on platform-specific imports. Use 23 * platform-split files instead. 24 */ 25export function ios(value: any) { 26 if (isIOS) { 27 return value 28 } 29} 30 31/** 32 * Identity function on Android. Returns nothing on other platforms.. 33 * 34 * Note: Platform splitting does not tree-shake away the other platforms, 35 * so don't do stuff like e.g. rely on platform-specific imports. Use 36 * platform-split files instead. 37 */ 38export function android(value: any) { 39 if (isAndroid) { 40 return value 41 } 42} 43 44/** 45 * Identity function on iOS and Android. Returns nothing on web. 46 * 47 * Note: Platform splitting does not tree-shake away the other platforms, 48 * so don't do stuff like e.g. rely on platform-specific imports. Use 49 * platform-split files instead. 50 */ 51export function native(value: any) { 52 if (isNative) { 53 return value 54 } 55} 56 57/** 58 * Note: Platform splitting does not tree-shake away the other platforms, 59 * so don't do stuff like e.g. rely on platform-specific imports. Use 60 * platform-split files instead. 61 */ 62export const platform = Platform.select