diff --git a/package.json b/package.json index 86b34fd..468aac6 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.1.4", + "version": "0.1.5", "name": "antd-phone-input", "description": "Advanced Phone Number Input for Ant Design", "keywords": [ diff --git a/src/index.tsx b/src/index.tsx index e80d59e..905d3cd 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -21,9 +21,9 @@ const PhoneInput = (inputLegacyProps: PhoneInputProps) => { useEffect(() => { /** Load antd 5.x styles dynamically observing the theme change */ - for (let styleSheet of document.styleSheets) { + for (let styleSheet of document?.styleSheets || []) { let rule: any; - for (rule of styleSheet.cssRules || styleSheet.rules) { + for (rule of styleSheet?.cssRules || styleSheet?.rules || []) { if (rule.selectorText === ".react-tel-input .country-list") { rule.style.boxShadow = token.boxShadow; rule.style.backgroundColor = token.colorBgElevated;