Skip to content

Commit d96bb86

Browse files
committed
Version 2 alpha is here but need a hard test
1 parent 9e1aede commit d96bb86

95 files changed

Lines changed: 12440 additions & 4210 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Set the global level navigation reference into the `NavigationContainer`
4343
```jsx
4444
import { isReadyRef, navigationRef } from "react-navigation-helpers";
4545

46-
React.useEffect(() => {
46+
useEffect((): any => {
4747
return () => (isReadyRef.current = false);
4848
}, []);
4949

@@ -53,7 +53,7 @@ React.useEffect(() => {
5353
isReadyRef.current = true;
5454
}}
5555
>
56-
{/* ... */}
56+
{/* Rest of your code */}
5757
</NavigationContainer>;
5858
```
5959

lib/NavigationService.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
import * as React from "react";
2-
import { NavigationContainerRef, StackActions } from "@react-navigation/native";
2+
import {
3+
createNavigationContainerRef,
4+
StackActions,
5+
} from "@react-navigation/native";
36

4-
export let isReadyRef = React.createRef<any>();
5-
export let navigationRef = React.createRef<NavigationContainerRef>();
7+
interface RefObject<T> {
8+
current: T | null;
9+
}
10+
11+
export let isReadyRef: RefObject<boolean> = React.createRef<any>();
12+
export let navigationRef = createNavigationContainerRef<any>();
613

714
export const navigate = (routeName: string, params?: any) => {
815
if (isReadyRef.current && navigationRef && navigationRef.current) {
@@ -39,9 +46,9 @@ export const popToTop = () => {
3946
}
4047
};
4148

42-
export const reset = (...args: any) => {
49+
export const reset = (params: any) => {
4350
if (isReadyRef.current && navigationRef && navigationRef.current) {
4451
// Perform navigation if the app has mounted
45-
navigationRef.current?.reset(...args);
52+
navigationRef.current?.reset(params);
4653
}
4754
};

0 commit comments

Comments
 (0)