
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
react-native-crossfade-image
Advanced tools
React Native component to update image source with crossfade transition effect
React Native component for changing images with crossfade transition effect when a new source prop received. Works as a replacement for React Native's Image
or ImageBackground
components, both local files and remote URLs supported.
yarn add react-native-crossfade-image
# or
npm install react-native-crossfade-image
Simply replace Image
with CrossfadeImage
in your component. Please note that you have to specify image dimensions using the style prop to avoid collapsing.
import React from 'react';
import { View, StyleSheet } from 'react-native';
import { CrossfadeImage } from 'react-native-crossfade-image';
const MyComponent = ({ imageSource }) => (
<View style={styles.wrapper}>
<CrossfadeImage style={styles.image} source={imageSource} resizeMode="cover" />
</View>
);
const styles = StyleSheet.create({
wrapper: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
image: {
width: 100,
height: 100,
},
});
export default MyComponent;
You can provide children like you would with ImageBackground
component. The content will be shown on top of the image. Adding blurRadius
will create a nice blurred background effect.
import React from 'react';
import { StyleSheet, Text } from 'react-native';
import { CrossfadeImage } from 'react-native-crossfade-image';
const MyComponent = ({ imageSource }) => (
<CrossfadeImage style={styles.background} source={imageSource} resizeMode="cover" blurRadius={50}>
<Text style={styles.text}>Text over blurred background</Text>
</CrossfadeImage>
);
const styles = StyleSheet.create({
background: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
text: {
color: '#fff',
fontSize: 20,
fontWeight: 'bold',
},
});
export default MyComponent;
Prop | Required | Default | Description |
---|---|---|---|
source | yes | The image source (either a remote URL or a local file resource) | |
duration | no | 500 | Duration of the fade transition in ms |
easing | no | Easing.ease | Easing function, see available options |
style | no | Style object applied to the wrapping View | |
resizeMode | no | 'cover' | Image resize mode, see available options |
blurRadius | no | The blur radius of the blur filter applied to the image | |
children | no | Any children provided will be shown on top of the image similar to ImageBackground component |
https://user-images.githubusercontent.com/4656448/172882419-c4712b98-3711-4dfb-85d7-ba56fa307dd8.mp4
MIT
FAQs
React Native component to update image source with crossfade transition effect
The npm package react-native-crossfade-image receives a total of 29 weekly downloads. As such, react-native-crossfade-image popularity was classified as not popular.
We found that react-native-crossfade-image demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.