RNCNetinfo.getCurrentState got 3 arguments, expected 2
See original GitHub issueAsk your Question
I’m developing an app using RN CLI. My RN version is 0.62.2. When I’m trying to implement react-native-jitsi-meet
library, I’m getting this error message RNCNetinfo.getCurrentState got 3 arguments, expected 2
. Before implementing this library Netinfo was working absolutely fine. Only occurring when I’m include react-native-jitsi-meet
. If i exclude the NetInfo code from my component jitsi meet started working. But I need both of them in my application. Can anyone point me out what I’m missing!
Note: my minSdkVersion is 21.
And my dependencies are:
```
“dependencies”: { “@expo/vector-icons”: “^10.2.0”, “@react-native-community/async-storage”: “^1.10.3”, “@react-native-community/checkbox”: “^0.4.1”, “@react-native-community/masked-view”: “^0.1.10”, “@react-native-community/netinfo”: “^5.9.0”, “@react-native-community/picker”: “^1.6.1”, “@react-navigation/bottom-tabs”: “^5.5.1”, “@react-navigation/drawer”: “^5.8.1”, “@react-navigation/native”: “^5.5.0”, “@react-navigation/stack”: “^5.4.1”, “native-base”: “^2.13.12”, “react”: “16.11.0”, “react-native”: “0.62.2”, “react-native-gesture-handler”: “^1.6.1”, “react-native-jitsi-meet”: “^2.1.1”, “react-native-linear-gradient”: “^2.5.6”, “react-native-loading-spinner-overlay”: “^1.1.0”, “react-native-reanimated”: “^1.9.0”, “react-native-responsive-screen”: “^1.4.1”, “react-native-safe-area-context”: “^3.0.2”, “react-native-screens”: “^2.8.0”, “react-native-snap-carousel”: “^3.9.1”, “react-native-sweet-alert”: “^2.1.0”, “react-native-vector-icons”: “^6.6.0”, “react-native-webview”: “^10.2.3”, “realm”: “^6.0.2” },
One of my component:
// packages
import React, { useContext, useEffect, useState } from 'react';
import { Image, StyleSheet, Text, View } from 'react-native';
import { AuthContext } from './context';
// third party libraries
import { Button, Root } from 'native-base';
import Feather from 'react-native-vector-icons/Feather';
import McIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import NetInfo from "@react-native-community/netinfo";
import SpinnerOverlay from 'react-native-loading-spinner-overlay';
import AsyncStorage from '@react-native-community/async-storage';
import LinearGradient from 'react-native-linear-gradient';
import {
widthPercentageToDP as wp,
heightPercentageToDP as hp,
listenOrientationChange as lor,
removeOrientationListener as rol
} from 'react-native-responsive-screen';
// @TODO: This is to hide a Warning caused by NativeBase after upgrading to RN 0.62
import { YellowBox } from 'react-native';
YellowBox.ignoreWarnings([
'Animated: `useNativeDriver` was not specified. This is a required option and must be explicitly set to `true` or `false`',
]);
// ------- END OF WARNING SUPPRESSION
// assets and components
import defaultImage from './../assets/avatar-default.png';
export const DashboardScreen = ({ navigation }) => {
const [student_details, setStudentDetails] = useState([]);
const [isLoading, setIsLoading] = useState(false);
const [site_url, setSiteUrl] = useState('');
const { signOut } = useContext(AuthContext);
useEffect(() => {
lor();
setIsLoading(true);
// checking ineternet connectivity
NetInfo.fetch().then(state => {
if (state.isConnected && state.isInternetReachable) {
let getStudentDetails = async () => {
const userToken = await AsyncStorage.getItem('user_token');
const siteUrl = await AsyncStorage.getItem('site_url');
setSiteUrl(siteUrl);
// sending an api request to get student details
let studentDetailsResponse = await fetch(siteUrl + "/api/student_module/get_student_details", {
method: 'GET',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + userToken
}
});
// processing the api request
let studentDetailsJson = await studentDetailsResponse.json();
if (studentDetailsJson.status == 'success') {
setIsLoading(false);
setStudentDetails(studentDetailsJson.student_details);
} else if (studentDetailsJson.status == 'token_error') {
setIsLoading(false);
signOut();
} else if (studentDetailsJson.error == 'token_expired') {
setIsLoading(false);
signOut();
} else {
setIsLoading(false);
Toast.show({
text: studentDetailsJson.message,
buttonText: "Okay",
type: "warning",
duration: 30000
});
}
}
getStudentDetails();
} else {
setIsLoading(false);
Toast.show({
text: 'No internet connection!',
buttonText: "Okay",
type: "warning",
duration: 30000
});
}
});
return () => {
rol();
};
}, []);
const onlinePayment = () => {
navigation.navigate('OnlinePayment');
}
const homework = () => {
navigation.navigate('Homework');
}
const syllabus = () => {
navigation.navigate('Syllabus');
}
const onlineClassroom = () => {
navigation.navigate('OnlineClass');
}
const styles = StyleSheet.create({
header: {
paddingTop: hp("3%"),
height: hp("32%"),
borderBottomLeftRadius: 20,
borderBottomRightRadius: 20,
backgroundColor: "#ff3542"
},
dashboardText: {
color: "#FFFFFF",
fontSize: 20,
fontWeight: 'bold',
alignSelf: 'center'
},
dashboardView: {
marginLeft: 'auto',
marginRight: 'auto',
marginTop: -40,
paddingLeft: wp("5%"),
paddingRight: wp("5%"),
width: '85%',
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-around',
flexWrap: 'wrap',
},
menuView: {
display: 'flex',
flexDirection: 'column'
},
dashboardCategory: {
height: 80,
width: 80,
borderRadius: 5,
elevation: 5,
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
backgroundColor: '#FFFFFF'
},
iconStyle: {
color: 'grey',
fontSize: 35
},
buttonText: {
marginTop: 10,
paddingBottom: hp("2%"),
color: '#4b2e80',
width: '100%',
textAlign:'center',
fontSize: wp("3.9%")
},
defaultImage: {
marginTop: hp("3%"),
borderRadius: 50,
width: hp("10%"),
height: hp("10%"),
marginRight: hp("2%"),
marginLeft: wp("12%")
},
studnetDetailsWrapper: {
marginTop: hp("1.7%"),
display: 'flex',
flexDirection: 'row',
alignItems: 'center'
},
studentDetailsView: {
marginTop: hp("3%"),
paddingLeft: wp("4%")
}
});
return (
<Root>
<SpinnerOverlay
visible={isLoading}
textContent={'Getting Student Details...'}
textStyle={styles.spinnerTextStyle}
/>
<LinearGradient
start={{x: 0, y: 0}}
end={{x: 1, y: 0}}
colors={['#ff1a29', '#ff3542', '#ff4d58', '#ff8088']}
style={styles.header}>
<Button
transparent
style={{ position: 'absolute', left: wp("5%"), top: hp("1.8%") }}
onPress={() => navigation.openDrawer()}>
<Feather style={{ color: '#FFFFFF' }} name="menu" size={28} />
</Button>
<Text style={styles.dashboardText}>DASHBOARD</Text>
<View style={styles.studnetDetailsWrapper}>
{student_details.profile_image ? <Image source={{ uri: site_url + "/img/StudentPicture/" + student_details.profile_image }} style={styles.defaultImage} /> : <Image source={ defaultImage } style={styles.defaultImage} /> }
<View style={{ marginTop: hp("4%"), borderLeftWidth: 2, width: 2, height: 35, borderColor: "#FFFFFF" }}></View>
<View style={styles.studentDetailsView}>
<Text style={{ color: "#FFFFFF", fontWeight: 'bold', fontSize: hp("2.1%") }}>
{student_details.student_name}
</Text>
<View>
<Text style={{ color: "#FFFFFF", fontWeight: 'bold', fontSize: hp("1.9%"), marginTop: hp("0.2%") }}>
Class: {(typeof student_details.class_info !== 'undefined' && typeof student_details.class_info.ClassName !== 'undefined') ? student_details.class_info.ClassName : '-'} | Roll: {student_details.roll_no}
</Text>
<Text style={{ color: "#FFFFFF", fontWeight: 'bold', fontSize: hp("1.9%"), marginTop: hp("0.2%") }}>
Section: {(typeof student_details.section !== 'undefined' && typeof student_details.section.SectionName !== 'undefined') ? student_details.section.SectionName : '-'} | Group: {(typeof student_details.group !== 'undefined' && typeof student_details.group.GroupName !== 'undefined') ? student_details.group.GroupName : '-'}
</Text>
</View>
</View>
</View>
</LinearGradient>
<View style={styles.dashboardView}>
<View style={styles.menuView}>
<Button light style={styles.dashboardCategory} onPress={homework}>
<Feather style={styles.iconStyle} name="book" size={25} />
</Button>
<Text style={styles.buttonText}> Homework </Text>
</View>
<View>
<Button light style={styles.dashboardCategory} onPress={syllabus}>
<Feather style={styles.iconStyle} name="book-open" size={25} />
</Button>
<Text style={styles.buttonText}> Syllabus </Text>
</View>
<View>
<Button light style={styles.dashboardCategory} onPress={onlinePayment}>
<Feather style={styles.iconStyle} name='dollar-sign' size={25} />
</Button>
<Text style={styles.buttonText}> Pay Online </Text>
</View>
<View>
<Button light style={styles.dashboardCategory} onPress={onlineClassroom}>
<McIcons style={styles.iconStyle} name='google-classroom' size={25} />
</Button>
<Text style={styles.buttonText}> Online Class </Text>
</View>
</View>
</Root>
)
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
How is this a netinfo problem? This is a react-native-jitsi-meet problem. I looked at their repo. I like the idea of jitse-meet theoretically but their repo doesn’t look like a real react-native project, they should reference netinfo as a dependency and let you update it so you don’t have a version conflict.
Until then you need to find out whatever they’re bundling and use that I guess
You will have to take it up with them though
jitsi-meet is currently using
react-native-netinfo
v4.1.5
, You want to usev5.9.0
So can you downgrade your netinfo package to
v5.0.0
?