Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6212

Pass Values From One Modal To Another

$
0
0

I am using these in one of my modals:

const [startingPoint, setStartingPoint] = useState('');<Input  placeholder="Start"  onChangeText={inputText => setStartingPoint(inputText)}  value={startingPoint}/>

I want to pass the value, which was entered here to the next modal and automatically write it in another input field. I am trying to pass the value like this:

<AvailableTripsPage  showAvailableTripsPage={showAvailableTripsPage}  toggleShowPage={toggleAvailableTripsPage}  startingPoint={startingPoint}/>

This is from the second modal now where the value was passed.

const [newStartingPoint, setNewStartingPoint] = useState(startingPoint);<Item fixedLabel><Input       //onChangeText={text => setNewStartingPoint(text)}      value={newStartingPoint}   />

However, this doesn't work properly. Sometimes the value just doesn't show up. Or else, the value that I entered on the previous modal isn't updated. For example, if I wrote 'FirstPoint' in the beginning, and tried a few times with different values, it still shows 'FirstPoint' in the new modal.


Viewing all articles
Browse latest Browse all 6212

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>