@granite-js/react-native 0.1.23-next.8 → 0.1.23-next.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @granite-js/react-native
|
|
2
2
|
|
|
3
|
+
## 0.1.23-next.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- tollback
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @granite-js/plugin-core@0.1.23-next.9
|
|
10
|
+
- @granite-js/style-utils@0.1.23-next.9
|
|
11
|
+
- @granite-js/lottie@0.1.23-next.9
|
|
12
|
+
- @granite-js/native@0.1.23-next.9
|
|
13
|
+
- @granite-js/image@0.1.23-next.9
|
|
14
|
+
- @granite-js/mpack@0.1.23-next.9
|
|
15
|
+
- @granite-js/jest@0.1.23-next.9
|
|
16
|
+
- @granite-js/cli@0.1.23-next.9
|
|
17
|
+
|
|
3
18
|
## 0.1.23-next.8
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export declare function CanGoBackGuard({ children, canGoBack, onBack,
|
|
2
|
+
export declare function CanGoBackGuard({ children, canGoBack, onBack, setIosSwipeGestureEnabled, }: {
|
|
3
3
|
canGoBack: boolean;
|
|
4
|
-
isInitialScreen: boolean;
|
|
5
4
|
children: ReactNode;
|
|
6
5
|
onBack?: () => void;
|
|
7
6
|
setIosSwipeGestureEnabled?: ({ isEnabled }: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@granite-js/react-native",
|
|
3
|
-
"version": "0.1.23-next.
|
|
3
|
+
"version": "0.1.23-next.9",
|
|
4
4
|
"description": "The Granite Framework",
|
|
5
5
|
"bin": {
|
|
6
6
|
"granite": "./bin/cli.js"
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@babel/core": "^7.24.9",
|
|
87
87
|
"@babel/preset-env": "^7.24.8",
|
|
88
88
|
"@babel/preset-typescript": "^7.24.7",
|
|
89
|
-
"@granite-js/native": "0.1.23-next.
|
|
89
|
+
"@granite-js/native": "0.1.23-next.9",
|
|
90
90
|
"@testing-library/dom": "^10.4.0",
|
|
91
91
|
"@testing-library/react": "^16.1.0",
|
|
92
92
|
"@types/babel__core": "^7",
|
|
@@ -105,20 +105,20 @@
|
|
|
105
105
|
"vitest": "^2.1.8"
|
|
106
106
|
},
|
|
107
107
|
"peerDependencies": {
|
|
108
|
-
"@granite-js/native": "0.1.23-next.
|
|
108
|
+
"@granite-js/native": "0.1.23-next.9",
|
|
109
109
|
"@types/react": "*",
|
|
110
110
|
"brick-module": "*",
|
|
111
111
|
"react": "*",
|
|
112
112
|
"react-native": "*"
|
|
113
113
|
},
|
|
114
114
|
"dependencies": {
|
|
115
|
-
"@granite-js/cli": "0.1.23-next.
|
|
116
|
-
"@granite-js/image": "0.1.23-next.
|
|
117
|
-
"@granite-js/jest": "0.1.23-next.
|
|
118
|
-
"@granite-js/lottie": "0.1.23-next.
|
|
119
|
-
"@granite-js/mpack": "0.1.23-next.
|
|
120
|
-
"@granite-js/plugin-core": "0.1.23-next.
|
|
121
|
-
"@granite-js/style-utils": "0.1.23-next.
|
|
115
|
+
"@granite-js/cli": "0.1.23-next.9",
|
|
116
|
+
"@granite-js/image": "0.1.23-next.9",
|
|
117
|
+
"@granite-js/jest": "0.1.23-next.9",
|
|
118
|
+
"@granite-js/lottie": "0.1.23-next.9",
|
|
119
|
+
"@granite-js/mpack": "0.1.23-next.9",
|
|
120
|
+
"@granite-js/plugin-core": "0.1.23-next.9",
|
|
121
|
+
"@granite-js/style-utils": "0.1.23-next.9",
|
|
122
122
|
"es-toolkit": "^1.39.8",
|
|
123
123
|
"react-native-url-polyfill": "1.3.0"
|
|
124
124
|
}
|
package/src/router/Router.tsx
CHANGED
|
@@ -7,16 +7,7 @@ import {
|
|
|
7
7
|
RouteProp,
|
|
8
8
|
} from '@granite-js/native/@react-navigation/native';
|
|
9
9
|
import { NativeStackNavigationOptions } from '@granite-js/native/@react-navigation/native-stack';
|
|
10
|
-
import {
|
|
11
|
-
ComponentProps,
|
|
12
|
-
ComponentType,
|
|
13
|
-
Fragment,
|
|
14
|
-
PropsWithChildren,
|
|
15
|
-
ReactElement,
|
|
16
|
-
useCallback,
|
|
17
|
-
useMemo,
|
|
18
|
-
useState,
|
|
19
|
-
} from 'react';
|
|
10
|
+
import { ComponentProps, ComponentType, Fragment, PropsWithChildren, ReactElement, useCallback, useMemo } from 'react';
|
|
20
11
|
import { InitialProps } from '..';
|
|
21
12
|
import { closeView } from '../native-modules';
|
|
22
13
|
import { BackButton } from './components/BackButton';
|
|
@@ -172,23 +163,9 @@ export function Router({
|
|
|
172
163
|
[canGoBack, defaultScreenOption, headerLeft]
|
|
173
164
|
);
|
|
174
165
|
|
|
175
|
-
const [isInitialScreen, setIsInitialScreen] = useState(true);
|
|
176
|
-
|
|
177
166
|
return (
|
|
178
|
-
<NavigationContainer
|
|
179
|
-
|
|
180
|
-
setIsInitialScreen(state ? state?.index === 0 : true);
|
|
181
|
-
}}
|
|
182
|
-
ref={ref}
|
|
183
|
-
{...navigationContainerProps}
|
|
184
|
-
linking={linkingOptions}
|
|
185
|
-
>
|
|
186
|
-
<CanGoBackGuard
|
|
187
|
-
canGoBack={canGoBack}
|
|
188
|
-
isInitialScreen={isInitialScreen}
|
|
189
|
-
onBack={onBack}
|
|
190
|
-
setIosSwipeGestureEnabled={setIosSwipeGestureEnabled}
|
|
191
|
-
>
|
|
167
|
+
<NavigationContainer ref={ref} {...navigationContainerProps} linking={linkingOptions}>
|
|
168
|
+
<CanGoBackGuard canGoBack={canGoBack} onBack={onBack} setIosSwipeGestureEnabled={setIosSwipeGestureEnabled}>
|
|
192
169
|
<Container {...initialProps}>
|
|
193
170
|
<StackNavigator.Navigator initialRouteName={initialRouteName} screenOptions={screenOptions}>
|
|
194
171
|
{Screens}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { ReactNode, useEffect } from 'react';
|
|
2
2
|
import { BackHandler } from 'react-native';
|
|
3
|
+
import { useIsInitialScreen } from '../hooks/useIsInitialScreen';
|
|
3
4
|
|
|
4
5
|
export function CanGoBackGuard({
|
|
5
6
|
children,
|
|
6
7
|
canGoBack,
|
|
7
8
|
onBack,
|
|
8
|
-
isInitialScreen,
|
|
9
9
|
setIosSwipeGestureEnabled,
|
|
10
10
|
}: {
|
|
11
11
|
canGoBack: boolean;
|
|
12
|
-
isInitialScreen: boolean;
|
|
13
12
|
children: ReactNode;
|
|
14
13
|
onBack?: () => void;
|
|
15
14
|
setIosSwipeGestureEnabled?: ({ isEnabled }: { isEnabled: boolean }) => void;
|
|
16
15
|
}) {
|
|
16
|
+
const isInitialScreen = useIsInitialScreen();
|
|
17
|
+
|
|
17
18
|
const shouldBlockGoingBack = !canGoBack;
|
|
18
19
|
|
|
19
20
|
useEffect(() => {
|