Skip to content

Commit 48ac1b4

Browse files
fix: replace delete with destructuring to support React Native 0.82+ new architecture (#87)
Fixes #85 Co-authored-by: nikhil <nikhil@indigolearn.com>
1 parent 9e42e95 commit 48ac1b4

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/Hyperlink.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,7 @@ class Hyperlink extends Component<HyperlinkProps, HyperlinkState> {
9696
let elements: Array<string | React.ReactElement> = [];
9797
let _lastIndex = 0;
9898

99-
// Create component props (ref and key are React-specific and not in TextProps)
100-
const componentProps = component.props as TextProps;
101-
delete (componentProps as { ref?: unknown }).ref;
102-
delete (componentProps as { key?: unknown }).key;
99+
const { ref: _ref, key: _key, ...componentProps } = component.props || {};
103100

104101
try {
105102
this.state.linkifyIt
@@ -161,9 +158,7 @@ class Hyperlink extends Component<HyperlinkProps, HyperlinkState> {
161158
let { props: { children } = { children: undefined } } = component || {};
162159
if (!children) return component;
163160

164-
const componentProps = component.props as TextProps;
165-
delete (componentProps as { ref?: unknown }).ref;
166-
delete (componentProps as { key?: unknown }).key;
161+
const { ref: _ref, key: _key, ...componentProps } = component.props || {};
167162

168163
return React.cloneElement(
169164
component,
@@ -229,4 +224,4 @@ export default class extends Component<HyperlinkProps> {
229224
<Hyperlink {...rest} />
230225
);
231226
}
232-
}
227+
}

0 commit comments

Comments
 (0)