diff --git a/types/expo/expo-tests.tsx b/types/expo/expo-tests.tsx index 564611bb60..fa329ea8e3 100644 --- a/types/expo/expo-tests.tsx +++ b/types/expo/expo-tests.tsx @@ -223,8 +223,8 @@ Audio.RECORDING_OPTIONS_PRESET_HIGH_QUALITY; Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY; async () => { const result = await Audio.Sound.create({uri: 'uri'}, { - volume: 0.5, - rate: 0.6 + volume: 0.55, + rate: 16.5 }, null, true); const sound = result.sound; @@ -267,8 +267,8 @@ const barcodeReadCallback = () => {}; ); async () => { - await Brightness.setBrightnessAsync(.6); - await Brightness.setSystemBrightnessAsync(.7); + await Brightness.setBrightnessAsync(0.65); + await Brightness.setSystemBrightnessAsync(0.75); const br1 = await Brightness.getBrightnessAsync(); const br2 = await Brightness.getSystemBrightnessAsync(); }; @@ -376,7 +376,7 @@ async () => { const result = await ImageManipulator.manipulate('url', { rotate: 90 }, { - compress: 0.5 + compress: 0.75 }); result.height; diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index 641c3f1ded..dd7057b007 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -27,7 +27,6 @@ import { export type Axis = number; export type BarCodeReadCallback = (params: { type: string; data: string; }) => void; -export type FloatFromZeroToOne = 0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1; export type Md5 = string; export type Orientation = 'portrait' | 'landscape'; export type RequireSource = ImageRequireSource; @@ -550,14 +549,16 @@ export type PlaybackStatus = { export interface PlaybackStatusToSet { androidImplementation?: string; - progressUpdateIntervalMillis?: number; - positionMillis?: number; - shouldPlay?: boolean; - rate?: FloatFromZeroToOne; - shouldCorrectPitch?: boolean; - volume?: FloatFromZeroToOne; - isMuted?: boolean; isLooping?: boolean; + isMuted?: boolean; + positionMillis?: number; + progressUpdateIntervalMillis?: number; + /** The desired playback rate of the media. This value must be between `0.0` and `32.0`. Only available on Android API version 23 and later and iOS. */ + rate?: number; + shouldCorrectPitch?: boolean; + shouldPlay?: boolean; + /** A number between `0.0` (silence) and `1.0` (maximum volume). */ + volume?: number; } export type PlaybackSource = RequireSource | { uri: string } | Asset; @@ -670,7 +671,6 @@ export class PlaybackObject { setRateAsync( /** The desired playback rate of the media. This value must be between `0.0` and `32.0`. Only available on Android API version 23 and later and iOS. */ rate: number, - /** A boolean describing if we should correct the pitch for a changed rate. If set to `true`, the pitch of the audio will be corrected (so a rate different than `1.0` will timestretch the audio). */ shouldCorrectPitch: boolean ): Promise; @@ -732,13 +732,32 @@ export class BlurView extends Component { } // #endregion /** - * Brightness + * An API to get and set screen brightness. */ export namespace Brightness { - function setBrightnessAsync(brightnessValue: FloatFromZeroToOne): Promise; - function getBrightnessAsync(): Promise; - function getSystemBrightnessAsync(): Promise; - function setSystemBrightnessAsync(brightnessValue: FloatFromZeroToOne): Promise; + /** Sets screen brightness. */ + function setBrightnessAsync( + /** A number between `0` and `1`, representing the desired screen brightness. */ + brightnessValue: number + ): Promise; + + /** + * Gets screen brightness. + * @returns A Promise that is resolved with a number between `0` and `1`, representing the current screen brightness. + */ + function getBrightnessAsync(): Promise; + + /** + * Gets global system screen brightness. + * @returns A Promise that is resolved with a number between `0` and `1`, representing the current system screen brightness. + */ + function getSystemBrightnessAsync(): Promise; + + /** Sets global system screen brightness, requires `WRITE_SETTINGS` permissions on Android. */ + function setSystemBrightnessAsync( + /** A number between `0` and `1`, representing the desired screen brightness. */ + brightnessValue: number + ): Promise; } // #region Camera @@ -771,22 +790,24 @@ export class CameraObject { } export interface CameraProps extends ViewProps { - zoom?: FloatFromZeroToOne; - ratio?: string; - focusDepth?: FloatFromZeroToOne; - type?: string | number; - onCameraReady?: () => void; - onBarCodeRead?: BarCodeReadCallback; + autoFocus?: string | number | boolean; + barCodeTypes?: Array; + faceDetectionClassifications?: number; + faceDetectionLandmarks?: number; faceDetectionMode?: number; flashMode?: string | number; - barCodeTypes?: Array; - whiteBalance?: string | number; - faceDetectionLandmarks?: number; - autoFocus?: string | number | boolean; - faceDetectionClassifications?: number; - onMountError?: () => void; + /** Distance to plane of sharpest focus. A value between `0` and `1`. `0`: infinity focus, `1`: focus as close as possible. Default: `0`. For Android this is available only for some devices and when `useCamera2Api` is set to `true`. */ + focusDepth?: number; + onBarCodeRead?: BarCodeReadCallback; + onCameraReady?: () => void; onFacesDetected?: (options: { faces: TrackedFaceFeature[] }) => void; + onMountError?: () => void; + ratio?: string; ref?: Ref; + type?: string | number; + whiteBalance?: string | number; + /** A value between `0` and `1` being a percentage of device's max zoom. `0`: not zoomed, `1`: maximum zoom. Default: `0`. */ + zoom?: number; } export interface CameraConstants { @@ -1501,7 +1522,8 @@ export namespace ImageManipulator { interface SaveOptions { base64?: boolean; - compress?: FloatFromZeroToOne; + /** A value in range `0` - `1` specifying compression level of the result image. `1` means no compression and `0` the highest compression. */ + compress?: number; format?: 'jpeg' | 'png'; }