Skip to content

Commit ea62274

Browse files
author
John Richard Chipps-Harding
authored
Styles passthrough (#12)
1 parent d5da94a commit ea62274

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project are documented in this file.
44

5+
## 0.0.2
6+
7+
- Added: Ability to pass styles in.
8+
59
## 0.0.1
610

711
- Added: Initial release.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const ShaderCanvas = ({
1111
vertShader,
1212
uniforms,
1313
superSample,
14+
style,
1415
...props
1516
}) => {
1617
const canvas = useRef();
@@ -55,6 +56,7 @@ const ShaderCanvas = ({
5556
width={width * pixelDensity * superSample}
5657
height={height * pixelDensity * superSample}
5758
style={{
59+
...style,
5860
width: `${width}px`,
5961
height: `${height}px`
6062
}}
@@ -68,7 +70,8 @@ ShaderCanvas.propTypes = {
6870
fragShader: PropTypes.string.isRequired,
6971
vertShader: PropTypes.string,
7072
uniforms: PropTypes.object,
71-
superSample: PropTypes.number
73+
superSample: PropTypes.number,
74+
style: PropTypes.object
7275
};
7376

7477
ShaderCanvas.defaultProps = {

0 commit comments

Comments
 (0)