im passing parameter from screen A to screen B
Screen A :
JavaScript
x
9
1
<Button
2
title="Go Next"
3
onPress={() =>
4
navigate('liveScreen', {
5
linkItem: this.state.link,
6
})
7
}
8
/>
9
Screen B :
JavaScript
1
49
49
1
import React, { useEffect } from 'react';
2
import JitsiMeet, { JitsiMeetView } from 'react-native-jitsi-meet';
3
4
function linkScreen() {
5
6
useEffect(() => {
7
setTimeout(() => {
8
const url = `https://meet.jit.si/${this.props.navigation.state.params.linkItem}`;
9
const userInfo = {
10
displayName: 'User',
11
email: 'user@example.com',
12
avatar: 'https:/gravatar.com/avatar/abc123',
13
};
14
JitsiMeet.call(url, userInfo);
15
}, 1000);
16
}, [])
17
18
useEffect(() => {
19
return () => {
20
JitsiMeet.endCall();
21
};
22
});
23
24
function onConferenceTerminated(nativeEvent) {
25
console.log(nativeEvent)
26
}
27
28
function onConferenceJoined(nativeEvent) {
29
console.log(nativeEvent)
30
}
31
32
function onConferenceWillJoin(nativeEvent) {
33
console.log(nativeEvent)
34
}
35
return (
36
<JitsiMeetView
37
onConferenceTerminated={e => onConferenceTerminated(e)}
38
onConferenceJoined={e => onConferenceJoined(e)}
39
onConferenceWillJoin={e => onConferenceWillJoin(e)}
40
style={{
41
flex: 1,
42
height: '100%',
43
width: '100%',
44
}}
45
/>
46
)
47
}
48
export default linkScreen;
49
but theres an error on screen B that say ‘undefined is not an object (evaluating ‘_this.props.navigation’)’
im using react-native-jitst-meet to create simple confrence app for class project. I really hope you guys can give the solution. Thankyou before
Advertisement
Answer
You are using a functional component. So you cant access it as this.props.navigation
First you have to add the props like below
JavaScript
1
2
1
function linkScreen({navigation}) {
2
Then you can access it like below
JavaScript
1
2
1
const url = `https://meet.jit.si/${navigation.state.params.linkItem}`;
2