Skip to content

Commit a467f2e

Browse files
feat: add netinfo check in network screen
1 parent d805965 commit a467f2e

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [Unreleased](https://github.com/Instabug/Instabug-React-Native/compare/v14.1.0...dev)
4+
5+
## Fixed
6+
7+
- Intercept incomplete network Requests ([#1365](https://github.com/Instabug/Instabug-React-Native/pull/1365))
8+
9+
310
## [14.1.0](https://github.com/Instabug/Instabug-React-Native/compare/v14.0.0...v14.1.0) (January 2, 2025)
411

512
### Added

examples/default/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
},
1212
"dependencies": {
1313
"@react-native-clipboard/clipboard": "^1.14.3",
14+
"@react-native-community/netinfo": "^11.4.1",
1415
"@react-native-community/slider": "^4.5.5",
1516
"@react-navigation/bottom-tabs": "^6.5.7",
1617
"@react-navigation/native": "^6.1.6",

examples/default/src/screens/apm/NetworkScreen.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ import axios from 'axios';
1111
import type { HomeStackParamList } from '../../navigation/HomeStack';
1212
import type { NativeStackScreenProps } from '@react-navigation/native-stack';
1313
import { ListTile } from '../../components/ListTile';
14+
import { useNetInfo } from '@react-native-community/netinfo';
1415

1516
export const NetworkScreen: React.FC<
1617
NativeStackScreenProps<HomeStackParamList, 'NetworkTraces'>
1718
> = ({ navigation }) => {
1819
const [endpointUrl, setEndpointUrl] = useState('');
1920
const { width, height } = useWindowDimensions();
21+
22+
const { isConnected } = useNetInfo();
23+
2024
const defaultRequestUrl = 'https://jsonplaceholder.typicode.com/posts/1';
2125
const imageUrls = [
2226
'https://fastly.picsum.photos/id/57/200/300.jpg?hmac=l908G1qVr4r7dP947-tak2mY8Vvic_vEYzCXUCKKskY',
@@ -129,6 +133,7 @@ export const NetworkScreen: React.FC<
129133
/>
130134
<CustomButton onPress={() => refetch} title="Reload GraphQL" />
131135
<View>
136+
<Text>{isConnected ? 'Network is Connected' : 'Network is not connected'}</Text>
132137
{isLoading && <Text>Loading...</Text>}
133138
{isSuccess && <Text>GraphQL Data: {data.country.emoji}</Text>}
134139
{isError && <Text>Error!</Text>}

examples/default/yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,6 +2041,11 @@
20412041
prompts "^2.4.2"
20422042
semver "^7.5.2"
20432043

2044+
"@react-native-community/netinfo@^11.4.1":
2045+
version "11.4.1"
2046+
resolved "https://registry.yarnpkg.com/@react-native-community/netinfo/-/netinfo-11.4.1.tgz#a3c247aceab35f75dd0aa4bfa85d2be5a4508688"
2047+
integrity sha512-B0BYAkghz3Q2V09BF88RA601XursIEA111tnc2JOaN7axJWmNefmfjZqw/KdSxKZp7CZUuPpjBmz/WCR9uaHYg==
2048+
20442049
"@react-native-community/slider@^4.5.5":
20452050
version "4.5.5"
20462051
resolved "https://registry.yarnpkg.com/@react-native-community/slider/-/slider-4.5.5.tgz#d70fc5870477760033769bbd6625d57e7d7678b2"

0 commit comments

Comments
 (0)