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
// This issue happened only on iOS. | |
// In React Native Maps, touching a marker should generate only marker's onPress event. | |
// However, in iOS, MapView's onPress event is generated with marker's onPress event. | |
// I solved this issue by referencing this issue: https://github.com/react-community/react-native-maps/issues/758 | |
// React Native Maps 를 사용할 때 iOS에서만 마커를 클릭할 때 MapView의 onPress 이벤트가 같이 발생한다. | |
// 이 이슈를 해결하기 위해서는 MapView.Marker의 onPress props의 이벤트 핸들러에 | |
// e.stopPropagation(); 을 추가하여 MapView 로 이벤트가 전파되지 않도록 해야 한다. | |
// Previous code: |
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
/* | |
* Better way to show and hide window | |
*/ | |
Animated.sequence([ | |
Animated.parallel([ // 윈도우를 슬라이드인, 페이드인 한다. | |
Animated.timing( | |
this.state.fadeAnim, | |
{ | |
toValue: 1, |
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
/* | |
* Not so good way to slide in, show for 4 seconds, and then hide window | |
*/ | |
Animated.parallel([ // 윈도우를 슬라이드인, 페이드인 한다. | |
Animated.timing( | |
this.state.fadeAnim, | |
{ | |
toValue: 1, | |
duration: isAndroid ? androidDuration : iosDuration, | |
easing: Easing.in(), |
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
// the first code | |
Animated.parallel([ // 윈도우를 슬라이드인, 페이드인 한다. | |
Animated.timing( | |
this.state.fadeAnim, | |
{ | |
toValue: 1, | |
duration: isAndroid ? androidDuration : iosDuration, | |
easing: Easing.in(), | |
useNativeDriver, |
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
export function myActionCreator() { | |
return async dispatch => { | |
try { | |
req = await axios.get(url, {timeout: 4000}); | |
dispatch ({ | |
type: ACTION_TYPE, | |
payload: req.data, | |
}) | |
} catch (e) { |
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
export function myActionCreator() { | |
return async dispatch => { | |
const CancelToken = axios.CancelToken | |
const source = CancelToken.source() | |
try { | |
let req = null; | |
setTimeout(() => { | |
if (req == null) { | |
console.log(`Request Timeout with req == null.`) |
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
// API Request: | |
// http://newsky2.kma.go.kr/service/SecndSrtpdFrcstInfoService2/ForecastGrib?ServiceKey=SERVICE_KEY | |
// &base_date=20181001 | |
// &base_time=1200 | |
// &nx=60&ny=127 | |
// &pageNo=1&numOfRows=20 | |
// &_type=json | |
// JSON Response: | |
{ |
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
// API Request: | |
// http://newsky2.kma.go.kr/service/SecndSrtpdFrcstInfoService2/ForecastTimeData?ServiceKey=SERVICE_KEY | |
// &base_date=20181001 | |
// &base_time=1230 | |
// &nx=55&ny=127 | |
// &pageNo=1&numOfRows=60 | |
// &_type=json | |
// JSON Response: | |
{ |
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
// API Request: | |
// http://newsky2.kma.go.kr/service/SecndSrtpdFrcstInfoService2/ForecastSpaceData?ServiceKey=SERVICE_KEY | |
// &base_date=20181001 | |
// &base_time=1100 | |
// &nx=55&ny=127 // NOTE: This is not latitude and longitude. It is KMA defined grid number. | |
// &_type=json | |
// &numOfRows=1000 | |
// Response JSON: | |
{ |
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
function localTimeToUtc(localHours, localMinutes) { | |
const date = new Date() | |
const now = new Date(date.getFullYear(), date.getMonth(), date.getDate(), localHours, localMinutes) // UTC | |
const utcHours = now.getUTCHours() | |
const utcMinutes = now.getUTCMinutes() | |
return {utcHours, utcMinutes} | |
} |
OlderNewer