Skip to content

Commit

Permalink
Revert "fix: migrate off setNativeProps (#10767)"
Browse files Browse the repository at this point in the history
This reverts commit 495b28f.
kacperkapusciak committed Sep 19, 2022
1 parent 0593c30 commit dfc11e7
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions packages/stack/src/views/Stack/Card.tsx
Original file line number Diff line number Diff line change
@@ -67,10 +67,6 @@ type Props = ViewProps & {
contentStyle?: StyleProp<ViewStyle>;
};

type State = {
pointerEvents: ViewProps['pointerEvents'];
};

const GESTURE_VELOCITY_IMPACT = 0.3;

const TRUE = 1;
@@ -93,7 +89,7 @@ const hasOpacityStyle = (style: any) => {
return false;
};

export default class Card extends React.Component<Props, State> {
export default class Card extends React.Component<Props> {
static defaultProps = {
shadowEnabled: false,
gestureEnabled: true,
@@ -108,10 +104,6 @@ export default class Card extends React.Component<Props, State> {
) : null,
};

state: State = {
pointerEvents: 'auto',
};

componentDidMount() {
this.animate({ closing: this.props.closing });
this.isCurrentlyMounted = true;
@@ -250,7 +242,7 @@ export default class Card extends React.Component<Props, State> {
private setPointerEventsEnabled = (enabled: boolean) => {
const pointerEvents = enabled ? 'box-none' : 'none';

this.setState({ pointerEvents });
this.contentRef.current?.setNativeProps({ pointerEvents });
};

private handleStartInteraction = () => {
@@ -433,6 +425,8 @@ export default class Card extends React.Component<Props, State> {
}
}

private contentRef = React.createRef<View>();

render() {
const {
styleInterpolator,
@@ -561,7 +555,7 @@ export default class Card extends React.Component<Props, State> {
/>
) : null}
<CardSheet
pointerEvents={this.state.pointerEvents}
ref={this.contentRef}
enabled={pageOverflowEnabled}
layout={layout}
style={contentStyle}

0 comments on commit dfc11e7

Please sign in to comment.