Skip to content

Commit c449bee

Browse files
Merge pull request #171 from aqos156/master
Fix status bar background color android
2 parents 62d9374 + 4fc44f1 commit c449bee

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

DropdownAlert.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ export default class DropdownAlert extends Component {
173173
if (this._closeTimeoutId != null) {
174174
clearTimeout(this._closeTimeoutId);
175175
}
176+
if (this.state.isOpen) {
177+
this.closeDirectly();
178+
}
176179
}
177180
createPanResponder = () => {
178181
this._panResponder = PanResponder.create({
@@ -272,6 +275,14 @@ export default class DropdownAlert extends Component {
272275
);
273276
}
274277
};
278+
resetStatusBarColor = () => {
279+
if (this.props.updateStatusBar) {
280+
if (IS_ANDROID) {
281+
StatusBar.setBackgroundColor(this.props.inactiveStatusBarBackgroundColor, true);
282+
}
283+
StatusBar.setBarStyle(this.props.inactiveStatusBarStyle, true);
284+
}
285+
}
275286
close = action => {
276287
if (action == undefined) {
277288
action = 'programmatic';
@@ -285,15 +296,11 @@ export default class DropdownAlert extends Component {
285296
clearTimeout(this._closeTimeoutId);
286297
}
287298
this.animate(0);
288-
if (this.props.updateStatusBar) {
289-
if (IS_ANDROID) {
290-
StatusBar.setBackgroundColor(this.props.inactiveStatusBarBackgroundColor, true);
291-
}
292-
StatusBar.setBarStyle(this.props.inactiveStatusBarStyle, true);
293-
}
299+
this.resetStatusBarColor();
294300
setTimeout(
295301
function() {
296302
if (this.state.isOpen) {
303+
this.resetStatusBarColor();
297304
this.setState({
298305
isOpen: false,
299306
});
@@ -321,12 +328,7 @@ export default class DropdownAlert extends Component {
321328
this.setState({
322329
isOpen: false,
323330
});
324-
if (this.props.updateStatusBar) {
325-
if (IS_ANDROID) {
326-
StatusBar.setBackgroundColor(this.props.inactiveStatusBarBackgroundColor, true);
327-
}
328-
StatusBar.setBarStyle(this.props.inactiveStatusBarStyle, true);
329-
}
331+
this.resetStatusBarColor();
330332
}
331333
}
332334
animate = toValue => {

0 commit comments

Comments
 (0)