1.2.0 • Published 5 years ago

react-native-safe-image v1.2.0

Weekly downloads
26
License
MIT
Repository
github
Last release
5 years ago

NPM version

react-native-safe-image

Really light React-Native package to handle fallback when image is on error

  • fallback to other image
  • fallback to a component

How to use it ?

yarn add react-native-safe-image

import { SafeImage } from 'react-native-safe-image'

// ...
render() {
  return (
    <SafeImage
      source={{ uri: 'http://Normal-Image-Maybe-OnError.jpg' }}
      fallbackImageSource={require('./Path-To/FallbackImage.jpg')}
      style={{ width: 30, height: 30 }}
      resizeMode="contain"
    />
  )
}
// ... or ...
const noImg = <View><Text>No Img</Text></View>
render() {
  return (
    <SafeImage
      source={{ uri: 'http://Normal-Image-Maybe-OnError.jpg' }}
      fallbackComponent={noImg}
      style={{ width: 30, height: 30 }}
      resizeMode="contain"
    />
  )
}

Todos

  • add fallbackComponent prop

Hire an expert!

Looking for a ReactNative freelance expert with more than 12 years experience? Contact me from my website!

1.2.0

5 years ago

1.2.0-1

5 years ago

1.2.0-0

5 years ago

1.1.0

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago