i want to send an ID that i get from a database to another screen and i've seen how to do it on google but people only use hook components and i'm new to react native so i don't really understand how to do it.
You can send data from one screen to another using navigation params. Here is example: https://reactnavigation.org/docs/params/.
Related
I want to put credit card number in a field and on clicking a button to retrieve its token. I don't find much information but the thing that I found is:
https://developer.moneris.com/Documentation/NA/E-Commerce%20Solutions/Hosted%20Solutions/Hosted%20Tokenization
I tried with it but still can't make it work. If I put this whole code in webview html part it will call the function on the first screen render. If I try to get the functions out of the webview and use them I can't take the specific iframe with document.getElementById('monerisFrame').contentWindow;
Any thoughts how can I accomplish my task?
You can use Moneris Apis to communicate in React Native :
We can create XML Post Request and connect with the Moneris server with your API Token and Store Id
Follow this blog :
https://medium.com/me/stats/post/7129b5a8b4a2
Trying to create a breadcrumb module where all the user action will be stored. Problem is how do I track the user actions in React native as a third party module. Need to know the UIElements and their respective callback functions.
Example : User has clicked on Button X in Screen Y.
Any pointers would be helpful. Thanks in advance
So I am working on my first React Native project and I am curious as to what the proper way to handle user data is. I have 3 different pages that are: HomePage, ProfilePage, ChatPage. When a user logs in it navigates them to the HomePage.
As of now, I have it to where when the HomePage loads it makes a backend call that retrieves all of the user data and sets it to some states.
Now when the user navigates to a new page like the ProfilePage none of the data is there anymore of course so do I have to make another backend call? So one backend call for each page? Im sure there has to be some way to only make the backend call once. Could I possibly set a global state of some sort? Should I save all the user data to AsyncStorage?
My current File structure is as follows:
App.js -> Contains my React Navigation stack
HomePage.js
ProfilePage.js
ChatPage.js
Thanks for the help!
You can use Redux plus React-Redux.
To say in short redux is a state management library for react. The states will be global to your app accessible across various components inside app. also there will be reactivity.
For more info visit this link
https://react-redux.js.org/
You should use React-Redux and manage your states globally.
I am creating an application to order food online and I want to perform a functionality where the user does not have to scroll or do any action to see reflected on the screen of their device that their order has changed status.
Example: The user enters to see the status of their order and being there on that screen that the user can see how the status of the order is updated without having to scroll.
I don't know if I should use listeners or some way with async and wait
I am using react native with hooks, react navigation 5, axios for API call
Do you know how I could do this? how can I find more information on this.
I appreciate any help you can give me.
There are two ways you can solve this.
Polling - you can create some interval, say 1 second, for axios to refetch the data you need. Wrapping your axios call with setInterval() https://www.w3schools.com/jsref/met_win_setinterval.asp, is one form of this.
Web Sockets - you can create a web socket that maintains a constant connection to your app and server, so when updates happen it is automatically reflected in the UI. You can check out WebSocket support in React Native here: https://reactnative.dev/docs/network.html#websocket-support
I have one Api for Tab with two screen .The problem is i need in both use this data but:
1) When you open screen with tab,one is loaded but second does not load(i make fetch in both screen in componentDidMount )
2)it is bad to everytime fetch data,Please help me
In order to do avoid unecesssary api calls you can either use a library like redux, the react context api, or a higher order component and then pass the data as props to each component. I think we would need to see more details as to why it’s working in one screen and not another.