@actbase/react-daum-postcode
Advanced tools
Comparing version 0.9.0 to 0.9.2
@@ -16,2 +16,4 @@ "use strict"; | ||
var _reactNative = require("react-native"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -23,3 +25,3 @@ | ||
var html = "\n<!DOCTYPE html>\n<html lang=\"ko\">\n<head>\n\t<meta charset=\"utf-8\">\n\t<meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no\">\n\t<style> html, body { width: 100%; height: 100%; margin:0px; padding: 0px; background-color: #ececec; } </style>\n</head>\n<body>\n\t<div id=\"layer\" style=\"width:100%; min-height: 100%;\"></div>\n\t<script type=\"text/javascript\">\n function callback() {\n\t\t\tvar element_layer = document.getElementById('layer');\n new daum.Postcode({\n ...window.options,\n oncomplete: function(data) {\n window.ReactNativeWebView.postMessage(JSON.stringify(data));\n },\n onresize: function(size) {\n document.getElementById('layer').style.height = size.height + 'px';\n },\n onclose: function(state) {\n callback();\n },\n width : '100%',\n height: '100%',\n }).embed(element_layer);\n }\n\t\tfunction initOnReady(options) {\n \twindow.options = options;\n\t\t\tvar s = document.createElement('script');\n\t\t\ts.type = 'text/javascript'; s.src = 'https://t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js';\n\t\t\ts.onreadystatechange = callback; s.onload = callback;\n\t\t\tvar x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x);\n }\n\t</script>\n</body>\n</html>\n"; | ||
var html = "\n<!DOCTYPE html>\n<html lang=\"ko\">\n<head>\n\t<meta charset=\"utf-8\">\n\t<meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no\">\n\t<style> \n\t * { box-sizing: border-box }\n\t html, body { width: 100%; height: 100%; margin:0px; padding: 0px; background-color: #ececec; } \n </style>\n</head>\n<body>\n\t<div id=\"layer\" style=\"width:100%; min-height: 100%;\"></div>\n\t<script type=\"text/javascript\">\n function callback() {\n\t\t\tvar element_layer = document.getElementById('layer');\n\t\t\telement_layer.innerHTML = \"\";\n new daum.Postcode({\n ...window.options,\n onsearch: function () {\n window.scrollTo(0, 0);\n },\n oncomplete: function(data) {\n window.ReactNativeWebView.postMessage(JSON.stringify(data));\n },\n onresize: function(size) {\n document.getElementById('layer').style.height = size.height + 'px';\n },\n onclose: function() {\n callback();\n },\n width : '100%',\n height: '100%',\n }).embed(element_layer);\n }\n\t\tfunction initOnReady(options) {\n \twindow.options = options;\n\t\t\tvar s = document.createElement('script');\n\t\t\ts.type = 'text/javascript'; s.src = 'https://t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js';\n\t\t\ts.onreadystatechange = callback; s.onload = callback;\n\t\t\tvar x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x);\n }\n\t</script>\n</body>\n</html>\n"; | ||
@@ -30,3 +32,4 @@ var Postcode = function Postcode(props) { | ||
onError = props.onError, | ||
otherProps = (0, _tslib.__rest)(props, ["jsOptions", "onSelected", "onError"]); | ||
style = props.style, | ||
otherProps = (0, _tslib.__rest)(props, ["jsOptions", "onSelected", "onError", "style"]); | ||
var injectedJavaScript = React.useMemo(function () { | ||
@@ -44,18 +47,38 @@ return "initOnReady(" + JSON.stringify(jsOptions) + ");void(0);"; | ||
}, [onSelected]); | ||
return React.createElement(_reactNativeWebview["default"], (0, _tslib.__assign)({}, otherProps, { | ||
return React.createElement(_reactNative.View, { | ||
style: style | ||
}, React.createElement(_reactNativeWebview["default"], (0, _tslib.__assign)({ | ||
mixedContentMode: 'compatibility', | ||
androidLayerType: "hardware", | ||
renderToHardwareTextureAndroid: true, | ||
useWebKit: true | ||
}, otherProps, { | ||
source: { | ||
html: html, | ||
baseUrl: 'https://github.com' | ||
baseUrl: 'https://postcode.map.daum.net' | ||
}, | ||
onMessage: onMessage, | ||
injectedJavaScript: injectedJavaScript, | ||
mixedContentMode: 'compatibility', | ||
useWebKit: true, | ||
onShouldStartLoadWithRequest: function onShouldStartLoadWithRequest() { | ||
return true; | ||
onShouldStartLoadWithRequest: function onShouldStartLoadWithRequest(request) { | ||
var _a, _b, _c, _d; | ||
var isPostcode = !((_a = request.url) === null || _a === void 0 ? void 0 : _a.startsWith('https://postcode.map.daum.net/guide')) && (!((_b = request.url) === null || _b === void 0 ? void 0 : _b.startsWith('http')) || ((_c = request.url) === null || _c === void 0 ? void 0 : _c.startsWith('https://postcode.map.daum.net')) || ((_d = request.url) === null || _d === void 0 ? void 0 : _d.startsWith('http://postcode.map.daum.net'))); | ||
if (!isPostcode) { | ||
_reactNative.Linking.openURL(request.url); | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
} | ||
})); | ||
}))); | ||
}; | ||
Postcode.defaultProps = { | ||
jsOptions: { | ||
hideMapBtn: true | ||
} | ||
}; | ||
var _default = Postcode; | ||
exports["default"] = _default; |
{ | ||
"name": "@actbase/react-daum-postcode", | ||
"version": "0.9.0", | ||
"version": "0.9.2", | ||
"description": "다음 우편번호찾기 for React, React-Native", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -65,3 +65,3 @@ # @actbase/react-daum-postcode | ||
style={{ width: 320, height: 320 }} | ||
jsOptions={{ animated: true }} | ||
jsOptions={{ animated: true, hideMapBtn: true }} | ||
onSelected={data => { | ||
@@ -108,4 +108,6 @@ alert(JSON.stringify(data)); | ||
# Changes | ||
- 0.9.2 | ||
- RN 에서 검색 다음페이지 갈 경우 위로 스크롤 올려줌 | ||
- 지도보기 등 외부 링크를 누를경우 브라우저로 이동 | ||
- 0.9.0 | ||
- 첫 배포 |
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
33076
453
112