Gathering detailed insights and metrics for react-simple-stack-navigation
Gathering detailed insights and metrics for react-simple-stack-navigation
Gathering detailed insights and metrics for react-simple-stack-navigation
Gathering detailed insights and metrics for react-simple-stack-navigation
react-native-enroute
Simple and fast React Native router based on react-enroute and native navigation
react-stack-nav
Simple navigation for React.
simple-react-navigation
Easy to setup stack navigation for react and react-native apps using Redux.
indie-expo-stack
A simple Expo template with navigation, testing, and linting setup.
Simple React Hook for handling screen navigations
npm install react-simple-stack-navigation
Typescript
Module System
Node Version
NPM Version
68.3
Supply Chain
98.8
Quality
74.9
Maintenance
100
Vulnerability
100
License
JavaScript (70.46%)
TypeScript (29.54%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
2 Stars
13 Commits
1 Watchers
13 Branches
1 Contributors
Updated on Sep 07, 2020
Minified
Minified + Gzipped
Latest Version
1.1.0
Package Id
react-simple-stack-navigation@1.1.0
Unpacked Size
17.90 kB
Size
4.83 kB
File Count
8
NPM Version
6.13.4
Node Version
12.14.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
I created this module for a simple prototyping I was working and I did not want to import a full featured navigation module while not necessary.
npm install react-simple-stack-navigation
This module exposes just 1 function: useNavigation
. It is a React hook that has what is needed to check the navigation stack and push/pop screens to it.
To exemplify its use, let's assume we have are developing a game and we current have 2 screens MainScreen
and HowToPlayScreen
, but the app still exhibits just the first one:
function App() {
return (
<MainScreen/>
);
}
function MainScreen() {
return (
<>
<h1>THE GAME</h1>
<button>How to play</button>
</>
);
}
function HowToPlayScreen() {
return (
<>
<h1>HOW TO PLAY</h1>
<button>Back</button>
</>
);
}
To add navigation between them, first we need to use our useNavigation
hook. We will use it in a top component to instantiate the first screen and pass the navigation methods to it:
import { useNavigation } from 'react-simple-stack-navigation';
function App() {
const { currentScreen, navigateTo, navigateBack } = useNavigation(MainScreen);
const { ScreenComponent } = currentScreen;
// We can pass additional props to our screen as usual.
return (
<ScreenComponent navigateTo={navigateTo} navigateBack={navigateBack} />
);
}
Then, in our screens, we can use navigateTo
and navigateBack
props to navigate between them.
function MainScreen({navigateTo}) {
return (
<>
<h1>THE GAME</h1>
<button onClick={() => navigateTo(HowToPlayScreen)}>How to play</button>
</>
);
}
function HowToPlayScreen({navigateBack}) {
return (
<>
<h1>HOW TO PLAY</h1>
<button onClick={navigateBack}>Back</button>
</>
);
}
When adding useNavigationReducer, we can specify a middleware that will run between navigation calls. This middleware can be used for sending analytics events on page changes, for example.
Let's add it to our app:
import { useNavigation } from 'react-simple-stack-navigation';
function navigationAnalyticsMiddleware(action, next) {
// sendEvent('page_view');
// If you want to prevent navigation, just do not call next(action) and return null.
return next(action);
}
function App() {
const { currentScreen, navigateTo, navigateBack } = useNavigation(MainScreen, {}, navigationAnalyticsMiddleware);
const { ScreenComponent } = currentScreen;
// We can pass additional props to our screen as usual.
return (
<ScreenComponent navigateTo={navigateTo} navigateBack={navigateBack} />
);
}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/11 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
28 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-05-05
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More