diff --git a/native/media/encrypted-image.react.js b/native/media/encrypted-image.react.js --- a/native/media/encrypted-image.react.js +++ b/native/media/encrypted-image.react.js @@ -12,7 +12,7 @@ type BaseProps = { +holder: string, +encryptionKey: string, - +onLoad: (uri: string) => void, + +onLoad?: (uri: string) => void, +spinnerColor: string, +style: ImageStyle, +invisibleLoad: boolean, diff --git a/native/media/loadable-image.react.js b/native/media/loadable-image.react.js --- a/native/media/loadable-image.react.js +++ b/native/media/loadable-image.react.js @@ -10,7 +10,7 @@ type Props = { +placeholder: ?ImageSource, +source: ?ImageSource, - +onLoad: () => void, + +onLoad?: () => void, +spinnerColor: string, +style: ImageStyle, +invisibleLoad: boolean, diff --git a/native/media/multimedia.react.js b/native/media/multimedia.react.js --- a/native/media/multimedia.react.js +++ b/native/media/multimedia.react.js @@ -102,21 +102,26 @@ const { currentSource, departingSource } = this.state; if (departingSource) { images.push(this.renderSource(currentSource, true)); - images.push(this.renderSource(departingSource, true)); + images.push(this.renderSource(departingSource, false, false)); } else { images.push(this.renderSource(currentSource)); } return <View style={styles.container}>{images}</View>; } - renderSource(source: Source, invisibleLoad?: boolean = false) { + renderSource( + source: Source, + invisibleLoad?: boolean = false, + triggerOnLoad?: boolean = true, + ) { + const onLoadProp = triggerOnLoad ? this.onLoad : undefined; if (source.kind === 'encrypted') { return ( <EncryptedImage thumbHash={source.thumbHash} holder={source.holder} encryptionKey={source.encryptionKey} - onLoad={this.onLoad} + onLoad={onLoadProp} spinnerColor={this.props.spinnerColor} style={styles.image} invisibleLoad={invisibleLoad} @@ -130,7 +135,7 @@ return ( <RemoteImage uri={uri} - onLoad={this.onLoad} + onLoad={onLoadProp} placeholder={placeholder} spinnerColor={this.props.spinnerColor} style={styles.image} @@ -142,7 +147,7 @@ return ( <Image source={{ uri }} - onLoad={this.onLoad} + onLoad={onLoadProp} placeholder={placeholder} style={styles.image} key={uri} diff --git a/native/media/remote-image.react.js b/native/media/remote-image.react.js --- a/native/media/remote-image.react.js +++ b/native/media/remote-image.react.js @@ -11,7 +11,7 @@ type BaseProps = { +uri: string, - +onLoad: (uri: string) => void, + +onLoad?: (uri: string) => void, +spinnerColor: string, +style: ImageStyle, +invisibleLoad: boolean,