Skip to content

Commit 53596f7

Browse files
committed
SvgMask now uses react-native.dimensions to set initial dimensions
1 parent 6f9636b commit 53596f7

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/components/SvgMask.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ import {
44
View,
55
Animated,
66
Easing,
7+
Dimensions,
78
} from 'react-native';
89
// import { Svg } from 'expo';
910
import Svg from 'react-native-svg';
1011
import AnimatedSvgPath from './AnimatedPath';
1112

1213
import type { valueXY } from '../types';
1314

15+
const windowDimensions = Dimensions.get('window');
1416
const path = (size, position, canvasSize): string => `M0,0H${canvasSize.x}V${canvasSize.y}H0V0ZM${position.x._value},${position.y._value}H${position.x._value + size.x._value}V${position.y._value + size.y._value}H${position.x._value}V${position.y._value}Z`;
1517

1618
type Props = {
@@ -38,7 +40,10 @@ class SvgMask extends Component<Props, State> {
3840
super(props);
3941

4042
this.state = {
41-
canvasSize: null,
43+
canvasSize: {
44+
x: windowDimensions.width,
45+
y: windowDimensions.height,
46+
},
4247
size: new Animated.ValueXY(props.size),
4348
position: new Animated.ValueXY(props.position),
4449
};
@@ -104,7 +109,7 @@ class SvgMask extends Component<Props, State> {
104109
/>
105110
</Svg>
106111
)
107-
: null
112+
: null
108113
}
109114
</View>
110115
);

0 commit comments

Comments
 (0)