如何让用户接近用户名 2 的用户?
在解析指令中:
var userGeoPoint = userObject.get("location");
var query = new Parse.Query(PlaceObject);
query.near("location", userGeoPoint);
query.limit(10);
query.find({
success: function(placesObjects) { }
有一个通常查询的代码:
var Tweet = Parse.Object.extend("Recommend");
var query = new Parse.Query(Tweet);
query.equalTo("username", "2");
query.find({
success: (tweets) => this.setState({tweets}),
error: (error) => console.error(error),
});
},
render: function() {
return (
<ScrollView style={styles.container}>
{this.state.tweets.map(
tweet => <Cellrec tweet={tweet} />
)}
</ScrollView>
);
}
});
它运作良好。我不知道如何用geopoint制作它。
我尝试:
var Tweet = Parse.Object.extend("User");
var userGeoPoint = userObject.get("Location");
var query = new Parse.Query(Tweet);
query.near("Location", userGeoPoint);
query.equalTo("username", "2");
query.find({
success: (tweets) => this.setState({tweets}),
error: (error) => console.error(error),
});
},
render: function() {
return (
<ScrollView style={styles.container}>
{this.state.tweets.map(
tweet => <Cellrec tweet={tweet} />
)}
</ScrollView>
);
}
});
但它不起作用。错误未定义不是对象(评估'this.state.tweets.map')