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

react-native-settings-components

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-settings-components

settings components in style of native components (Category Header, Divider, EditText, Picker, Switch)

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

react-native-settings-components

Settings components for React Native in style of native iOS or Android components.
Uses react-native-dialogs for dialogs on Android.

Installation

# via NPM
npm i react-native-settings-components
# or via Yarn
yarn add react-native-settings-components

Usage

import {
  SettingsDividerShort,
  SettingsDividerLong,
  SettingsEditText,
  SettingsCategoryHeader,
  SettingsSwitch,
  SettingsPicker
} from "react-native-settings-components";

export default class App extends Component {
  constructor() {
    super();
    this.state = {
      username: "",
      allowPushNotifications: false,
      gender: ""
    };
  }

  render() {
    <ScrollView
      style={{
        flex: 1,
        backgroundColor:
          Platform.OS === "ios" ? colors.iosSettingsBackground : colors.white
      }}
    >
      <SettingsCategoryHeader
        title={"My Account"}
        textStyle={Platform.OS === "android" ? { color: colors.monza } : null}
      />
      <SettingsDividerLong android={false} />
      <SettingsEditText
        title="Username"
        dialogDescription={"Enter your username."}
        valuePlaceholder="..."
        negativeButtonTitle={"Cancel"}
        buttonRightTitle={"Save"}
        onValueChange={value => {
          console.log("username:", value);
          this.setState({
            username: value
          });
        }}
        value={this.state.username}        
      />
      <SettingsDividerShort />
      <SettingsPicker
        title="Gender"
        dialogDescription={"Choose your gender."}
        options={[
          { label: "...", value: "" },
          { label: "male", value: "male" },
          { label: "female", value: "female" },
          { label: "other", value: "other" }
        ]}
        onValueChange={value => {
          console.log("gender:", value);
          this.setState({
            gender: value
          });
        }}
        value={this.state.gender}
        styleModalButtonsText={{ color: colors.monza }}
      />
      ...
      <SettingsSwitch
        title={"Allow Push Notifications"}
        onValueChange={value => {
          console.log("allow push notifications:", value);
          this.setState({
            allowPushNotifications: value
          });
        }}
        value={this.state.allowPushNotifications}
        trackColor={{
          true: colors.switchEnabled,
          false: colors.switchDisabled,
        }}
      />
      ...
    </ScrollView>;
  }
}

const colors = {
  white: "#FFFFFF",
  monza: "#C70039",
  switchEnabled: "#C70039",
  switchDisabled: "#efeff3",
  blueGem: "#27139A",
};

Props

SettingsCategoryHeader

PropDescriptionTypeDefault
titlecategory titleStringRequired
containercontainer props except styleObject{}
containerStylecontainer style propViewPropTypes{}
titlePropstitle props except styleText Component Props / Object{}
titleStyletitle style propText PropTypes{}

SettingsTextLabel - added by radi-cho

The same props as SettingsCategoryHeader's props.

SettingsDividerLong

PropDescriptionTypeDefault
iosdisplay on iOSBooleantrue
androiddisplay on AndroidBooleantrue
dividerStyledivider style propViewPropTypes{}

SettingsDividerShort

PropDescriptionTypeDefault
iosdisplay on iOSBooleantrue
androiddisplay on AndroidBooleantrue
containerStylecontainer style propViewPropTypes{}
dividerStyledivider style propViewPropTypes{}

SettingsEditText

PropDescriptionTypeDefault
containerPropscontainer props except styleView Component Props{}
containerStylecontainer style propViewPropTypes{}
disabledOverlayStylecomponent overlay style if setting is disabledViewPropTypes{}
titlePropstitle props except styleText Component Props{}
titleStyletitle style propText PropTypes{}
titletitle of settingStringRequired
descriptionPropsdescription props except styleText Component Props{}
descriptionStyledescription style propText PropTypes{}
descriptiondescription of settingStringnull
valuePropsvalue props except styleText Component Props{}
valueStylevalue style propText PropTypes{}
valuevalue of settingStringRequired
valuePlaceholderplaceholder if value is emptyString...
valueFormatValue formatterFunction (String) => Stringnull
negativeButtonTitlenegative dialog buttons titleStringRequired
positiveButtonTitlepositive dialog buttons titleStringRequired
dialogDescriptiontext explaining what the user should do e.g.String''
onValueChangecallback to be invoked when the positive dialog button is pressedFunction (String) => nullRequired
disabledwhether the settings value should be editable or notBooleanfalse
iosDialogInputTypeinput type of the dialog alert on ios (constants available at SettingsEditText.constants.iosDialogInputType)Stringplain-text
androidDialogInputTypeinput type of the dialog alert on android (constants available at SettingsEditText.constants.androidDialogInputType)Stringnull
androidDialogOptionsinput dialog options on android (see react-native-dialogs)String{}
touchablePropsprops of touchable opening input dialogString{}

SettingsPicker

If you set multi = true, you can select multiple options, but you have to set a value of type Array instead. See props.

PropDescriptionTypeDefault
containerPropscontainer props except styleView Component Props{}
containerStylecontainer style propViewPropTypes{}
disabledOverlayStylecomponent overlay style if setting is disabledViewPropTypes{}
titlePropstitle props except styleText Component Props{}
titleStyletitle style propText PropTypes{}
titletitle of settingStringRequired
valuePropsvalue props except styleText Component Props{}
valueStylevalue style propText PropTypes{}
valuevalue of setting<Your_Value_Type>Array<Your_Value_Type>
valueFormatValue formatterFunction (String) => Stringnull
valuePlaceholderplaceholder if value is emptyString...
optionspicker valuesArray of objects in format {label: string, value: string}Required
dialogDescriptiontext explaining what the user should do e.g.String''
onValueChangecallback to be invoked when the positive dialog button is pressedFunction (<Your_Value_Type>Array<Your_Value_Type>) => null
disabledwhether the settings value should be editable or notBooleanfalse
modalStylemodal styles see hereObject{}
multiallow selection of multiple optionsBooleanfalse
renderCloseBtnrender button to close dialogFunction () => React.Component<Text>Close</Text>
renderListItemrender item of options listFunction ({ item Object, index Integer, onSelect Function, selected Boolean, label String, isFirst Boolean, isLast Boolean }) => React.Component{}
singleRadioif multi = false: one option has to be selected?Booleantrue

modal style

const modalStyle = {
    innerWrapper: PropTypes.object,
    header: {
        titleWrapper: PropTypes.object,
        title: PropTypes.object,
        description: PropTypes.object,
        closeBtnWrapper: PropTypes.object,
    },
    list: {
        wrapper: PropTypes.object,
        scrollView: PropTypes.object,
        innerWrapper: PropTypes.object,
    },
};

SettingsSwitch

PropDescriptionTypeDefault
containerPropscontainer props except styleView Component Props{}
containerStylecontainer style propViewPropTypes{}
disabledOverlayStylecomponent overlay style if setting is disabledViewPropTypes{}
titlePropstitle props except styleText Component Props{}
titleStyletitle style propText PropTypes{}
titletitle of settingStringRequired
descriptionPropsdescription props except styleText Component Props{}
descriptionStyledescription style propText PropTypes{}
descriptiondescription of settingStringnull
switchWrapperPropsswitch wrapper props except styleView Component Props{}
switchWrapperStyleswitch wrapper style propView PropTypes{}
valuevalue of settingBooleanRequired
disabledwhether the settings value should be editable or notBooleanfalse
onValueChangecallback to be invoked when the positive dialog button is pressedFunction (Boolean) => nullRequired
trackColorswitch track color see React Native Switch prop trackColorObjectnull
switchPropsSwitch component props except the ones mentioned beforeSwitch Component Props{}

SettingsButton

PropDescriptionTypeDefault
containerPropscontainer props except styleView Component Props{}
containerStylecontainer style propViewPropTypes{}
disabledOverlayStylecomponent overlay style if setting is disabledViewPropTypes{}
titlePropstitle props except styleText Component Props{}
titleStyletitle style propText PropTypes{}
titletitle of settingStringRequired
descriptionPropsdescription props except styleText Component Props{}
descriptionStyledescription style propText PropTypes{}
descriptiondescription of settingStringnull
rightIconWrapperStylewrapper style prop of wrapper around rightBtnView Component Props{}
rightIconanything that should be displayed on the right side of the buttonFunction () => <React.Component>null
disabledwhether the settings value should be editable or notBooleanfalse
onPresscallback to be invoked when the button is pressedFunction (Boolean) => nullRequired

Showcase - v0.0.1

react-native-settings-components ios screenshot react-native-settings-components android screenshot

Keywords

react

FAQs

Package last updated on 16 Oct 2018

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