Skip to content

Commit

Permalink
feat: export navigation prop
Browse files Browse the repository at this point in the history
  • Loading branch information
WoLewicki committed Feb 26, 2021
1 parent cf41b3d commit 9e343e6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions TestsExample/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ PODS:
- React
- RNReanimated (1.13.1):
- React
- RNScreens (2.17.1):
- RNScreens (2.18.0):
- React-Core
- RNSearchBar (3.5.1):
- React
Expand Down Expand Up @@ -506,7 +506,7 @@ SPEC CHECKSUMS:
RNCMaskedView: 5a8ec07677aa885546a0d98da336457e2bea557f
RNGestureHandler: 7a5833d0f788dbd107fbb913e09aa0c1ff333c39
RNReanimated: dd8c286ab5dd4ba36d3a7fef8bff7e08711b5476
RNScreens: b6c9607e6fe47c1b6e2f1910d2acd46dd7ecea3a
RNScreens: f0d7a2a440a8ba9f4574ca1ddb3368f473891be4
RNSearchBar: 9860431356b7d12a8449d2fddb2b5f3c78d1e99f
RNVectorIcons: bc69e6a278b14842063605de32bec61f0b251a59
Yoga: 7d13633d129fd179e01b8953d38d47be90db185a
Expand Down
7 changes: 5 additions & 2 deletions TestsExample/src/Test765.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import * as React from 'react';
import {
Button,
View,
} from 'react-native';
import {
createAppContainer,
} from 'react-navigation';

import createNativeStackNavigator, {NativeStackNavigationOptions} from 'react-native-screens/createNativeStackNavigator';
import createNativeStackNavigator, {NativeStackNavigationOptions, NativeStackNavigationProp} from 'react-native-screens/createNativeStackNavigator';

const DEFAULT_STACK_OPTIONS : NativeStackNavigationOptions
= {
Expand Down Expand Up @@ -85,9 +86,11 @@ function makeStacks() {

export default createAppContainer(makeStacks());

function Home() {
function Home({navigation}: {navigation: NativeStackNavigationProp}) {
return (
<View style={{ flex: 1, backgroundColor: 'red' }}>
<Button title="Go forward" onPress={() => navigation.navigate("Home5")} />
<Button title="Go back" onPress={() => navigation.goBack()} />
</View>
);
}
2 changes: 2 additions & 0 deletions src/createNativeStackNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ type NativeStackRemoveNavigationAction = {
key?: string;
};

export type NativeStackNavigationProp = StackNavigationProp;

export type NativeStackNavigationOptions = StackNavigatorOptions &
NativeStackNavigationOptionsV5 &
BackButtonProps & {
Expand Down

0 comments on commit 9e343e6

Please sign in to comment.