Bluesky's "Application Layout Framework"
1import {type Platform} from 'react-native'
2
3export const isIOS = false
4export const isAndroid = false
5export const isNative = false
6export const isWeb = true
7// @ts-ignore
8export const isFabric = Boolean(global?.nativeFabricUIManager)
9
10/**
11 * Identity function on web. Returns nothing on other platforms.
12 *
13 * Note: Platform splitting does not tree-shake away the other platforms,
14 * so don't do stuff like e.g. rely on platform-specific imports. Use
15 * platform-split files instead.
16 */
17export const web = (value: any) => (isWeb ? value : undefined)
18
19/**
20 * Identity function on iOS. Returns nothing on other platforms.
21 *
22 * Note: Platform splitting does not tree-shake away the other platforms,
23 * so don't do stuff like e.g. rely on platform-specific imports. Use
24 * platform-split files instead.
25 */
26export const ios = (value: any) => (isIOS ? value : undefined)
27
28/**
29 * Identity function on Android. Returns nothing on other platforms..
30 *
31 * Note: Platform splitting does not tree-shake away the other platforms,
32 * so don't do stuff like e.g. rely on platform-specific imports. Use
33 * platform-split files instead.
34 */
35export const android = (value: any) => (isAndroid ? value : undefined)
36
37/**
38 * Identity function on iOS and Android. Returns nothing on web.
39 *
40 * Note: Platform splitting does not tree-shake away the other platforms,
41 * so don't do stuff like e.g. rely on platform-specific imports. Use
42 * platform-split files instead.
43 */
44export const native = (value: any) => (isNative ? value : undefined)
45
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 const platform = (specifics => {
52 // @ts-ignore
53 return specifics.web || specifics.default
54}) as Platform['select']