Skip to content

[PS-22912] fix crash from upgrading to react native 61.5 #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/src/main/java/com/bolan9999/SpringScrollView.java
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ public void setContentOffset(float x, float y) {
WritableMap contentOffsetMap = Arguments.createMap();
contentOffsetMap.putDouble("x", PixelUtil.toDIPFromPixel(contentOffset.x));
contentOffsetMap.putDouble("y", PixelUtil.toDIPFromPixel(contentOffset.y));
event.putMap("contentOffset", contentOffsetMap);
event.putMap("contentOffset", (ReadableMap)contentOffsetMap);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a safe cast? Won't throw an error on its own at some point?

Copy link
Author

@lzcheung lzcheung Jun 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should be a safe cast since WritableMap extends from ReadableMap so any function it calls from ReadableMap should also be implemented by contentOffsetMap. I'm not sure why it doesn't accept the WritableMap in the first place.

event.putString("refreshStatus", refreshStatus);
event.putString("loadingStatus", loadingStatus);
sendOnScrollEvent(event);
Expand Down