New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-native-rnx

Package Overview
Dependencies
Maintainers
1
Versions
710
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-rnx

BerthX libs

latest
Source
npmnpm
Version
0.5.92
Version published
Weekly downloads
20
66.67%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-rnx

BerthX libs

Useful library package containing:

  • tab & stack navigation Provider + hook
  • translation hook
  • store hook (using react context, can be automatically persisted in LocalStorage if specified to Provider)
  • some UI components
  • some helpers

Installation

yarn add react-native-rnx

Also checkout the peerDependencies in package.json, it was tested only with these deps

Usage

// App.tsx
import {
  Router,
  initLocalization,
  useLocalization,
  createStateProvider,
} from 'react-native-rnx';

import en from '@localizations/en.json';
initLocalization({en});

import Routes from '@models/Routes';
import Home from '@screens/Home';
import Settings from '@screens/Settings';
import Feed from '@screens/Feed';
import NotificationsSettings from '@screens/NotificationsSettings';

interface GlobalState {
  username: string;
}

const App = () => {
  const {localize} = useLocalization();
  const [StateProvider] = useState(
    createStateProvider<GlobalState>({}, state => state, [
      'username', // If specied here, data will be persisted in local storage
    ]),
  );

  return (
    <StateProvider.Element>
      <Router
        tabs={{
          [Routes.Tab1]: {
            initial: Routes.Home,
            title: localize('tabs.1'),
            iconName: 'clock',
            screens: [
              {component: Home, name: Routes.Home},
            ],
          },
          [Routes.Tab2]: {
            initial: Routes.Explore,
            title: localize('tabs.2'),
            iconName: 'graduation-cap',
            screens: [
              {component: Feed, name: Routes.Feed},
            ],
          },
          [Routes.Tab3]: {
            initial: Routes.Settings,
            title: localize('tabs.3'),
            iconName: 'user',
            screens: [
              {component: Settings, name: Routes.Settings},
              {component: NotificationsSettings, name: Routes.NotificationsSettings},
            ],
          },
        }}
      />
    </StateProvider.Element>
  );
};

export default App;

How to use navigation hook

import {useNavigation} from '@react-navigation/native';
import Routes from '@models/Routes';

const Component = () => {
  const {navigate, goBack} = useNavigation();
  const notif = {data: 1};
  
  const navigateToNotifSettingsScreen = () => {
    navigate(Routes.NotificationsSettings, {notif});
  }
  
   const goBackInStack = () => {
      goBack();
   }
}
export default Component;

How to use store hook

import GlobalState from '@models/GlobalState';
import {useGlobalState} from 'react-native-rnx';

const Component = () => {
  const {globalState, setGlobalState} = useGlobalState<GlobalState>();
  const username = globalState.username;
  
  const updateUsername = (newVal: string) => {
    setGlobalState({username: newVal}); // This will be persist in localStorage because it was specifed in App.js
  }
}
export default Component;

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Keywords

react-native

FAQs

Package last updated on 27 Aug 2025

Did you know?

Socket

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.

Install

Related posts