Skip to content

Commit 5ae0834

Browse files
author
Suhan Moon
committed
Flex Style insert.
1 parent b27ab36 commit 5ae0834

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ width, height값을 별도로 줄 수 있습니다.
104104
프로젝트 문의 혹은 제휴가 필요한 경우 [email protected]로 연락주세요.
105105

106106
# Changes
107+
- 0.9.6
108+
- onClose 이벤트 추가
107109
- 0.9.4
108110
- 아싸리 그냥 FlexStyle속성을 다 밀어넣어버립시다..
109111
- 0.9.3

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@actbase/react-daum-postcode",
3-
"version": "0.9.4",
3+
"version": "0.9.6",
44
"description": "다음 우편번호찾기 for React, React-Native",
55
"main": "lib/index.js",
66
"module": "lib/index.js",

src/app.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { PostcodeProps } from './types';
2+
import { OnCompleteParams, PostcodeProps } from './types';
33

44
const getJSApi = (): Promise<any> => {
55
return new Promise((resolve, reject) => {
@@ -22,7 +22,7 @@ const getJSApi = (): Promise<any> => {
2222
});
2323
};
2424

25-
const Postcode: React.FC<PostcodeProps> = ({ onSelected, jsOptions, style }) => {
25+
const Postcode: React.FC<PostcodeProps> = ({ onSelected, onClose, jsOptions, style }) => {
2626
const layer = React.useRef<HTMLDivElement>(null);
2727

2828
const loadData = React.useCallback(async () => {
@@ -31,10 +31,17 @@ const Postcode: React.FC<PostcodeProps> = ({ onSelected, jsOptions, style }) =>
3131
// @ts-ignore
3232
new window.daum.Postcode({
3333
...jsOptions,
34-
oncomplete: onSelected,
35-
onclose: function() {
36-
loadData();
34+
oncomplete: function(data: OnCompleteParams) {
35+
console.log('oncomplete');
36+
onSelected(data);
3737
},
38+
onclose:
39+
onClose ||
40+
function() {
41+
if (layer.current) {
42+
loadData();
43+
}
44+
},
3845
}).embed(layer.current);
3946
}
4047
}, []);

src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,8 @@ export interface PostcodeProps {
387387
*/
388388
onSelected: (data: OnCompleteParams) => void;
389389

390+
onClose: () => void;
391+
390392
/**
391393
* onSelected 함수에서 오류 발생 시 실행되는 함수입니다.
392394
*/

0 commit comments

Comments
 (0)