我在我的一種模式中使用這些:const [startingPoint, setStartingPoint] = useState('');<Input placeholder="Start" onChangeText={inputText => setStartingPoint(inputText)} value={startingPoint}/>我想將此處輸入的值傳遞給下一個模式,并自動將其寫入另一個輸入字段。我試圖傳遞這樣的值:<AvailableTripsPage showAvailableTripsPage={showAvailableTripsPage} toggleShowPage={toggleAvailableTripsPage} startingPoint={startingPoint}/>這是來自傳遞值的第二個模式。const [newStartingPoint, setNewStartingPoint] = useState(startingPoint);<Item fixedLabel> <Input //onChangeText={text => setNewStartingPoint(text)} value={newStartingPoint} />但是,這不能正常工作。有時價值只是沒有顯示出來。否則,我在上一個模式中輸入的值不會更新。例如,如果我在開頭寫了“FirstPoint”,并嘗試了幾次不同的值,它仍然在新模態(tài)中顯示“FirstPoint”。
將值從一種模式傳遞到另一種模式
吃雞游戲
2022-07-21 09:53:22