Skip to content

Commit

Permalink
💄 Gloss: Fix Lint/Prettier Warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed Jan 6, 2023
1 parent dd919a1 commit 7f4a9c1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
32 changes: 17 additions & 15 deletions src/module/ModalViewModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,39 @@ import { RNIModalViewModule } from 'src/native_modules/RNIModalViewModule';
import * as Helpers from '../functions/helpers';

export class ModalViewModule {
static dismissModalByID(modalID = ''){
static dismissModalByID(modalID = '') {
const promise = new Promise((resolve, reject) => {
try {
RNIModalViewModule.dismissModalByID(modalID, success => {
(success? resolve : reject)();
RNIModalViewModule.dismissModalByID(modalID, (success) => {
(success ? resolve : reject)();
});

} catch(error){
console.log("RNIModalViewModule, dismissModalByID error:");
// prettier-ignore
} catch (error) {
console.log('RNIModalViewModule, dismissModalByID error:');
console.log(error);
reject(error);
};
}
});

return Helpers.promiseWithTimeout(1000, promise);
};
}

static dismissAllModals(animated = true){
static dismissAllModals(animated = true) {
const promise = new Promise((resolve, reject) => {
try {
RNIModalViewModule.dismissAllModals(animated, success => {
(success? resolve : reject)();
RNIModalViewModule.dismissAllModals(animated, (success) => {
(success ? resolve : reject)();
});

} catch(error){
console.log("RNIModalViewModule, dismissAllModals error:");
// prettier-ignore
} catch (error) {
console.log('RNIModalViewModule, dismissAllModals error:');
console.log(error);
reject();
};
}
});

return Helpers.promiseWithTimeout(1000, promise);
};
};
}
}
4 changes: 3 additions & 1 deletion src/native_components/RNIModalView/RNIModalViewTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ export type RNIModalViewProps = ViewProps & {
onModalAttemptDismiss: OnModalAttemptDismissEvent;
};

// prettier-ignore
export type RNIModalViewCommandMap = ViewManagerCommandMap<
'requestModalInfo' | 'requestModalPresentation'
| 'requestModalInfo'
| 'requestModalPresentation'
>;

export type RNIModalViewConstantMap = ViewManagerConstantMap<{
Expand Down
9 changes: 6 additions & 3 deletions src/native_modules/RNIModalViewModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { NativeModules, NativeEventEmitter } from 'react-native';
const MODULE_NAME = 'RNIModalViewModule';

interface RNIModalViewModule {
dismissModalByID( //
// prettier-ignore
dismissModalByID(
modalID: string,
callback: (success: boolean) => void
): void;

dismissAllModals( //
// prettier-ignore
dismissAllModals(
animated: boolean,
callback: (success: boolean) => void
): void;
Expand All @@ -17,5 +19,6 @@ interface RNIModalViewModule {
export const RNIModalViewModule: RNIModalViewModule =
NativeModules[MODULE_NAME];

export const RNIModalViewFocusEvents = //
// prettier-ignore
export const RNIModalViewFocusEvents =
new NativeEventEmitter(RNIModalViewModule as any);

0 comments on commit 7f4a9c1

Please sign in to comment.