Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ビューでコールバック付きのメソッドを呼び出す
sendCurrentPlace(): void {
navigator.geolocation.getCurrentPosition(
(position) => {
const lat = position.coords.latitude;
const lng = position.coords.longitude;
const payload = { lat, lng };
this.props.SomeActions.someSendPlaceOk(payload);
},
(error) => {
this.props.SomeActions.someSendPlaceNg(error);
}
)
}
render() {
return (
<div>
<FlatButton
label="位置情報送信"
onTouchTap={this.sendCurrentPlace.bind(this)}
/>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment