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

react-native-settings-ui

v0.2.1

Published

React Native Settings UI is a library of pre-built components that help you quickly build a visually appealing settings screen.

Downloads

16

Readme

react-native-settings-ui

Platform - Android and iOS License: MIT React Native

Note that the color is a bit different because of the video format

Installation

npm install react-native-settings-ui

Imports

import {
  SettingsProvider,
  SettingsGroup,
  SettingsInfoDisplay,
  SettingsToggle,
  SettingsButton,
} from 'react-native-settings-ui';

Expo

Take a look of example, which used expo.


Component breakdown, complete code in here

SettingsProvider

<SettingsProvider theme="light">{SettingsGroup}</SettingsProvider>

SettingsProvider is a wrapper component that provides a prebuilt theme.

| Prop | Type | Default | Description | | ----- | ------ | ------- | ----------------------------------------------------------------------------------------------- | | theme | string | "light" | The theme to be applied to the settings components. Accepted values are "light" and "dark". |

SettingsGroup

<SettingsGroup title="My app settings" footerText="Hello, this is toggle">
    {SettingsComponent}
</SettingsProvider>

The SettingsGroup component is a container for organizing your settings components into logical groups. It displays a title and an optional footer text.

| Prop | Type | Default | Description | | ---------- | --------- | ------- | ---------------------------------------------------------------------------------------------- | | title | string | | The title displayed at the top of the settings group. | | children | ReactNode | | The settings components to be displayed within the group. | | footerText | string | | (Optional) The footer text displayed at the bottom of the settings group. Default is null. |

SettingsToggle

<SettingsToggle
  title="Default color"
  value={isToggled}
  onValueChange={() => setIsToggled(!isToggled)}
/>

The SettingsToggle component is a customizable switch for the settings components. It allows you to toggle between true and false states, and dispaly different infos.

| Prop | Type | Default | Description | | ------------------- | ---------------------------------------- | ------------------------------------- | ------------------------------------------------------------------------- | | title | string | | The title displayed next to the toggle switch. | | value | boolean | | The current value of the toggle switch (true or false). | | onValueChange | (newValue: boolean) => void | | Callback function that is triggered when the toggle switch value changes. | | titleTextStyle | TextStyle | | (Optional) Custom text style for the title. Default is null. | | trackColor | { false: ColorValue; true: ColorValue; } | { false: '#767577', true: '#81b0ff' } | (Optional) Custom track color for the switch when false and true. | | thumbColorOff | ColorValue | "#eaeaea" | (Optional) Custom thumb color for the switch when the value is false. | | thumbColorOn | ColorValue | "#fff" | (Optional) Custom thumb color for the switch when the value is true. | | ios_backgroundColor | ColorValue | "#3e3e3e" | (Optional) Custom background color for the switch on iOS. |

SettingsInfoDisplay

<SettingsInfoDisplay
  title="switch 1 state (boolEnable)"
  status={isToggled}
  type="boolEnable"
/>

The SettingsInfoDisplay component acts like settings information display, allowing you to show different types of status information based on various conditions. It can display information for boolean states, custom string states, or use custom true/false status text.

| Prop | Type | Default | Description | | ----------------- | ----------------- | ------- | -------------------------------------------------------------------------------------------------------------------- | | title | string | | The title displayed next to the status information. | | status | boolean | string | | The status value to be displayed based on the type prop. | | type | InfoDisplayTypes | | The type of information to display. Accepted values are 'boolEnable', 'boolYes', 'boolCustom', and 'custom'. | | infoTitle | TextStyle | | (Optional) Custom text style for the title. Default is null. | | statusText | TextStyle | | (Optional) Custom text style for the status text. Default is null. | | customTrueStatus | string | | (Optional) Custom status text when status is true. Default is null. | | customFalseStatus | string | | (Optional) Custom status text when status is false. Default is null. |

SettingsButton

<SettingsButton
  title="Press me"
  onPress={() => Alert.alert('', 'Something happened...')}
/>

The SettingsButton component is a customizable button. It supports two types: 'default' and 'newpage'. The 'newpage' type is used when you want to open a new settings screen in your current settings screen, while the 'default' type serves as a regular button.

| Prop | Type | Default | Description | | ----------- | ------------- | --------- | -------------------------------------------------------------------------------------------------------- | | title | string | | The title displayed on the button. | | onPress | () => void | | Callback function that is triggered when the button is pressed. | | type | ButtonVariant | "default" | (Optional) The type of button. Accepted values are 'default' and 'newpage'. | | statusText | string | "" | (Optional) Status text displayed next to the arrow for the 'newpage' type. Default is an empty string. | | buttonTitle | TextStyle | | (Optional) Custom text style for the button title. Default is null. | | arrow | TextStyle | | (Optional) Custom text style for the arrow. Default is null. |

Todo

  • better types and improve code quality
  • add icons
  • add more components & merge components
  • test on android

Contributing

If you've found an issue or have an idea for a new feature, feel free to open an issue or submit a pull request.

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


If you like this library, consider giving it a star ⭐

Made with create-react-native-library