Currently the component doesn't support children.
This is because FastImage supplies a android.widget.imageview and not a android.view.viewgroup.
For now absolute positioning is a workaround.
My team built a short workaround (wrapper) for this.
import React, { Component } from 'react';
import { Platform, View } from 'react-native';
import FastImage from 'react-native-fast-image';
export default class FastImageWeBurn extends Component {
render() {
const { children, ...otherProps } = this.props;
const markup = Platform.OS === 'android' ? (
<View>
<FastImage {...otherProps} />
<View>
{children}
</View>
</View>
) : (
<FastImage {...this.props} />
);
return markup;
}
}
So while we now can use children on Android, it's still necessary to use absolute positioning within the FastImage Wrapper. E.g. we are using this to put transparent overlays on a FastImage. The overlay has the same size as the image and we position it absolute with top: -IMAGE_SIZE 馃憤
Hope this solution helps someone on here 鈽猴笍
That's roughly how it's implemented now 馃槃
Most helpful comment
My team built a short workaround (wrapper) for this.
So while we now can use children on Android, it's still necessary to use absolute positioning within the FastImage Wrapper. E.g. we are using this to put transparent overlays on a FastImage. The overlay has the same size as the image and we position it absolute with top: -IMAGE_SIZE 馃憤
Hope this solution helps someone on here 鈽猴笍