Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
RocketChat
Rocket.Chat.ReactNative
Commits
777cb28a
Unverified
Commit
777cb28a
authored
Feb 17, 2020
by
Djorkaeff Alexandre
Committed by
GitHub
Feb 17, 2020
Browse files
[FIX] UIKit Modal: Weird behavior on Android Tablet (#1742)
parent
85dfe1b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/index.js
View file @
777cb28a
import
React
from
'
react
'
;
import
{
View
,
Linking
,
BackHandler
}
from
'
react-native
'
;
import
{
View
,
Linking
,
BackHandler
,
ScrollView
}
from
'
react-native
'
;
import
{
createAppContainer
,
createSwitchNavigator
}
from
'
react-navigation
'
;
import
{
createStackNavigator
}
from
'
react-navigation-stack
'
;
import
{
createDrawerNavigator
}
from
'
react-navigation-drawer
'
;
...
...
@@ -34,7 +36,7 @@ import { ThemeContext } from './theme';
import
RocketChat
,
{
THEME_PREFERENCES_KEY
}
from
'
./lib/rocketchat
'
;
import
{
MIN_WIDTH_SPLIT_LAYOUT
}
from
'
./constants/tablet
'
;
import
{
isTablet
,
isSplited
,
isIOS
,
setWidth
,
supportSystemTheme
isTablet
,
isSplited
,
isIOS
,
setWidth
,
supportSystemTheme
,
isAndroid
}
from
'
./utils/deviceInfo
'
;
import
{
KEY_COMMAND
}
from
'
./commands
'
;
import
Tablet
,
{
initTabletNav
}
from
'
./tablet
'
;
...
...
@@ -479,6 +481,24 @@ class CustomModalStack extends React.Component {
const
pageSheetViews
=
[
'
AttachmentView
'
];
const
pageSheet
=
pageSheetViews
.
includes
(
getActiveRouteName
(
navigation
.
state
));
const
androidProps
=
isAndroid
&&
{
style
:
{
marginBottom
:
0
}
};
let
content
=
(
<
View
style
=
{[
sharedStyles
.
modal
,
pageSheet
?
sharedStyles
.
modalPageSheet
:
sharedStyles
.
modalFormSheet
]}
>
<
ModalSwitch
navigation
=
{
navigation
}
screenProps
=
{{
...
screenProps
,
closeModal
:
this
.
closeModal
}}
/
>
<
/View
>
);
if
(
isAndroid
)
{
content
=
(
<
ScrollView
overScrollMode
=
'
never
'
>
{
content
}
<
/ScrollView
>
);
}
return
(
<
Modal
useNativeDriver
...
...
@@ -487,10 +507,9 @@ class CustomModalStack extends React.Component {
onBackdropPress
=
{
closeModal
}
hideModalContentWhileAnimating
avoidKeyboard
{...
androidProps
}
>
<
View
style
=
{[
sharedStyles
.
modal
,
pageSheet
?
sharedStyles
.
modalPageSheet
:
sharedStyles
.
modalFormSheet
]}
>
<
ModalSwitch
navigation
=
{
navigation
}
screenProps
=
{{
...
screenProps
,
closeModal
:
this
.
closeModal
}}
/
>
<
/View
>
{
content
}
<
/Modal
>
);
}
...
...
app/views/ModalBlockView.js
View file @
777cb28a
...
...
@@ -118,6 +118,17 @@ class ModalBlockView extends React.Component {
EventEmitter
.
addEventListener
(
viewId
,
this
.
handleUpdate
);
}
shouldComponentUpdate
(
nextProps
,
nextState
)
{
if
(
!
isEqual
(
nextProps
,
this
.
props
))
{
return
true
;
}
if
(
!
isEqual
(
nextState
,
this
.
state
))
{
return
true
;
}
return
false
;
}
componentDidUpdate
(
prevProps
)
{
const
{
navigation
}
=
this
.
props
;
const
oldData
=
prevProps
.
navigation
.
getParam
(
'
data
'
,
{});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment