Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
chore(cleanup): Apply prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan-dutoit committed Aug 30, 2019
1 parent 0028ebf commit 134c5b4
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import NativeInterface from './internal/nativeInterface';
import {ImagePickerOptions, ImagePickerResponse} from './internal/types';
import { processColor } from 'react-native';
import {processColor} from 'react-native';

const DEFAULT_OPTIONS: ImagePickerOptions = {
title: 'Select a Photo',
Expand All @@ -25,7 +25,7 @@ const DEFAULT_OPTIONS: ImagePickerOptions = {
reTryTitle: 're-try',
okTitle: "I'm sure",
},
tintColor: 'blue'
tintColor: 'blue',
};

type Callback = (response: ImagePickerResponse) => void;
Expand All @@ -38,14 +38,12 @@ class ImagePicker {
showImagePicker(
optionsOrCallback: OptionsOrCallback,
callback?: Callback,
): void {
): void {
if (typeof optionsOrCallback === 'function') {
return NativeInterface.showImagePicker(
{
...DEFAULT_OPTIONS,
...{
tintColor: processColor(DEFAULT_OPTIONS.tintColor)
}
tintColor: processColor(DEFAULT_OPTIONS.tintColor),
},
optionsOrCallback,
);
Expand All @@ -59,25 +57,32 @@ class ImagePicker {
{
...DEFAULT_OPTIONS,
...optionsOrCallback,
...{
tintColor: processColor(optionsOrCallback.tintColor || DEFAULT_OPTIONS.tintColor)
}
tintColor: processColor(
optionsOrCallback.tintColor || DEFAULT_OPTIONS.tintColor,
),
},
callback,
);
}


launchCamera(options: ImagePickerOptions, callback: Callback): void {
return NativeInterface.launchCamera(
{...DEFAULT_OPTIONS, ...options, ...{ tintColor: processColor(options.tintColor || DEFAULT_OPTIONS.tintColor) }},
{
...DEFAULT_OPTIONS,
...options,
tintColor: processColor(options.tintColor || DEFAULT_OPTIONS.tintColor),
},
callback,
);
}

launchImageLibrary(options: ImagePickerOptions, callback: Callback): void {
return NativeInterface.launchImageLibrary(
{...DEFAULT_OPTIONS, ...options, ...{ tintColor: processColor(options.tintColor || DEFAULT_OPTIONS.tintColor) }},
{
...DEFAULT_OPTIONS,
...options,
tintColor: processColor(options.tintColor || DEFAULT_OPTIONS.tintColor),
},
callback,
);
}
Expand Down

0 comments on commit 134c5b4

Please sign in to comment.