-
-
Notifications
You must be signed in to change notification settings - Fork 551
MSW listen() doesn't work on Expo React Native app #1408
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
Comments
Hi again! after many tried, I've figured out a way to make it work! 😆 I appreciate the way how you made msw work for RN apps tbh. Thus, I close this issue as it doesn't have any sense as it I know now. You can see my answer on Expo Forum, where I asked same a similar question 😄 . Thanks for you attention. 🙏 |
@fregayeg I can't thank you enough for this. MSW would silently fail and thought I was going crazy over here. |
Okay, so the silently failing part is definitely not fine. I think MSW should check if the global The fact that you need to use Is there anything else I'm missing? |
If anybody could give #1520 a review, I'd be thankful. Let's improve the experience around React Native polyfills. |
Hello @kettanaito ! Thank you for this good job! I didn't see the updates sincel last week sorry. Could you please tell me if I should do something else ? |
Ok maybe I'm late. In order to help people understand what is the minimal setup to run React Native with MSW, I recommend to use Expo, it makes the task straighforward and pretty simple. I suggest to visit my expo-msw sample , its linked to my personal github. thanks all |
Released: v1.0.0 🎉This has been released in v1.0.0! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
Prerequisites
Environment check
msw
versionNode.js version
v16.17.0
Reproduction repository
https://github.com/fregayeg/optional-proj
Reproduction steps
yarn install
expo start -c
and wait the web server to be ready.http://localhost:19002
Current behavior
Actually, following your examples and discussion about React Native support, I've made a sample app, that must call and endpoint through something called redux-toolkit query (equivalent to React Query, Apollo etc...). The behavior is: When I open the app I get my main screen (ui) as expected: a bottom tab navigator with exactly 2 sub-screens. When I go the 2nd screen where the API call is, I get nothing and no errors are printed out on console.
Expected behavior
When I open the app I get my 1st screen (ui) as expected: a bottom tab navigator with exactly 2 sub-screens. If I tap on 2nd tab, I go to the screen where the api call is, and then I must see a loading indicator then a list of items must appear instead, without errors.
The text was updated successfully, but these errors were encountered: