Image Diff component for React Native: swipe between two images for comparison.

Installation
npm install react-native-image-diff --save
Usage
import ImageDiff from 'react-native-image-diff'.../* Basic usage */<ImageDiff = // = =/> /* With custom options */<ImageDiff = = = // * . = // = = ='red' =/>
Props
Prop | Type | Default | Note |
---|---|---|---|
before |
Image source | undefined |
(Required) Source of 'before' image |
after |
Image source | undefined |
(Required) Source of 'after' image |
initialOffsetPercentage |
number |
0.5 |
Percentage (0 to 1) of width to describe the initial separator position |
width |
number |
Screen width | Image's width |
initialHeight |
number |
Half of screen width | Initial height of image. Final height will be calculated after image is loaded to maintain aspect ratio. |
separatorWidth |
number |
1 |
Separator's width. Set as 0 to hide it. |
separatorColor |
color |
'black' |
Color of separator |
style |
style |
{} |
Style of component's container. You can't override height or width here, for that, set width prop. This is for margins, background color, etc. |
Example
import ImageDiff from 'react-native-image-diff' { return <View => <ScrollView => <ImageDiff = = /> </ScrollView> </View> }