-
Notifications
You must be signed in to change notification settings - Fork 6
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
HostedForm is not showing up #5
Comments
I'm not sure I understand the specific issue enough to help, perhaps you can provide a minimal, reproducible example? |
@brendanbond Here's the code sample. Thank you. |
@brendanbond Sometimes the library doesn't load properly. It shows an error |
|
Whoops, I pressed close accidentally! I'd like to leave this open in case you come to a solution in the library code, please post it if you do! |
Had the same issue fixed by copying code from the git repository and creating a custom component Due to the nature of react.js script sometimes won't load properly or it will load twice if any of that happens authorize net won't show the popup |
Wrapper would be much better alternative to load the script same as stripe does it and then having to put payment button inside wrapper |
Thanks, @pandas9 although I'm not sure I follow. The script is loaded via this hook - can you elaborate on how Stripe does something similar? FWIW, these components/hooks act as a fairly thin wrapper around the AcceptJS library, which is structured far differently from Stripe's (really excellent) React provider libraries. The truth is, I've moved on from the project that I wrote this for (although, to my knowledge, that project still uses this library in production). I would welcome a PR if you have time to try and tackle the issue you're running into. Otherwise, I'll need some more context or concrete steps to reproduce any trouble you're having. Thanks! |
We are hitting the same issue with HostedForm as @pandas9. In our 4 step checkout process in which the user can navigate forward and backward through the steps, the first time through clicking the "Pay" button displays the lightbox with credit card fields properly. Once we navigate away from that screen, then back to it, the button no longer opens the lightbox. The issue occurs when the underlying component that HostedForm is on is loaded, then unloaded, then reloaded. For example, if HostedForm is on the "Payment" component, this code will cause the issue since it loads and unloads the Payment component depending on the checkout step the user is on: If I change the above code to simply hide the Payment component (as opposed to unloading it), the Pay button works correctly as the user navigates back and forth to the Payment component: |
@pstatxde if I'm understanding correctly, the solution is to make sure that react doesn't unmount remount and remount the component - shouldn't that be taken care of at the component's consumer level, rather than in the component itself, or is there something that should be done to ? |
I've been running into the same issue. The As an experiment, I commented out the My guess is that
The only solution I can think of would be a change to the
The rest of the This is a bit hacky but without being able to modify If this solution is acceptable to @brendanbond, I'd be happy to open a merge request. |
Hmm, it seems like from your very good description of the problem,
Feel free, that would be awesome! |
Sorry for the late reply. Your understanding is correct and my workaround was to ensure my component that HostedForm is on is hidden/unhidden rather than being unmounted/mounted in the DOM. That said, I think it's better if HostedForm works correctly when the underlying component is unmounted and remounted, since most apps likely work in that manner. |
Agreed.
This would be very helpful. Thank you as well. |
By 'that particular component', do you mean I do like the idea of memoizing the script content. |
Yeah, it uses a separate script (AcceptUI.js) IIRC, so we can just ditch |
Sounds like a plan! I'll spend some time on this today & tomorrow, expect a PR shortly! |
I have observed that when the HostedForm is properly working, you should see the code existing inside the body of the page when you inspect its element. In our system, we are using react with material UI and placing the HostedForm inside the material Drawer, When I close the drawer and re-open it, the on-click function of the HostedForm form does not work anymore. It seems like the functionality that adds the
class="show"
to the element that makes the form appear is not working.The text was updated successfully, but these errors were encountered: