-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add story to fadeInImage component
- Loading branch information
1 parent
29fa0d9
commit acf8c82
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
packages/fscomponents/src/components/__stories__/FadeInImage.story.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
}); |