Skip to content

Commit fb2f553

Browse files
authored
Merge pull request #7 from EconomistDigitalSolutions/fixRotationBug
fix: orientation bug
2 parents bfe62cd + ce6e5d6 commit fb2f553

File tree

5 files changed

+23
-25
lines changed

5 files changed

+23
-25
lines changed

src/dots/ExpandingDot.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import React from 'react';
22
import {
3-
View,
4-
Dimensions,
53
Animated,
64
StyleSheet,
5+
useWindowDimensions,
6+
View,
77
ViewStyle,
88
} from 'react-native';
9-
109
export interface ExpandingDotProps {
1110
data: Array<Object>;
1211
scrollX: Animated.Value;
@@ -18,8 +17,6 @@ export interface ExpandingDotProps {
1817
activeDotColor?: string;
1918
}
2019

21-
const { width } = Dimensions.get('screen');
22-
2320
const ExpandingDot = ({
2421
scrollX,
2522
data,
@@ -30,6 +27,8 @@ const ExpandingDot = ({
3027
expandingDotWidth,
3128
activeDotColor,
3229
}: ExpandingDotProps) => {
30+
const { width } = useWindowDimensions();
31+
3332
const defaultProps = {
3433
inActiveDotColor: inActiveDotColor || '#000',
3534
inActiveDotOpacity: inActiveDotOpacity || 0.5,

src/dots/LiquidLike.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import React from 'react';
22
import {
3-
View,
43
Animated,
5-
Dimensions,
6-
ViewStyle,
74
StyleSheet,
5+
useWindowDimensions,
6+
View,
7+
ViewStyle,
88
} from 'react-native';
99
import { Line, Svg } from 'react-native-svg';
10-
1110
export interface LiquidLikeProps {
1211
data: Array<Object>;
1312
scrollX: Animated.Value;
@@ -26,7 +25,6 @@ export interface LiquidLikeProps {
2625

2726
const AnimatedLine = Animated.createAnimatedComponent(Line);
2827
const AnimatedSvg = Animated.createAnimatedComponent(Svg);
29-
const { width } = Dimensions.get('screen');
3028
const LiquidLike = ({
3129
scrollX,
3230
data,
@@ -42,6 +40,8 @@ const LiquidLike = ({
4240
strokeWidth,
4341
bigHeadScale,
4442
}: LiquidLikeProps) => {
43+
const { width } = useWindowDimensions();
44+
4545
const defaultProps = {
4646
dotSize: dotSize || 12,
4747
marginHorizontal: marginHorizontal || 6,

src/dots/ScalingDot.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import React from 'react';
22
import {
3-
View,
4-
Dimensions,
53
Animated,
64
StyleSheet,
5+
useWindowDimensions,
6+
View,
77
ViewStyle,
88
} from 'react-native';
9-
109
export interface ScalingDotProps {
1110
data: Array<Object>;
1211
scrollX: Animated.Value;
@@ -18,8 +17,6 @@ export interface ScalingDotProps {
1817
activeDotColor?: string;
1918
}
2019

21-
const { width } = Dimensions.get('screen');
22-
2320
const ScalingDot = ({
2421
scrollX,
2522
data,
@@ -30,6 +27,8 @@ const ScalingDot = ({
3027
activeDotScale,
3128
activeDotColor,
3229
}: ScalingDotProps) => {
30+
const { width } = useWindowDimensions();
31+
3332
const defaultProps = {
3433
inActiveDotColor: inActiveDotColor || '#347af0',
3534
activeDotColor: activeDotColor || '#347af0',

src/dots/SlidingBorder.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import React from 'react';
22
import {
3-
View,
4-
Dimensions,
5-
StyleSheet,
63
Animated,
4+
StyleSheet,
5+
useWindowDimensions,
6+
View,
77
ViewStyle,
88
} from 'react-native';
9-
109
export interface SlidingBorderProps {
1110
data: Array<Object>;
1211
scrollX: Animated.Value;
@@ -18,7 +17,6 @@ export interface SlidingBorderProps {
1817
slidingIndicatorStyle?: ViewStyle;
1918
}
2019

21-
const { width } = Dimensions.get('screen');
2220
const SlidingBorder = ({
2321
scrollX,
2422
data,
@@ -29,6 +27,8 @@ const SlidingBorder = ({
2927
slidingIndicatorStyle,
3028
borderPadding,
3129
}: SlidingBorderProps) => {
30+
const { width } = useWindowDimensions();
31+
3232
const defaultProps = {
3333
dotSize: dotSize || 24,
3434
borderPadding: borderPadding || -5,

src/dots/SlidingDot.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import React from 'react';
22
import {
3-
View,
4-
Dimensions,
5-
StyleSheet,
63
Animated,
4+
StyleSheet,
5+
useWindowDimensions,
6+
View,
77
ViewStyle,
88
} from 'react-native';
9-
109
export interface SlidingDotProps {
1110
data: Array<Object>;
1211
scrollX: Animated.Value;
@@ -18,7 +17,6 @@ export interface SlidingDotProps {
1817
marginHorizontal?: number;
1918
}
2019

21-
const { width } = Dimensions.get('screen');
2220
const SlidingDot = ({
2321
scrollX,
2422
data,
@@ -28,6 +26,8 @@ const SlidingDot = ({
2826
slidingIndicatorStyle,
2927
marginHorizontal,
3028
}: SlidingDotProps) => {
29+
const { width } = useWindowDimensions();
30+
3131
const defaultProps = {
3232
dotSize: dotSize || 12,
3333
marginHorizontal: marginHorizontal || 3,

0 commit comments

Comments
 (0)