Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

Commit 1cb7c2b

Browse files
author
RakaDoank
committed
Update example app
1 parent b4b9448 commit 1cb7c2b

4 files changed

Lines changed: 24 additions & 19 deletions

File tree

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"react": "19.0.0",
1616
"react-native": "0.78.0",
1717
"react-native-safe-area-context": "5.3.0",
18-
"react-native-screens": "^4.9.2"
18+
"react-native-screens": "4.10.0"
1919
},
2020
"devDependencies": {
2121
"@babel/core": "^7.25.2",

example/src/screens/ping-controller/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export function PingControllerScreen(): React.JSX.Element {
4949
ttl: Number(ref.current.ttl),
5050
// count: Number.POSITIVE_INFINITY,
5151
count: 64,
52-
interval: 1000,
5352
},
5453
)
5554

example/src/screens/ping-runner/index.tsx

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,28 @@ export function PingRunnerScreen({
4949
[data, setData] =
5050
useState<DataState[]>([]),
5151

52-
{ isRunning, result, start, stop }
53-
= useICMP()
52+
{ isRunning, result, start, stop } =
53+
useICMP({
54+
host: route.params.host,
55+
count: route.params.count,
56+
packetSize: route.params.packetSize,
57+
timeout: route.params.timeout,
58+
ttl: route.params.ttl,
59+
}),
5460

55-
const setVirtualizedListRef: React.RefCallback<VirtualizedList<ItemRendererData>>
56-
= useCallback(_ref => {
57-
ref.current.virtualizedList = _ref
58-
}, [])
61+
setVirtualizedListRef: React.RefCallback<VirtualizedList<ItemRendererData>> =
62+
useCallback(_ref => {
63+
ref.current.virtualizedList = _ref
64+
}, []),
5965

60-
const startHandler = useCallback(() => {
61-
console.log('startHandler: ', route.params)
62-
start(route.params!)
63-
}, [
64-
start,
65-
route.params,
66-
])
66+
startHandler =
67+
useCallback(() => {
68+
console.log('startHandler: ', route.params)
69+
start()
70+
}, [
71+
start,
72+
route.params,
73+
])
6774

6875
useEffect(() => {
6976
/**
@@ -115,7 +122,7 @@ export function PingRunnerScreen({
115122
const itemGetter: NonNullable<NonNullable<VirtualizedListProps<ItemRendererData>>['getItem']>
116123
= useCallback((_data, index) => {
117124
return {
118-
host: route.params!.host,
125+
host: route.params.host,
119126
...data[index],
120127
}
121128
}, [
@@ -266,5 +273,4 @@ const mapStatusToText: Record<number, string> = {
266273
[PingStatus.INVALID_ARG]: 'Invalid',
267274
[PingStatus.UNKNOWN_FAILURE]: 'Unknown Failure',
268275
[PingStatus.UNKNOWN_HOST]: 'Unknown Host',
269-
[PingStatus.CANCELLED]: 'Cancelled',
270276
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type {
2-
UseICMPStartParams,
2+
UseICMPProps,
33
} from 'react-native-ping-android'
44

55
export type Stacks = {
66
ping_controller?: never,
7-
ping_runner?: UseICMPStartParams,
7+
ping_runner: UseICMPProps,
88
}

0 commit comments

Comments
 (0)