question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

On android device toast is draggable and after drag and drop, toast does not getting hide

See original GitHub issue

I have followed the steps mention here https://www.npmjs.com/package/react-native-toast-message to add toast in my app. And I have followed code to display and hide the toast automatically after 2sec.

Toast.show({ text1: 'Submitted', type: 'success', visibilityTime: 2000, autoHide: true, position: 'top', topOffset: 10, onPress: () => { Toast.hide(); }, });

But when toast displayed, it is draggable, after drag and drop it is not getting hide and visibilityTime is also not working in this case. This is specifically on android device. Is there any way to remove draggable behaviour of toast?.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
gcrozariolcommented, Sep 5, 2021

For some reason, I can’t even make it work on Android. iOS works just fine. However, I see getting this “Possible Unhandled Promise Rejection” error. 😦

0reactions
amirhosein5858commented, Dec 5, 2022

this is a temporary fix in node_modules/react-native-toast-message/src/index.js

you can comment this: {...this.panResponder.panHandlers}

it will fix the issue but also disabled drag-to-close of toast

after that you can patch this change using npx patch-package react-native-toast-message just remember for ios to apply changes: 1- delete ios/Pods folder 2- run npx patch-package 3- run npx pod-install

Read more comments on GitHub >

github_iconTop Results From Across the Web

Drag and drop - Android Developers
The system responds by first calling back to your application to get a drag shadow. The system then displays the drag shadow on...
Read more >
Android: Draggable Toast, Or Alternative? - Stack Overflow
The problem with using Toast is that I have to give it a duration, and, also, I can't change its position once it...
Read more >
Android Drag and Drop Tutorial: Moving Views and Data
Android's drag -and-drop framework lets users move data and views using graphical gestures. Users can drag and drop data across views within ...
Read more >
Gestures and Touch Events | CodePath Android Cliffnotes
First, we want to attach an onTouch handler on the views that are draggable which will start the drag by creating a DragShadow...
Read more >
SureLock for Android User Guide - Documentation - 42Gears
of the document shall not be used, copied, altered, published, ... Set Custom Toast Message ... Download and install SureLock on your Android...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found