Skip to content

Commit ab2d133

Browse files
GH-31: Fix the occasionally happening 'cssRules' property issue (GH-32)
1 parent 69c093a commit ab2d133

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.1.4",
2+
"version": "0.1.5",
33
"name": "antd-phone-input",
44
"description": "Advanced Phone Number Input for Ant Design",
55
"keywords": [

src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ const PhoneInput = (inputLegacyProps: PhoneInputProps) => {
2121

2222
useEffect(() => {
2323
/** Load antd 5.x styles dynamically observing the theme change */
24-
for (let styleSheet of document.styleSheets) {
24+
for (let styleSheet of document?.styleSheets || []) {
2525
let rule: any;
26-
for (rule of styleSheet.cssRules || styleSheet.rules) {
26+
for (rule of styleSheet?.cssRules || styleSheet?.rules || []) {
2727
if (rule.selectorText === ".react-tel-input .country-list") {
2828
rule.style.boxShadow = token.boxShadow;
2929
rule.style.backgroundColor = token.colorBgElevated;

0 commit comments

Comments
 (0)