Changeset View
Changeset View
Standalone View
Standalone View
native/media/loadable-image.react.js
// @flow | // @flow | ||||
import { Image } from 'expo-image'; | import { Image } from 'expo-image'; | ||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { View, StyleSheet, ActivityIndicator } from 'react-native'; | import { View, StyleSheet, ActivityIndicator } from 'react-native'; | ||||
import type { ImageSource } from 'react-native/Libraries/Image/ImageSource'; | import type { ImageSource } from 'react-native/Libraries/Image/ImageSource'; | ||||
import type { ImageStyle } from '../types/styles.js'; | import type { ImageStyle } from '../types/styles.js'; | ||||
type Props = { | type Props = { | ||||
+placeholder: ?ImageSource, | +placeholder: ?ImageSource, | ||||
+source: ?ImageSource, | +source: ?ImageSource, | ||||
+onLoad: () => void, | +onLoad?: () => void, | ||||
+spinnerColor: string, | +spinnerColor: string, | ||||
+style: ImageStyle, | +style: ImageStyle, | ||||
+invisibleLoad: boolean, | +invisibleLoad: boolean, | ||||
}; | }; | ||||
function LoadableImage(props: Props): React.Node { | function LoadableImage(props: Props): React.Node { | ||||
const { source, placeholder, onLoad: onLoadProp } = props; | const { source, placeholder, onLoad: onLoadProp } = props; | ||||
const [loaded, setLoaded] = React.useState(false); | const [loaded, setLoaded] = React.useState(false); | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |