Introduction
In the current version, when the web view is reloaded (connection problems or Apple Pay),
We lose all the web view history and if the user was submitting a form, we lose all of it's body.
This leads to a bad user experience
How to solve it ?
We need to create an issue on react-native-webview asking for access to the user's history and request data (body and headers) through navigation events.
Save the history in a global state and when the webview is reloaded, set those values programmatically through the library's props.
If a history exists, use the last URL of the history, otherwise pass a URL.
Example:
interface IHistory {
url: string
// all necessary data
request: {
headers: {}
body: {}
}
}
const [historyState, setHistory] = useState<IHistory[]>();
<Webview
source={{
[historyState ? "history" : "url"]: historyState || "mysite.com"
}}
onNavigationStateChange={({ history }) => {
setHistory(history);
}}
/>
Introduction
In the current version, when the web view is reloaded (connection problems or Apple Pay),
We lose all the web view history and if the user was submitting a form, we lose all of it's body.
This leads to a bad user experience
How to solve it ?
We need to create an issue on react-native-webview asking for access to the user's history and request data (body and headers) through navigation events.
Save the history in a global state and when the webview is reloaded, set those values programmatically through the library's props.
If a history exists, use the last URL of the history, otherwise pass a URL.
Example: