diff --git a/ReactNativeFastImageExample/src/FastImageExamples.js b/ReactNativeFastImageExample/src/FastImageExamples.js
index 7c4fbd8..6b20af7 100644
--- a/ReactNativeFastImageExample/src/FastImageExamples.js
+++ b/ReactNativeFastImageExample/src/FastImageExamples.js
@@ -8,6 +8,7 @@ import BorderRadiusExample from './BorderRadiusExample'
import FeatureText from './FeatureText'
import ProgressExample from './ProgressExample'
import PreloadExample from './PreloadExample'
+import ResizeModeExample from './ResizeModeExample'
import StatusBarUnderlay, { STATUS_BAR_HEIGHT } from './StatusBarUnderlay'
const FastImageExample = () => (
@@ -31,6 +32,7 @@ const FastImageExample = () => (
+
diff --git a/ReactNativeFastImageExample/src/ResizeModeExample.js b/ReactNativeFastImageExample/src/ResizeModeExample.js
new file mode 100644
index 0000000..eb7da17
--- /dev/null
+++ b/ReactNativeFastImageExample/src/ResizeModeExample.js
@@ -0,0 +1,51 @@
+import React from 'react'
+import { StyleSheet, View } from 'react-native'
+import withCacheBust from './withCacheBust'
+import SectionFlex from './SectionFlex'
+import FastImage from 'react-native-fast-image'
+import Section from './Section'
+import FeatureText from './FeatureText'
+
+const IMAGE_URL = 'https://media.giphy.com/media/GEsoqZDGVoisw/giphy.gif'
+
+const BorderRadiusExample = ({ onPressReload, bust }) => (
+
+
+
+
+
+
+
+
+
+)
+
+const styles = StyleSheet.create({
+ image: {
+ height: 100,
+ width: 50,
+ backgroundColor: '#ddd',
+ margin: 5,
+ flex: 0,
+ },
+})
+
+export default withCacheBust(BorderRadiusExample)
diff --git a/__snapshots__/index.test.js.snap b/__snapshots__/index.test.js.snap
index edbb5a2..c6dc3fb 100644
--- a/__snapshots__/index.test.js.snap
+++ b/__snapshots__/index.test.js.snap
@@ -20,7 +20,7 @@ exports[`FastImage renders correctly. 1`] = `
onFastImageLoadEnd={undefined}
onFastImageLoadStart={undefined}
onFastImageProgress={undefined}
- resizeMode="cover"
+ resizeMode="contain"
source={
Object {
"headers": Object {
@@ -50,7 +50,7 @@ exports[`Renders a normal Image when not passed a uri. 1`] = `
onLoadEnd={undefined}
onLoadStart={undefined}
onProgress={undefined}
- resizeMode="cover"
+ resizeMode="contain"
source={
Object {
"testUri": "../../../react-native-fast-image-example-server/pictures/jellyfish.gif",
diff --git a/ios/FastImage/FFFastImageView.m b/ios/FastImage/FFFastImageView.m
index 0573118..d96ff42 100644
--- a/ios/FastImage/FFFastImageView.m
+++ b/ios/FastImage/FFFastImageView.m
@@ -7,6 +7,13 @@
NSDictionary* onLoadEvent;
}
+- (id) init {
+ self = [super init];
+ self.resizeMode = RCTResizeModeCover;
+ self.clipsToBounds = YES;
+ return self;
+}
+
- (void)setResizeMode:(RCTResizeMode)resizeMode
{
if (_resizeMode != resizeMode) {
diff --git a/ios/FastImage/FFFastImageViewManager.m b/ios/FastImage/FFFastImageViewManager.m
index e05b54a..af6820b 100644
--- a/ios/FastImage/FFFastImageViewManager.m
+++ b/ios/FastImage/FFFastImageViewManager.m
@@ -8,10 +8,7 @@
RCT_EXPORT_MODULE(FastImageView)
- (FFFastImageView*)view {
- FFFastImageView* view = [[FFFastImageView alloc] init];
- view.contentMode = (UIViewContentMode) RCTResizeModeStretch;
- view.clipsToBounds = YES;
- return view;
+ return [[FFFastImageView alloc] init];
}
RCT_EXPORT_VIEW_PROPERTY(source, FFFastImageSource)
diff --git a/package.json b/package.json
index 643910a..00ef478 100644
--- a/package.json
+++ b/package.json
@@ -30,10 +30,9 @@
"url": "git+https://github.com/DylanVann/react-native-fast-image.git"
},
"scripts": {
- "format": "prettier --write ./*.js ./ReactNativeFastImageExample/FastImage/*.js ./react-native-fast-image-server/*.js",
+ "format": "prettier --write --list-different ./*.js ./ReactNativeFastImageExample/src/*.js ./react-native-fast-image-server/*.js",
"prepare": "git submodule update --init --recursive",
- "test": "yarn run test:format && yarn run test:jest",
- "test:format": "prettier-check ./*.js ./ReactNativeFastImageExample/FastImage/*.js ./react-native-fast-image-server/*.js",
+ "test": "yarn run format && yarn run test:jest",
"test:jest": "jest *.js"
},
"dependencies": {