forked from Ivasoft/mattermost-mobile
(cherry picked from commit df26a363bc)
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
@@ -293,7 +293,44 @@ export function showModal(name, title, passProps = {}, options = {}) {
|
||||
|
||||
export function showModalOverCurrentContext(name, passProps = {}, options = {}) {
|
||||
const title = '';
|
||||
const animationsEnabled = (Platform.OS === 'android').toString();
|
||||
|
||||
let animations;
|
||||
switch (Platform.OS) {
|
||||
case 'android':
|
||||
animations = {
|
||||
showModal: {
|
||||
waitForRender: true,
|
||||
alpha: {
|
||||
from: 0,
|
||||
to: 1,
|
||||
duration: 250,
|
||||
},
|
||||
},
|
||||
dismissModal: {
|
||||
alpha: {
|
||||
from: 1,
|
||||
to: 0,
|
||||
duration: 250,
|
||||
},
|
||||
},
|
||||
};
|
||||
break;
|
||||
default:
|
||||
animations = {
|
||||
showModal: {
|
||||
enabled: false,
|
||||
enter: {},
|
||||
exit: {},
|
||||
},
|
||||
dismissModal: {
|
||||
enabled: false,
|
||||
enter: {},
|
||||
exit: {},
|
||||
},
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
const defaultOptions = {
|
||||
modalPresentationStyle: 'overCurrentContext',
|
||||
layout: {
|
||||
@@ -304,25 +341,7 @@ export function showModalOverCurrentContext(name, passProps = {}, options = {})
|
||||
visible: false,
|
||||
height: 0,
|
||||
},
|
||||
animations: {
|
||||
showModal: {
|
||||
waitForRender: true,
|
||||
enabled: animationsEnabled,
|
||||
alpha: {
|
||||
from: 0,
|
||||
to: 1,
|
||||
duration: 250,
|
||||
},
|
||||
},
|
||||
dismissModal: {
|
||||
enabled: animationsEnabled,
|
||||
alpha: {
|
||||
from: 1,
|
||||
to: 0,
|
||||
duration: 250,
|
||||
},
|
||||
},
|
||||
},
|
||||
animations,
|
||||
};
|
||||
const mergeOptions = merge(defaultOptions, options);
|
||||
|
||||
|
||||
@@ -301,7 +301,6 @@ describe('@actions/navigation', () => {
|
||||
test('showModalOverCurrentContext should call Navigation.showModal', () => {
|
||||
const showModal = jest.spyOn(Navigation, 'showModal');
|
||||
|
||||
const animationsEnabled = (Platform.OS === 'android').toString();
|
||||
const showModalOverCurrentContextTitle = '';
|
||||
const showModalOverCurrentContextOptions = {
|
||||
modalPresentationStyle: 'overCurrentContext',
|
||||
@@ -315,21 +314,14 @@ describe('@actions/navigation', () => {
|
||||
},
|
||||
animations: {
|
||||
showModal: {
|
||||
waitForRender: true,
|
||||
enabled: animationsEnabled,
|
||||
alpha: {
|
||||
from: 0,
|
||||
to: 1,
|
||||
duration: 250,
|
||||
},
|
||||
enabled: false,
|
||||
enter: {},
|
||||
exit: {},
|
||||
},
|
||||
dismissModal: {
|
||||
enabled: animationsEnabled,
|
||||
alpha: {
|
||||
from: 1,
|
||||
to: 0,
|
||||
duration: 250,
|
||||
},
|
||||
enabled: false,
|
||||
enter: {},
|
||||
exit: {},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user