npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rnn-copilot

v1.0.1

Published

An abstraction on top react-native-navigation with simplified, opinionated API

Downloads

23

Readme

rnn-copilot

An abstraction on top react-native-navigation with simplified, opinionated API

API

Components

App

A singleton that handles App actions

const app = new App()
  .withTopBar({noBorder: true, backButton: {icon: backIcon, color: 'black'}})
  .withLayout({componentBackgroundColor: 'grey'});

withStatusBar(statusBarOptions: OptionsStatusBar)

Set status bar options

withLayout(layoutOptions: OptionsLayout)

Set layout options

withTopBar(topBarOptions: OptionsTopBar)

Set top bar options

withBottomTabs(bottomTabsOptions: OptionsBottomTabs)

set bottom tabs options

withBottomTab(bottomTabOptions: OptionsBottomTab)

set bottom tab options

withOptions(options: Options)

Merge options with arbitrary set of options

clear()

Clear options

set()

Set options as default app style

Root

A singleton that handles Root actions

import {Root} from 'rnn-copilot';

Root.withBottomTab(...).withBottomTab(..).set();
// Or
Root.clear().withSingleStack('mainScreen').set();

withSingleStack(mainScreen: string | string[])

Set a single stack layout with a main screen or with a stack of screens

withBottomTab(bottomTab: BottomTab)

Add a single bottom tab to root layout

withProps(passProps?: object | object[])

Pass props to the main screen Pass an array of props in case you want to pass to a stack of screens

withOptions(options?: Options | Options[])

Pass options to the main screen Pass an array of options in case you want to pass to a stack of screens

clear()

Clear current layout settings in order to start a new one

set()

Set root with current layout configuration

changeTab(tabId: string)

Manually change selected tab

TopBar

import {TopBar} from 'rnn-copilot';

new TopBar().
  .withTitle('title', {color: 'red'})
  .withSubtitle(subtitle, {color: 'red'})
  .update();

update()

Executes RNN mergeOption API

withBackground(color?: string, options?: OptionsTopBar['background'])

Change top bar's background color. pass options for advanced configuration

withTitle(title: string, options)

Updates title text with support for passing customizable options

withSubtitle(subtitle: string, options)

Updates subtitle text with support for passing customizable options

withVisibility(visible: boolean)

Updates top bar visibility

withAnimation(animate: boolean)

Should next update be animated

withTransparency(transparent: boolean)

Toggle top bar transparency where content is drawn behind

withLeftButton(button: OptionsTopBarButton)

Add a single left button (pushes to existing buttons)

withLeftButtons(buttons: OptionsTopBarButton[])

Set multiple left buttons

withRightButton(button: OptionsTopBarButton)

Add a single right button (pushes to existing buttons)

withRightButtons(buttons: OptionsTopBarButton[])

Set multiple right buttons

setRightButton(buttonIndex: number, options: OptionsTopBarButton)

Update a specific right button

StatusBar

import {StatusBar} from 'rnn-copilot';

new StatusBar(componentId).withBackground('red')

withComponentId(componentId: string)

Set component id where the status should update

withVisibility(value: boolean)

Set status bar visibility

withTransparency(transparent: boolean)

Set status bar transparency

withBackgroundColor(color: string)

Set status bar background color

withDarkScheme(useDarkScheme: booolean)

Set status bar style with dark/light scheme

StaticOptions

import {StaticOptions} from 'rnn-copilot';

class MyScreen extends React.Component {
  static options() {
    return (
      new StaticOptions()
        .withTopBar(new TopBar().withTitle('My Screen'))
        .get()
    );
  }
}

withTopBar(topBar: TopBar)

Set a topBar using the TopBar class

withStatusBar(statusBar: StatusBar)

Set a statusBar using the StatusBar class

withOptions(options: Options)

Set custom set of StaticOptions options

get()

Returns the static options object

BottomTab

import {BottomTab} from 'rnn-copilot';

new BottomTab(tabId, screenId).withLabel(tabLabel)

withLabel(label: string)

Set tab label

get()

Retrieve (RNN) layout object

Events

import {Events} from 'rnn-copilot';

class MyScreen extends React.Component<ScreenProps> {
  events = new Events(this.props.componentId).withBindAllEvents(this);
  // Or
  events = new Events(this.props.componentId).withEvents({
    componentDidAppear: callback1,
    navigationButtonPressed: callback2,
  });
}

withBindAllEvents(component: Component, componentId?: string)

Bind all navigation events with the given component

withEvents(eventsListener: EventsListener)

Bind specific navigation events with the given events listener

Roadmap

  • Setup a build in CI
  • Create a StaticOptions component that combines all options
  • Support showing loader as right button (there's an issue)
  • Support easier ways to set app default styles for common behaviors

Know Issues

  • dismissing a pageSheet modal on iOS doesn't trigger didAppear event which breaks our push functionality.
  • After setting a custom right button (loader) - mergeOptions stops working completely
  • StatusBar update doesn't work on iOS
  • iOS - TopBar withBorder doesn't work when using update