Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ component_syntax=true
module.name_mapper='^react-strict-dom$' -> '<PROJECT_ROOT>/packages/react-strict-dom/dist/native/index.js.flow'
module.system.node.resolve_dirname=flow_modules
module.system.node.resolve_dirname=node_modules
react.runtime=automatic
suppress_type=$FlowIssue
suppress_type=$FlowFixMe

Expand Down
1 change: 1 addition & 0 deletions apps/website/docs/api/02-css/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,5 +277,6 @@ The following tables represent the compatibility status of the strict CSS API fo
| visibility | 🟡 | 🟡 | |
| whiteSpace | ❌ | ❌ | |
| width | ✅ | ✅ | |
| willChange | 🟡 | 🟡 | |
| wordBreak | ❌ | ❌ | |
| zIndex | ✅ | ✅ | [#100](https://github.com/facebook/react-strict-dom/issues/100) |
6 changes: 6 additions & 0 deletions packages/react-strict-dom/src/native/css/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,12 @@ export function props(
nextStyle.alignContent ??= styleValue;
nextStyle.justifyContent ??= styleValue;
}
// willChange polyfill
else if (styleProp === 'willChange') {
if (typeof styleValue === 'string' && styleValue !== 'auto') {
nativeProps.renderToHardwareTextureAndroid = true;
}
}
// Everything else
else {
nextStyle[styleProp] = styleValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ const allowedStyleKeySet = new Set<string>([
'verticalAlign', // Android Only
'visibility',
'width',
'willChange', // Android Only
'zIndex',
// Object-value keys
'default',
Expand Down
1 change: 1 addition & 0 deletions packages/react-strict-dom/src/types/renderer.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ type ReactNativeProps = {
pointerEvents?: ViewProps['pointerEvents'],
ref?: $FlowFixMe,
referrerPolicy?: ImageProps['referrerPolicy'],
renderToHardwareTextureAndroid?: ViewProps['renderToHardwareTextureAndroid'],
role?: ?string,
secureTextEntry?: TextInputProps['secureTextEntry'],
spellCheck?: TextInputProps['spellCheck'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,13 @@ exports[`properties: general visibility: visible 1`] = `
}
`;

exports[`properties: general willChange 1`] = `
{
"renderToHardwareTextureAndroid": true,
"style": {},
}
`;

exports[`properties: logical direction blockSize: blockSize 1`] = `
{
"style": {
Expand Down
9 changes: 9 additions & 0 deletions packages/react-strict-dom/tests/css-test.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,15 @@ describe('properties: general', () => {
'visible'
);
});

test('willChange', () => {
const styles = css.create({
root: {
willChange: 'transform'
}
});
expect(css.props.call(mockOptions, styles.root)).toMatchSnapshot();
});
});

/**
Expand Down
10 changes: 8 additions & 2 deletions packages/react-strict-dom/tools/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ const webConfigs = [
file: path.join(__dirname, '../dist/dom/index.js'),
format: 'es'
},
plugins: [...sharedPlugins]
plugins: [...sharedPlugins],
treeshake: {
moduleSideEffects: false,
},
},
// Runtime
{
Expand All @@ -65,7 +68,10 @@ const webConfigs = [
file: path.join(__dirname, '../dist/dom/runtime.js'),
format: 'es'
},
plugins: [...sharedPlugins]
plugins: [...sharedPlugins],
treeshake: {
moduleSideEffects: false,
},
}
];

Expand Down