Browse Source

Merge pull request #1 from heatnode/master

Fix for changing orientation.
HISAME SHIZUMARU 7 years ago
parent
commit
ef1d6a89aa
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      LoadingSpinnerOverlay.js

+ 3
- 2
LoadingSpinnerOverlay.js View File

@@ -23,7 +23,6 @@ import {
23 23
 
24 24
 import TimerEnhance from 'react-native-smart-timer-enhance'
25 25
 
26
-const {width: deviceWidth, height: deviceHeight,} = Dimensions.get('window')
27 26
 const styles = StyleSheet.create({
28 27
     overlay: {
29 28
         position: 'absolute',
@@ -83,6 +82,7 @@ class LoadingSpinnerOverlay extends Component {
83 82
     }
84 83
     
85 84
     _renderOverLay(loadingSpinner) {
85
+        let {width: deviceWidth, height: deviceHeight,} = Dimensions.get('window')
86 86
         return (
87 87
             this.state.modal ?
88 88
                 (this.state.marginTop === 0 ?
@@ -190,6 +190,7 @@ class LoadingSpinnerOverlay extends Component {
190 190
         if(!this._loadingSpinnerWidth || !this._loadingSpinnerHeight) {
191 191
             return
192 192
         }
193
+        let {width: deviceWidth, height: deviceHeight,} = Dimensions.get('window')
193 194
         let left = (deviceWidth - this._loadingSpinnerWidth) / 2
194 195
         let top =  (deviceHeight - this._loadingSpinnerHeight) / 2 - (modal && marginTop === 0 ? 0 : marginTop)
195 196
         this._container.setNativeProps({
@@ -223,4 +224,4 @@ class LoadingSpinnerOverlay extends Component {
223 224
 
224 225
 }
225 226
 
226
-export default TimerEnhance(LoadingSpinnerOverlay)
227
+export default TimerEnhance(LoadingSpinnerOverlay)