Commit 75320a0
committed
Fix issue when emptying nav stack on Windows (#1890)
## Description
When using a `StackNavigator` on an app on Windows, when you popped the
stack you would end up with no displayed content instead of the first
page.
## Changes
The Windows stack implementation wasn't updating `Content` to the top of
the stack (after the removal and motification of the vector).
Also the Windows project had an aggressive assertion of SDK version,
causing apps to unnecessarily either download an older SDK or patch
their app. See
react-native-async-storage/async-storage#810 for
a similar fix.
## Test code and steps to reproduce
```jsx
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
// ,,,
const Stack = createNativeStackNavigator();
export default function App() : JSX.Element {
return (
<NavigationContainer>
<Stack.Navigator initialRouteName='Home'>
<Stack.Screen name='Home' component={HomeScreen} />
<Stack.Screen name='Details' component={DetailsScreen} />
</Stack.Navigator>
</NavigationContainer>
);
}
```
Somewhere else
```jsx
navigation.navigate('Details');
```
And then later
```jsx
navigation.goBack();
```
Result: rendering nothing instead of the 'Home' page.
Yep, that's all it took. As far as I can tell this was broken since
implementation, but the usage I know of on Windows was using Drawer and
that part's all fine.
## Checklist
- [x] Included code example that can be used to test this change
- [x] Updated TS types **N/A**
- [x] Updated documentation: **N/A**
- [x] Ensured that CI passes **No tests on Windows :'(**
- [x] _Tested via patch-packing in an app_1 parent fded766 commit 75320a0
File tree
3 files changed
+23
-3
lines changed- windows/RNScreens
3 files changed
+23
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | 16 | | |
19 | | - | |
20 | 17 | | |
21 | 18 | | |
22 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
48 | 64 | | |
49 | 65 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
0 commit comments