[change] Image should not be draggable by default

This commit is contained in:
Nicolas Gallagher
2018-05-23 15:53:00 -07:00
parent b8f54f61f0
commit 0eae7bed2e
4 changed files with 6 additions and 6 deletions

View File

@@ -77,9 +77,9 @@ describe('components/Image', () => {
test('prop "draggable"', () => {
const defaultSource = { uri: 'https://google.com/favicon.ico' };
const component = shallow(<Image defaultSource={defaultSource} />);
expect(component.find('img').prop('draggable')).toBeUndefined();
component.setProps({ defaultSource, draggable: false });
expect(component.find('img').prop('draggable')).toBe(false);
component.setProps({ defaultSource, draggable: true });
expect(component.find('img').prop('draggable')).toBe(true);
});
describe('prop "onLoad"', () => {

View File

@@ -212,7 +212,7 @@ class Image extends Component<*, State> {
? createElement('img', {
alt: accessibilityLabel || '',
decode: 'async',
draggable,
draggable: draggable || false,
ref: this._setImageRef,
src: displayImage,
style: styles.img

View File

@@ -51,8 +51,8 @@ const ImageScreen = () => (
<DocItem
label="web"
name="draggable"
typeInfo="?boolean = true"
description="When false, the image will not be draggable"
typeInfo="?boolean = false"
description="When true, the image will be draggable"
example={{
render: () => <PropDraggable />
}}

View File

@@ -8,7 +8,7 @@ import { Image, StyleSheet, View } from 'react-native';
const ImageDraggableExample = () => (
<View style={styles.container}>
<Image draggable={false} source={sources.large} style={styles.image} />
<Image draggable={true} source={sources.large} style={styles.image} />
</View>
);