我在我的一种模式中使用这些:
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”,并尝试了几次不同的值,它仍然在新模态中显示“FirstPoint”。
Cats萌萌
相关分类