mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
RN: Consistent API for Image Events
Summary: Changes the `onLoad` and `onError` events on `Image` to be consistent with each other and with the `ImageSource` type. Changelog: [Android][Breaking] - On `Image`, `onLoad` and `onError` event objects will no longer have an extra `uri` property. [Android][Breaking] - On `Image`, `onLoad` event objects' `source.url` is now renamed to `source.uri`. [iOS][Breaking] - On `Image`, `onLoad` event objects' `source.url` is now renamed to `source.uri`. Reviewed By: mdvacca Differential Revision: D22023565 fbshipit-source-id: 5ea7904c697f87e01118bdb81ed50ab0a5aecdce
This commit is contained in:
committed by
Facebook GitHub Bot
parent
90997c26e3
commit
74ab8f6e5a
@@ -107,14 +107,10 @@ public class ImageLoadEvent extends Event<ImageLoadEvent> {
|
||||
switch (mEventType) {
|
||||
case ON_LOAD:
|
||||
eventData = Arguments.createMap();
|
||||
// TODO: Remove this (to be less redundant and to be consistent with iOS).
|
||||
eventData.putString("uri", mSourceUri);
|
||||
eventData.putMap("source", createEventDataSource());
|
||||
break;
|
||||
case ON_ERROR:
|
||||
eventData = Arguments.createMap();
|
||||
// TODO: Remove this (to be less redundant and to be consistent with iOS).
|
||||
eventData.putString("uri", mSourceUri);
|
||||
eventData.putString("error", mErrorMessage);
|
||||
break;
|
||||
}
|
||||
@@ -124,9 +120,9 @@ public class ImageLoadEvent extends Event<ImageLoadEvent> {
|
||||
|
||||
private WritableMap createEventDataSource() {
|
||||
WritableMap source = Arguments.createMap();
|
||||
source.putString("uri", mSourceUri);
|
||||
source.putDouble("width", mWidth);
|
||||
source.putDouble("height", mHeight);
|
||||
source.putString("url", mSourceUri);
|
||||
return source;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user