Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

navigation react pass props

Copyfunction HomeScreen({ navigation }) {  return (    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>      <Text>Home Screen</Text>      <Button        title="Go to Details"        onPress={() => {          /* 1. Navigate to the Details route with params */          navigation.navigate('Details', {            itemId: 86,            otherParam: 'anything you want here',          });        }}      />    </View>  );}
function DetailsScreen({ route, navigation }) {  /* 2. Get the param */  const { itemId } = route.params;  const { otherParam } = route.params;  return (    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>      <Text>Details Screen</Text>      <Text>itemId: {JSON.stringify(itemId)}</Text>      <Text>otherParam: {JSON.stringify(otherParam)}</Text>      <Button        title="Go to Details... again"        onPress={() =>          navigation.push('Details', {            itemId: Math.floor(Math.random() * 100),          })        }      />      <Button title="Go to Home" onPress={() => navigation.navigate('Home')} />      <Button title="Go back" onPress={() => navigation.goBack()} />    </View>  );}
Comment

PREVIOUS NEXT
Code Example
Javascript :: How to abreviate digits in js 
Javascript :: jquery clone row 
Javascript :: async await promise all javascript 
Javascript :: lifecycle state: defunct, not mounted 
Javascript :: angular socket.io with token header 
Javascript :: how to delay something in javascript 
Javascript :: change img src css 
Javascript :: join method 
Javascript :: js copy string to clipboard 
Javascript :: javascript on selected 
Javascript :: what is template engine in express 
Javascript :: regex.match 
Javascript :: javascript get form input data 
Javascript :: compare two dates and sort array of objects 
Javascript :: node map has value 
Javascript :: jquery each hover 
Javascript :: change the value in checkbox by button react 
Javascript :: javascript date for 5 seconds from now 
Javascript :: change url link javascript 
Javascript :: react lottie 
Javascript :: javascript cartesian product 
Javascript :: media queries generator script 
Javascript :: react state value not updating in function 
Javascript :: make random letter capital in string javascript 
Javascript :: fetch request 
Javascript :: Uncaught TypeError: $(...).jstree is not a function 
Javascript :: what is the function of delete operator in javascript 
Javascript :: what does getattribute return null for data-* attributes 
Javascript :: flutter or react native 
Javascript :: js read a ini file 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =