Skip to content

Commit

Permalink
feat: add story to fadeInImage component
Browse files Browse the repository at this point in the history
  • Loading branch information
romaniukua committed Apr 9, 2020
1 parent 29fa0d9 commit acf8c82
Showing 1 changed file with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from 'react';
import {
Linking,
StyleSheet,
TouchableOpacity
} from 'react-native';
import { storiesOf } from '@storybook/react'; // tslint:disable-line:no-implicit-dependencies
import { FadeInImage } from '../FadeInImage';
import {
files, text
// tslint:disable-next-line no-implicit-dependencies
} from '@storybook/addon-knobs';

const styles = StyleSheet.create({
imageStyle: {
width: 100,
height: 100,
marginTop: 20
},
imageContainer: {
alignItems: 'center'
}
});
const deepLink = (deepLinkText: any) => () => {
// tslint:disable-next-line
Linking.openURL(deepLinkText);
};

storiesOf('FadeInImage', module)
.add('basic usage', () => {
const deepLinkText = text('Deep Link Url', 'https://google.com');
const label = 'Images';
const accept = '.xlsx, .pdf, .png, .jpg, jpeg';
const defaultValue = ['https://placehold.it/100x100'];
const value = files(label, accept, defaultValue);
return (
<TouchableOpacity onPress={deepLink(deepLinkText)} style={styles.imageContainer}>
<FadeInImage
source={{uri: value[0]}}
resizeMode='contain'
resizeMethod='resize'
style={styles.imageStyle}
/>
</TouchableOpacity>
);
});

0 comments on commit acf8c82

Please sign in to comment.