Created
April 3, 2017 06:20
-
-
Save mori-dev/a874336d36a4f03e7f269c9f09c081cb to your computer and use it in GitHub Desktop.
ビューでコールバック付きのメソッドを呼び出す
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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