-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🛠 Refactor: Extract to
ModalViewModule
Related To: * TODO:2023-03-04-05-20-26 - Library Native Cleanup Summary: Extract `ModalViewModule` class from `RNIModalViewModule` to `src/module/ModalViewModule.ts`.
- Loading branch information
1 parent
a7dab6f
commit ae5869e
Showing
3 changed files
with
40 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { RNIModalViewModule } from 'src/native_modules/RNIModalViewModule'; | ||
import * as Helpers from '../functions/helpers'; | ||
|
||
export class ModalViewModule { | ||
static dismissModalByID(modalID = ''){ | ||
const promise = new Promise((resolve, reject) => { | ||
try { | ||
RNIModalViewModule.dismissModalByID(modalID, success => { | ||
(success? resolve : reject)(); | ||
}); | ||
|
||
} catch(error){ | ||
console.log("RNIModalViewModule, dismissModalByID error:"); | ||
console.log(error); | ||
reject(error); | ||
}; | ||
}); | ||
|
||
return Helpers.promiseWithTimeout(1000, promise); | ||
}; | ||
|
||
static dismissAllModals(animated = true){ | ||
const promise = new Promise((resolve, reject) => { | ||
try { | ||
RNIModalViewModule.dismissAllModals(animated, success => { | ||
(success? resolve : reject)(); | ||
}); | ||
|
||
} catch(error){ | ||
console.log("RNIModalViewModule, dismissAllModals error:"); | ||
console.log(error); | ||
reject(); | ||
}; | ||
}); | ||
|
||
return Helpers.promiseWithTimeout(1000, promise); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters