Format and refactor capturing ref.

This commit is contained in:
Dylan Vann 2018-04-25 02:55:56 -04:00
parent 30c2d966e4
commit a4c4848ff4
1 changed files with 4 additions and 3 deletions

View File

@ -30,6 +30,8 @@ class FastImage extends Component {
this._root.setNativeProps(nativeProps) this._root.setNativeProps(nativeProps)
} }
captureRef = e => (this._root = e)
render() { render() {
const { const {
source, source,
@ -47,7 +49,7 @@ class FastImage extends Component {
if (useLocalImage(source)) { if (useLocalImage(source)) {
return ( return (
<Image <Image
ref={e => (this._root = e)} ref={this.captureRef}
{...props} {...props}
style={style} style={style}
source={source} source={source}
@ -63,8 +65,7 @@ class FastImage extends Component {
const resolvedSource = resolveAssetSource(source) const resolvedSource = resolveAssetSource(source)
return ( return (
<View style={[style, styles.imageContainer]} <View style={[style, styles.imageContainer]} ref={this.captureRef}>
ref={e => (this._root = e)}>
<FastImageView <FastImageView
{...props} {...props}
style={StyleSheet.absoluteFill} style={StyleSheet.absoluteFill}