1.0.7 • Published 6 months ago

react-native-custommobile v1.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

CustomMobileInputBox

Description

CustomMobileInputBox is a customizable React Native component for mobile number input, supporting country selection, error validation, and theming. This component uses react-native-paper for styling and integrates a modal for selecting country codes.

Installation

Ensure you have react-native-paper installed:

npm install react-native-paper

Then, install the component:

npm install react-native-customtextinput

Usage

Import and use the CustomMobileInputBox component:

import React, { useState } from "react";

import { View, Image } from "react-native";

import CustomMobileInputBox from "react-native-customMobile";

const MyComponent = () => {

const phoneNumber, setPhoneNumber = useState("");

const error, setError = useState(false);

return (

<View>

  <CustomMobileInputBox

    label="Phone Number"

    phoneNumber={phoneNumber}

    setPhoneNumber={setPhoneNumber}

    Icon={require("./assets/phone.png")}

    error={error}

    setError={setError}

    errorText="Invalid phone number"

    returnKeyType="done"

  />

</View>

);

};

export default MyComponent; |

Props

PropTypeRequiredDescription
labelstringPlaceholder label for input.
phoneNumberstringCurrent value of the phone number input.
setPhoneNumber(text: string) => voidCallback function to update the phone number.
IconImageSourcePropTypeIcon for the input field.
errorbooleanIndicates whether there is an input error.
setError(hasError: boolean) => voidCallback to set the error state.
errorTextstringError message to display when input is invalid.
returnKeyType'done' \| 'next'Defines the return key type on the keyboard.
onSubmitEditing() => voidFunction triggered on submit.
onSelect(country: Country) => voidCallback triggered when a country is selected.
forwardRefRef<RNTextInput>Reference to the TextInput.
1.0.7

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.0

6 months ago