0.1.4 • Published 2 months ago

react-native-expo-modal-select v0.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

react-native-expo-modal-select

This is customizable Modal Select for your React Native and Expo application.

Installation

npm install react-native-expo-modal-select

or

yarn add react-native-expo-modal-select

Usage

import React, { useState } from 'react';
import { StyleSheet, View } from 'react-native';
import ModalSelect, { Item } from 'react-native-expo-modal-select';

const countries: Item[] = [
  {
    label: 'Brazil',
    value: 'brazil',
  },
  {
    label: 'EUA',
    value: 'eua',
  },
  {
    label: 'Canada',
    value: 'canada',
  },
];

export default function Select() {
  const [country, setCountry] = useState('');
  return (
    <View style={styles.container}>
      <ModalSelect
        label="country"
        placeholder="Select your country"
        items={countries}
        value={country}
        onChange={(value) => setCountry(value)}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    padding: 16,
    backgroundColor: '#ddd',
  },
});

Reference

testID

id for testing

TypeRequiredDefault
stringNoundefined

label

display a text label for describing the select component

TypeRequiredDefault
stringNoundefined

required

display * for required fields

TypeRequiredDefault
booleanNofalse

items

array of Item that will be represented in modal as all the options that could be selected

TypeRequiredDefault
arrayYes

value

selected item in modal select

TypeRequiredDefault
stringYes

placeholder

text that will be displayed inside the touchable

TypeRequiredDefault
stringNoundefined

touchableStyle

style object for touchable

TypeRequiredDefault
objectNoundefined

touchableTextStyle

style object for text inside touchable

TypeRequiredDefault
objectNoundefined

itemTouchableStyle

style object for select item touchable

TypeRequiredDefault
objectNoundefined

itemTextStyle

style object for select item text

TypeRequiredDefault
objectNoundefined

errorTextStyle

style object for error text

TypeRequiredDefault
objectNoundefined

labelStyle

style object for label text

TypeRequiredDefault
objectNoundefined

modalStyle

style object for customizing modal

TypeRequiredDefault
objectNoundefined

modalTitleStyle

style object for modal title text

TypeRequiredDefault
objectNoundefined

showErrorMessage

when false, hide the error message keeping the error style.

TypeRequiredDefault
booleanNotrue

errorColor

defines the error used when has an error

TypeRequiredDefault
stringNo#e74c3c

closeTextStyle

style object for modal close button text

TypeRequiredDefault
objectNoundefined

cancelTouchableText

text that will be displayed inside the cancel touchable

TypeRequiredDefault
stringNoCancel

emptyIndicatorText

text that will be displayed inside the empty indicator

TypeRequiredDefault
functionYesSorry, there is nothing to be shown here

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

0.1.4

2 months ago

0.1.3

8 months ago

0.1.2

11 months ago

0.1.1

11 months ago