我正在嘗試更新 title 的值但它沒(méi)有更新值有人可以告訴我 EditPost.js 上發(fā)生了什么class EditScreen extends Component { render() { return ( <KeyboardAvoidingView behavior="position" keyboardVerticalOffset={Platform.OS === "ios" ? 0 : 100} > <Image style={styles.image} source={this.props.navigation.getParam("image")} /> <View style={styles.detailContainer}> <AppTextInput value={this.props.navigation.getParam("title")} conChangeText={(text) => this.props.navigation.setParams({ title: text }) } /> <AppTextInput value={this.props.navigation.getParam("des")} /> </View> <AppButton text="Save" style={styles.button} onPress={() => { this.props.navigation.getParam("onEdit"); this.props.navigation.goBack(); }} />主頁(yè).js onEdit = (data) => { const newPosts = this.state.post.map((item) => { if (item.key === data.key) return data; else return item; }); this.setState({ post: newPosts, editMode: false }); };有人可以幫我嗎...
React Native,無(wú)法更新值
Smart貓小萌
2023-04-27 17:23:31