Skip to content

Commit 3246673

Browse files
committed
chore: remove experimental isRiveReady
1 parent 2c7d52b commit 3246673

3 files changed

Lines changed: 11 additions & 25 deletions

File tree

example/app/(examples)/DataBinding.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,22 @@ import Rive, {
1111
RiveRef,
1212
useRiveColor,
1313
useRiveNumber,
14-
useRiveReady,
1514
useRiveString,
1615
} from 'rive-react-native';
1716

1817
export default function DataBinding() {
1918
const riveRef = React.useRef<RiveRef>(null);
20-
const riveIsReady = useRiveReady(riveRef);
2119

2220
let [buttonText, setButtonText] = useRiveString(riveRef, 'Button/State_1');
2321
let [lives, setLives] = useRiveNumber(riveRef, 'Energy_Bar/Lives');
2422
let [barColor, setBarColor] = useRiveColor(riveRef, 'Energy_Bar/Bar_Color');
2523

2624
useEffect(() => {
27-
if (riveIsReady) {
28-
// Set initial values through hooks
29-
setButtonText("Let's go!");
30-
setLives(7);
31-
setBarColor({ r: 0, g: 255, b: 0, a: 255 });
32-
}
33-
}, [riveIsReady, setButtonText, setLives, setBarColor]);
25+
// Set initial values through hooks
26+
setButtonText("Let's go!");
27+
setLives(7);
28+
setBarColor({ r: 0, g: 255, b: 0, a: 255 });
29+
}, [setButtonText, setLives, setBarColor]);
3430

3531
console.log('Button Text:', buttonText);
3632
console.log('Lives:', lives);

src/Rive.tsx

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,6 @@ export class RivePropertyValueEmitter {
132132
}
133133
}
134134

135-
export function useRiveReady(riveRef: React.RefObject<RiveRef>): boolean {
136-
const [ready, setReady] = useState(false);
137-
138-
useEffect(() => {
139-
if (riveRef.current) {
140-
setReady(true);
141-
}
142-
}, [riveRef]);
143-
144-
return ready;
145-
}
146-
147135
export function useRiveBoolean(
148136
riveRef: React.RefObject<RiveRef>,
149137
path: string
@@ -296,8 +284,12 @@ function useRivePropertyListener<T>(
296284
return [value, setPropertyValue];
297285
}
298286

299-
const { RiveReactNativeRendererModule, RiveReactNativeModule } = NativeModules;
300-
const nativeEventEmitter = new NativeEventEmitter(RiveReactNativeModule);
287+
const {
288+
RiveReactNativeRendererModule,
289+
RiveReactNativeModule,
290+
RiveReactNativeEventModule,
291+
} = NativeModules;
292+
const nativeEventEmitter = new NativeEventEmitter(RiveReactNativeEventModule);
301293

302294
export const RiveRenderer =
303295
RiveReactNativeRendererModule as RiveRendererInterface;

src/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
export * from './types';
22
import Rive, {
33
RiveRenderer,
4-
useRiveReady,
54
useRiveString,
65
useRiveNumber,
76
useRiveBoolean,
@@ -11,7 +10,6 @@ import Rive, {
1110

1211
export {
1312
RiveRenderer,
14-
useRiveReady,
1513
useRiveString,
1614
useRiveNumber,
1715
useRiveBoolean,

0 commit comments

Comments
 (0)