Skip to content

Commit

Permalink
LoadingSpinner: add workaround for Surface issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mnzaki committed Jul 23, 2019
1 parent 7acb8b5 commit f1689d6
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions src/ui/generic/loadingSpinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { StyleSheet } from 'react-native'
import { JolocomTheme } from 'src/styles/jolocom-theme'
const loaders = require('react-native-indicator')

interface Props {}

const styles = StyleSheet.create({
loadingContainer: {
backgroundColor: 'white',
Expand All @@ -16,12 +14,28 @@ const styles = StyleSheet.create({
},
})

export const LoadingSpinner: React.SFC<Props> = props => (
<Container style={styles.loadingContainer}>
<loaders.RippleLoader
size={120}
strokeWidth={4}
color={JolocomTheme.primaryColorPurple}
/>
</Container>
)
export class LoadingSpinner extends React.PureComponent {
componentDidMount() {
// FIXME
// HACK because of https://github.com/facebook/react-native/issues/17565
// the fix will land in RN 0.61
// then we can get rid of this
requestAnimationFrame(() => this.forceUpdate())
// it is actually not even always reproducible :/
}

render() {
// FIXME the key={Date.now()} bit is part of the HACK from above,
// see componentDidMount
return (
<Container style={styles.loadingContainer}>
<loaders.RippleLoader
key={Date.now()}
size={120}
strokeWidth={4}
color={JolocomTheme.primaryColorPurple}
/>
</Container>
)
}
}

0 comments on commit f1689d6

Please sign in to comment.