Format and refactor capturing ref.
This commit is contained in:
parent
30c2d966e4
commit
a4c4848ff4
7
index.js
7
index.js
|
@ -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}
|
||||||
|
|
Loading…
Reference in New Issue