Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react native load function each time visit screen

You have to add focus listener so when you go back, It will refresh the data 
like

import * as React from 'react';
import { View } from 'react-native';

function AppScreen({ navigation }) {
  React.useEffect(() => {
    const unsubscribe = navigation.addListener('focus', () => {
      // The screen is focused
      // Call any action and update data
    });

    // Return the function to unsubscribe from the event so it gets removed on unmount
    return unsubscribe;
  }, [navigation]);

  return <View />;
}
source : https://reactnavigation.org/docs/function-after-focusing-screen/
Comment

PREVIOUS NEXT
Code Example
Javascript :: owl.js cdn 
Javascript :: factorialization in javascript 
Javascript :: JavaScript Window - The Browser Object Model 
Javascript :: check if any property of object is null javascript 
Javascript :: jquery window offset top 
Javascript :: redux devtools 
Javascript :: toggle class javascript stack overflow 
Javascript :: bcd full form in electronics 
Javascript :: wait for ajax to finish 
Javascript :: remove role discord.js 
Javascript :: remove a object name from spread operator 
Javascript :: promise.allsettled polyfill node 
Javascript :: axios set body 
Javascript :: export default new class in es6 
Javascript :: DragDropContext 
Javascript :: nodejs file exists 
Javascript :: async for loop 
Javascript :: local string method 
Javascript :: dynamic style react 
Javascript :: on change field text jquery 
Javascript :: how to access key of object in javascript 
Javascript :: get data from url in angular 
Javascript :: cors express tutorial 
Javascript :: linked list javascript 
Javascript :: node fs full path 
Javascript :: json file with multiple records 
Javascript :: What is data modeling in MongoDB 
Javascript :: get all cookies 
Javascript :: js order string 
Javascript :: express request body undefined 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =