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

@planningcenter/olio-react-native

v0.1.0-rc.2

Published

Components and utilities for the react-native space

Downloads

391

Readme

Olio is a component library that is being developed for sharing mobile components across multiple React Native apps. It is meant to be hodgepodge of components and other shared concerns, which is why it’s named “olio”.

“Olio” definition:

  • a highly spiced stew of various meats and vegetables originating from Spain and Portugal.
  • a miscellaneous collection of things.

Installation

npm install @planningcenter/olio-react-native

RichTextEditor

Our rich text editor is powered by trix and react-native-webview. It's a zero configuration text editor that works offline and is version controlled.

import { RichTextEditor } from '@planningcenter/olio-react-native'

const [value, setValue] = useState('')

<RichTextEditor value={value} onChange={setValue} />

DevTools

In order to use the menu, you will need to do the following:

  1. Install @planningcenter/olio-react-native

  2. In a main file (e.g. app.js), add the following:

    import { DevTools } from '@planningcenter/olio-react-native'
        
    function App() {
      ...
      return (
        ...
        <DevTools />
      )
    }
        

IMPORTANT: Make sure that this is only added once to an app as initializing it multiple times could lead to issues in development

Tools

There are a few tools that you can use to help with the development process. To add a tool to the menu, you simply need to import that tool into your file and add it under the DevTools component.

LogSection

This tool allows you to filter out certain console logs. You can filter by log types (e.g. log, warn, error) or by message regexes. Filters can be combined to better control your console outputs. You will need to import and call useLogManager around app initialization to get the filters to work without having to open the dev tools menu.

Example
import { DevTools, useLogManager } from '@planningcenter/olio-react-native'

export default function MyDevTools() {
  useLogManager()
  return (
    <DevTools>
      <DevTools.LogSection />
    </DevTools>
  )
}

NavigationSection

This tool allows you to jump to a specific screen immediately instead of trying to find a link to that screen. This requires an onNavigate function that takes in a routeName and routeParams to determine how to handle navigation.

Example
import { DevTools } from '@planningcenter/olio-react-native'
import { useNavigation } from  '@react-navigation/native'

export default function MyDevTools() {
  const navigation = useNavigation()
  return (
    <DevTools>
      <DevTools.NavigationSection onNavigate={navigation.navigate}  />
    </DevTools>
  )
}

RequestSection

This tool allows you to override certain urls with custom responses. This can be useful for debugging when certain requests fail, testing different responses, and mocking endpoints that don't exist yet. You will need to import and call useRequestManager around app initialization to get the overrides to work without having to open the dev tools menu.

Example
import { DevTools, useRequestManager } from '@planningcenter/olio-react-native'

export default function MyDevTools() {
  useRequestManager()
  return (
    <DevTools>
      <DevTools.RequestSection />
    </DevTools>
  )
}

StorageSection

This tool allows you to copy values stored in AsyncStorage to help you debug what certain values are.

Example
import { DevTools } from '@planningcenter/olio-react-native'

export default function MyDevTools() {
  return (
    <DevTools>
      <DevTools.StorageSection />
    </DevTools>
  )
}

Custom tools

If you would like to create a custom tool, all you need to do is add children inside the DevTool component. You can use the following components to have a more consistent look

  • Section (wrapper for new tools)
  • Button
  • TextInput

For example, if you wanted to create a tool that tests alert, you could do something like this:

import { Alert, Text, View } from 'react-native'
import { DevTools } from '@planningcenter/olio-react-native'

...
const [value, setValue] = useState('')
<DevTools settings={mySettings}>
  <DevTools.Section title="Alert Test">
    <Text>Enter text to send alert</Text>
    <View style={{ flexDirection: 'row', alignItems: 'center', columnGap: 8 }}>
      <DevTools.TextInput value={value} onChangeText={setValue} />
      <DevTools.Button text="Send" onPress={() => Alert.alert(value)} />
    </View>
  </DevTools.Section>
</DevTools>
...

Contributing

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

License

MIT


Made with create-react-native-library