Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
@jkottnauer/react-native-router-flux
Advanced tools
React Native Router using Flux architecture
Router for React Native based on new React Native Navigation API.
react-native-router-flux
is a routing package that allows you to:
Actions.login({username, password})
or Actions.profile({profile})
or even Actions.profile(123)
- all params will be part of this.props
for given Scene component).Highly Customizable Navigation Bar - Show/hide the navbar depending on Scene or even the state of a Scene (e.g. Edit/Save navbar for edit mode).
Tab Bar Support using react-native-tabs (see Example app).
Nested Navigators (e.g. Each tab can have its own navigator, nested in a root navigator).
Custom Scene Renderers for action sheet, native TabBarIOS or anything else. See built-in Modal
renderer (to display popups) for example. Call for PRs! let's build some custom renderers for ActionSheet, Drawer, etc. Let's make an awesome library! Currently, if you want to use Action Sheets you'll need to use a 3rd party module.
Dynamic Routing allows you to choose which scene to render depending on application state (see the Switch
renderer, useful for authentication).
Bring Your Own Reducer for navigation state.
Reset History Stack - The new reset
type for clearing the history stack and eliminating the navbar back button.
More Powerful State Control - Support for having different states while on the same screen. For example, "View My Account" could allow in-place editing of fields and "Save", "Cancel" navigation bar buttons should appear.
Check out the mini-tutorial for a quick walkthrough of the routing system.
While ExperimentalNavigation API is not stable, RNRF uses separated fork of ExperimentalNavigation API to avoid dependency from React Native version. So 3.30 version of RNRF doesn't depend from React Native version, but from that fork (now it is based on 0.26 API). You could use this component with RN0.26+
npm i react-native-router-flux --save
In your top-level index.js
, define your scenes using the Scene
component and pass it into the Router
as children:
import {Scene, Router} from 'react-native-router-flux';
class App extends React.Component {
render() {
return <Router>
<Scene key="root">
<Scene key="login" component={Login} title="Login"/>
<Scene key="register" component={Register} title="Register"/>
<Scene key="home" component={Home}/>
</Scene>
</Router>
}
}
Alternatively, you could define all of your scenes during compile time and use it later within Router
:
import {Actions, Scene, Router} from 'react-native-router-flux';
const scenes = Actions.create(
<Scene key="root">
<Scene key="login" component={Login} title="Login"/>
<Scene key="register" component={Register} title="Register"/>
<Scene key="home" component={Home}/>
</Scene>
);
/* ... */
class App extends React.Component {
render() {
return <Router scenes={scenes}/>
}
}
On any Scene, you can also call the following functions by first importing the Actions
object:
import {Actions} from 'react-native-router-flux'
And then:
Actions.ACTION_NAME(PARAMS)
will call the appropriate action and params will be passed to the scene.Actions.pop()
will pop the current screen. It accepts following optional params:
{popNum: [number]}
allows to pop multiple screens at once{refresh: {...propsToSetOnPreviousScene}}
allows to refresh the props of the scene that it pops back toActions.refresh(PARAMS)
will update the properties of the current screen.Thanks to all who submitted PRs to 2.x release. If you like the component and want to support it, feel free to donate any amount or help with issues.
FAQs
React Native Router using Flux architecture
We found that @jkottnauer/react-native-router-flux demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.