We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7e31608 commit 49c89d0Copy full SHA for 49c89d0
1 file changed
example/src/pages/ResponsiveLayouts.tsx
@@ -1,10 +1,11 @@
1
-import { useState, useRef } from 'react';
+import { useState, useRef, useEffect } from 'react';
2
import {
3
View,
4
Text,
5
StyleSheet,
6
Button,
7
ActivityIndicator,
8
+ useWindowDimensions,
9
} from 'react-native';
10
11
Fit,
@@ -20,6 +21,11 @@ export default function ResponsiveLayoutsExample() {
20
21
);
22
const [scaleFactor, setScaleFactor] = useState(4.0);
23
const riveRef = useRef<RiveViewRef>(null);
24
+ const { width, height } = useWindowDimensions();
25
+
26
+ useEffect(() => {
27
+ riveRef.current?.playIfNeeded();
28
+ }, [width, height]);
29
30
const increaseScale = () => {
31
setScaleFactor((prev) => prev + 0.5);
0 commit comments