react-native-vision-camera/package/example/src/Constants.ts

32 lines
1.0 KiB
TypeScript
Raw Normal View History

import { Dimensions, Platform } from 'react-native'
import StaticSafeAreaInsets from 'react-native-static-safe-area-insets'
2021-02-19 10:24:32 -07:00
export const CONTENT_SPACING = 15
2021-02-19 10:24:32 -07:00
2021-02-20 09:07:10 -07:00
const SAFE_BOTTOM =
Platform.select({
ios: StaticSafeAreaInsets.safeAreaInsetsBottom,
}) ?? 0
2021-02-19 13:14:42 -07:00
2021-02-19 10:24:32 -07:00
export const SAFE_AREA_PADDING = {
paddingLeft: StaticSafeAreaInsets.safeAreaInsetsLeft + CONTENT_SPACING,
paddingTop: StaticSafeAreaInsets.safeAreaInsetsTop + CONTENT_SPACING,
paddingRight: StaticSafeAreaInsets.safeAreaInsetsRight + CONTENT_SPACING,
2021-02-20 09:07:10 -07:00
paddingBottom: SAFE_BOTTOM + CONTENT_SPACING,
}
2021-02-19 10:43:41 -07:00
// The maximum zoom _factor_ you should be able to zoom in
2023-09-30 05:23:17 -06:00
export const MAX_ZOOM_FACTOR = 10
2021-02-19 10:43:41 -07:00
export const SCREEN_WIDTH = Dimensions.get('window').width
2021-02-19 10:43:41 -07:00
export const SCREEN_HEIGHT = Platform.select<number>({
2021-02-20 09:07:10 -07:00
android: Dimensions.get('screen').height - StaticSafeAreaInsets.safeAreaInsetsBottom,
ios: Dimensions.get('window').height,
}) as number
2021-02-19 11:06:28 -07:00
// Capture Button
export const CAPTURE_BUTTON_SIZE = 78
// Control Button like Flash
export const CONTROL_BUTTON_SIZE = 40