Skip to content

Commit

Permalink
[change] remove 'resizeMode' static from 'Image'
Browse files Browse the repository at this point in the history
Use strings instead of the 'Image.resizeMode' static. Corresponding change in React Native:

facebook/react-native@870775e
  • Loading branch information
necolas committed Nov 12, 2018
1 parent 750790c commit c35f849
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ exports[`components/Image prop "resizeMode" value "cover" 1`] = `"cover"`;

exports[`components/Image prop "resizeMode" value "none" 1`] = `"auto"`;

exports[`components/Image prop "resizeMode" value "repeat" 1`] = `"auto"`;

exports[`components/Image prop "resizeMode" value "stretch" 1`] = `"100% 100%"`;

exports[`components/Image prop "resizeMode" value "undefined" 1`] = `"cover"`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,7 @@ describe('components/Image', () => {
});

describe('prop "resizeMode"', () => {
[
Image.resizeMode.contain,
Image.resizeMode.cover,
Image.resizeMode.none,
Image.resizeMode.stretch,
undefined
].forEach(resizeMode => {
['contain', 'cover', 'none', 'repeat', 'stretch', undefined].forEach(resizeMode => {
test(`value "${resizeMode}"`, () => {
const component = shallow(<Image resizeMode={resizeMode} />);
expect(findImageSurfaceStyle(component).backgroundSize).toMatchSnapshot();
Expand Down Expand Up @@ -214,7 +208,7 @@ describe('components/Image', () => {

describe('prop "style"', () => {
test('supports "resizeMode" property', () => {
const component = shallow(<Image style={{ resizeMode: Image.resizeMode.contain }} />);
const component = shallow(<Image style={{ resizeMode: 'contain' }} />);
expect(findImageSurfaceStyle(component).backgroundSize).toMatchSnapshot();
});

Expand Down
2 changes: 0 additions & 2 deletions packages/react-native-web/src/exports/Image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ class Image extends Component<*, State> {
return ImageLoader.prefetch(uri);
}

static resizeMode = ImageResizeMode;

_filterId = 0;
_imageRef = null;
_imageRequestId = null;
Expand Down
10 changes: 0 additions & 10 deletions packages/website/storybook/1-components/Image/ImageScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,6 @@ const ImageScreen = () => (
/>
</Section>

<Section title="Properties">
<DocItem
name="static resizeMode"
typeInfo="object"
example={{
code: '<Image resizeMode={Image.resizeMode.contain} />'
}}
/>
</Section>

<Section title="Methods">
<DocItem
name="static getSize"
Expand Down

0 comments on commit c35f849

Please sign in to comment.