Skip to content

Commit

Permalink
Replace Toast with Log.w on ReactImageView when null URL specified (#…
Browse files Browse the repository at this point in the history
…34819)

Summary:
Pull Request resolved: #34819

This is crashing on A12 because of using the regular Context instead of the application context. That said, this probably makes more sense as a log warning.

Reviewed By: javache

Differential Revision: D39852058

fbshipit-source-id: 1ac93f8cc9ecdb14f60baca175c8ecff2ff42ac0
  • Loading branch information
Christopher Jones authored and facebook-github-bot committed Sep 29, 2022
1 parent 5f5d6b7 commit 30411ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ rn_android_library(
react_native_target("java/com/facebook/react/common:common"),
react_native_target("java/com/facebook/react/module/annotations:annotations"),
react_native_target("java/com/facebook/react/uimanager:uimanager"),
react_native_target("java/com/facebook/react/util:util"),
react_native_target("java/com/facebook/react/modules/fresco:fresco"),
react_native_target("java/com/facebook/react/uimanager/annotations:annotations"),
react_native_target("java/com/facebook/react/views/imagehelper:withmultisource"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.widget.Toast;
import androidx.annotation.Nullable;
import com.facebook.common.internal.Objects;
import com.facebook.common.references.CloseableReference;
Expand Down Expand Up @@ -51,6 +50,7 @@
import com.facebook.react.uimanager.PixelUtil;
import com.facebook.react.uimanager.UIManagerHelper;
import com.facebook.react.uimanager.events.EventDispatcher;
import com.facebook.react.util.RNLog;
import com.facebook.react.views.imagehelper.ImageSource;
import com.facebook.react.views.imagehelper.MultiSourceHelper;
import com.facebook.react.views.imagehelper.MultiSourceHelper.MultiSourceResult;
Expand Down Expand Up @@ -597,11 +597,9 @@ private boolean shouldResize(ImageSource imageSource) {

private void warnImageSource(String uri) {
if (ReactBuildConfig.DEBUG) {
Toast.makeText(
getContext(),
"Warning: Image source \"" + uri + "\" doesn't exist",
Toast.LENGTH_SHORT)
.show();
RNLog.w(
(ReactContext) getContext(),
"ReactImageView: Image source \"" + uri + "\" doesn't exist");
}
}
}

0 comments on commit 30411ae

Please sign in to comment.