Skip to content

Commit

Permalink
Merge pull request #5108 from iChengbo/fixRN-previewImage
Browse files Browse the repository at this point in the history
fix(RN): 修复 previewImage 加载中的 loading 提示
  • Loading branch information
Pines-Cheng authored Dec 23, 2019
2 parents 827eea3 + 5112d2b commit a2f11e0
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions packages/taro-rn/src/api/image/previewImage.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import React from 'react'
import { Modal ,Text} from 'react-native'
import { Modal, View, ActivityIndicator, StyleSheet } from 'react-native'
import RootSiblings from 'react-native-root-siblings'
import ImageViewer from 'react-native-image-zoom-viewer'

const styles = StyleSheet.create({
loadingWrapper: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
}
})

function previewImage (obj) {
let {
current,
Expand All @@ -28,7 +36,13 @@ function previewImage (obj) {
onClick={onSuccess}
onSwipeDown={onSuccess}
enableSwipeDown
loadingRender={() => <Text>loading...</Text>}
loadingRender={() => {
return (
<View style={[styles.loadingWrapper]}>
<ActivityIndicator size="large" color={'#999'} />
</View>
)
}}
/>
</Modal>
)
Expand Down

0 comments on commit a2f11e0

Please sign in to comment.