georstat/react-native-image-cache

feature request: render children

jamesholcomb opened this issue · 3 comments

Hi, this is a nice lib and I'm refactoring some code to get ride of react-native-fast-image.

Similar to <Image/> and <FastImage/> could you implement child rendering? I have a need to render a custom component within an image that is bounded by StyleSheet.absoluteFillObject. For example:

<CachedImage source="https://img.com/x">
  <View
    style={{
      ...StyleSheet.absoluteFillObject,
      justifyContent: "center",
      alignItems: "center",
      backgroundColor: Color("transparent").alpha(0.4).string()
    }}
  >
    <EventCanceledBadge />
  </View>
</CachedImage>

Hi @jamesholcomb, the lib doesn’t support children. Don’t know if we will ever add this ability, it will require plenty of refactoring and breaking changes probably.

We’re always open for PR so if you got any ideas bring them in!

Yes, the missing feature keeps me from switching entirely from fast-image.

@megacherry this feature will probably add breaking changes unless we split the CachedImage component in 2 different files, one for normal usage and one for children 🤔. @geobako any thoughts?