How I can reload a webview to initial source when I click on button from navigator? I can reset a original componet using?
React.useEffect(() => {
const unsubscribe = navigation.addListener('tabPress', e => {
});
Or I can reload the webview on component?
function TabOneNavigator({ navigation }) {
React.useEffect(() => {
const unsubscribe = navigation.addListener('tabPress', e => {
alert('Default behavior prevented');
});
return unsubscribe;
}, [navigation]);
return (
<TabOneStack.Navigator>
<TabOneStack.Screen
name="Perfil"
component={TabOneScreen}
options={{ headerTitle: 'IzyJob' }}
/>
</TabOneStack.Navigator>
);
}
my screen
export default class App extends React.Component {
state = {
url: 'https://www.google.com'
};
render() {
return <WebView
source={{ uri: this.state.url }}
style={{ marginTop: 0 }} />;
}
}
My idea is when page on webview is different of state.url and has a click on tab navigation I reload to initial url