this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

new platform util (#5791)

authored by

Samuel Newman and committed by
GitHub
c5e40d66 be725f79

+38 -1
+38 -1
src/alf/util/platform.ts
··· 1 - import {isAndroid, isIOS, isNative, isWeb} from 'platform/detection' 1 + import {Platform} from 'react-native' 2 + 3 + import {isAndroid, isIOS, isNative, isWeb} from '#/platform/detection' 2 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 + */ 3 12 export function web(value: any) { 4 13 if (isWeb) { 5 14 return value 6 15 } 7 16 } 8 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 + */ 9 25 export function ios(value: any) { 10 26 if (isIOS) { 11 27 return value 12 28 } 13 29 } 14 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 + */ 15 38 export function android(value: any) { 16 39 if (isAndroid) { 17 40 return value 18 41 } 19 42 } 20 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 + */ 21 51 export function native(value: any) { 22 52 if (isNative) { 23 53 return value 24 54 } 25 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 + */ 62 + export const platform = Platform.select