Skip to content

Commit ae0977f

Browse files
committed
Fix pointerEvents passed by inline styles
1 parent d4847b1 commit ae0977f

File tree

2 files changed

+7
-4
lines changed
  • packages/react-native-web/src

2 files changed

+7
-4
lines changed

packages/react-native-web/src/exports/StyleSheet/compiler/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,15 +387,15 @@ function createAtomicRules(identifier: string, property, value): Rules {
387387
} else if (value === 'none') {
388388
finalValue = 'none!important';
389389
const block = createDeclarationBlock({ pointerEvents: 'none' });
390-
rules.push(`${selector} * ${block}`);
390+
rules.push(`${selector}>* ${block}`);
391391
} else if (value === 'box-none') {
392392
finalValue = 'none!important';
393393
const block = createDeclarationBlock({ pointerEvents: 'auto' });
394-
rules.push(`${selector} * ${block}`);
394+
rules.push(`${selector}>* ${block}`);
395395
} else if (value === 'box-only') {
396396
finalValue = 'auto!important';
397397
const block = createDeclarationBlock({ pointerEvents: 'none' });
398-
rules.push(`${selector} * ${block}`);
398+
rules.push(`${selector}>* ${block}`);
399399
}
400400
const block = createDeclarationBlock({ pointerEvents: finalValue });
401401
rules.push(`${selector}${block}`);

packages/react-native-web/src/modules/createDOMProps/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,8 +879,11 @@ const createDOMProps = (elementType, props, options) => {
879879
`props.pointerEvents is deprecated. Use style.pointerEvents`
880880
);
881881
}
882+
const pointerEventsValue =
883+
StyleSheet.flatten(style).pointerEvents || pointerEvents;
884+
882885
const [className, inlineStyle] = StyleSheet(
883-
[style, pointerEvents && pointerEventsStyles[pointerEvents]],
886+
[style, pointerEventsValue && pointerEventsStyles[pointerEventsValue]],
884887
{
885888
writingDirection: 'ltr',
886889
...options

0 commit comments

Comments
 (0)