Skip to content

Commit bfc5806

Browse files
committed
Add loading animation
1 parent adb7e73 commit bfc5806

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

js/App.js

+28-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class App extends React.Component {
4848
landscapeLayout: false,
4949
appState: AppState.currentState,
5050
barStyle: 'default',
51+
loadProgress: 0,
5152
};
5253

5354
this._Auth = new Authenticate();
@@ -354,7 +355,33 @@ class App extends React.Component {
354355
this.webview = ref;
355356
}}
356357
source={{uri: this.state.uri}}
357-
startInLoadingState={false}
358+
startInLoadingState={true}
359+
renderLoading={() => (
360+
<View
361+
style={{
362+
backgroundColor: global.bgColor,
363+
height: '100%',
364+
flex: 0,
365+
paddingLeft: 50,
366+
paddingRight: 50,
367+
}}>
368+
<Image
369+
source={require('../icon.png')}
370+
resizeMode={'center'}
371+
style={{
372+
width: null,
373+
height: null,
374+
opacity: this.state.loadProgress * 0.8,
375+
flex: 1,
376+
}}
377+
/>
378+
</View>
379+
)}
380+
onLoadProgress={({nativeEvent}) => {
381+
this.setState({
382+
loadProgress: nativeEvent.progress,
383+
});
384+
}}
358385
bounces={true}
359386
mixedContentMode="always"
360387
sharedCookiesEnabled={true}

0 commit comments

Comments
 (0)