Skip to content

Commit dcb4f0a

Browse files
committed
chore: best to not create listener before js bridge being ready
1 parent 81ccbe2 commit dcb4f0a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/react-native-sdk/src/hooks/useTrackDimensions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import {
55
import { useEffect, useState } from 'react';
66
import { NativeEventEmitter, NativeModules } from 'react-native';
77

8-
const webRTCEventEmitter = new NativeEventEmitter(NativeModules.WebRTCModule);
9-
108
/**
119
* This is a utility hook to get the dimensions of the video track of the participant.
1210
* Note: the `tracktype` is used only for local participants.
@@ -67,6 +65,9 @@ export function useTrackDimensions(
6765
};
6866
});
6967

68+
const webRTCEventEmitter = new NativeEventEmitter(
69+
NativeModules.WebRTCModule,
70+
);
7071
const subscription = webRTCEventEmitter.addListener(
7172
'videoTrackDimensionChanged',
7273
handleVideoTrackDimensionChanged,

0 commit comments

Comments
 (0)