0.0.11 • Published 1 year ago

@optisolbusiness/react-native-text-input v0.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-native-text-input

@optisolbusiness/react-native-text-input

Installation

npm i @optisolbusiness/react-native-text-input

Usage

import { InputTextComponent } from '@optisolbusiness/react-native-text-input';

// ...

<InputTextComponent
  title={'first_name'}
  isMandatory={true}
  value={name}
  placeholder={'Enter Your Name'}
  inputStyle={{ color: 'blue'}}
  textBoxContainerStyle={{ marginTop: 10 , borderRadius: 20,  height: 45,}}
  isError={false}
  isErrorOutline={false}
  keyboardType="default"
  returnKey={'next'}
  errorMessage={'invalid name'}
  onChangeText={(item) => updateTextValue(item, 'name')}
  onFocus={() => updateButtonValue('blur')}
/>

Example for Usage of imagePosition and imageComponent

export default function App() {
  const [showPassword, setShowPassword] = useState(true);

  const renderEyeIcon = () => {
    return (
      <TouchableOpacity onPress={() => setShowPassword(!showPassword)}>
        {!showPassword && <Image
          source={require('./assets/images/eyeUnhide.png')}
        />}
        {showPassword && <Image
          source={require('./assets/images/eyeHide.png')}
        />}
      </TouchableOpacity>
    );
  };

  return (

      <InputTextComponent
        secureText={showPassword}
        imagePosition={true}
        imageComponent={() => renderEyeIcon()}
      />
  )
}

Props and Methods

PropTypeDescription
showTitlebooleanOptional. Enable to show title for textinput
titleStringOptional. TextInput title (heading)
titleStyleStyleOptional. text input title (heading) style
isMandatorybooleanOptional. to show mandatory symbol adjacent to text input
mainContainerStyleOptional. styling for whole contianer
placeholderStringOptional. placeholder for textinput
disabledbooleanOptional. If you do not wish to allow editing in the text field, you can set the value to false.
valueStringOptional. Specify the value to be displayed in the text input field
secureTextbooleanOptional. make true for sensitive text like passwords to stay secure
keyboardTypeStringOptional. Determines which keyboard to open
returnKeyStringOptional. Determines how the return key should look
inputStyleStyleOptional. styling for text input
onChangeTextFunctionMandatory. Callback that is called when the text input's text changes. Changed text is passed as a single string argument to the callback handler
onFocusFunctionOptional. Callback that is called when the text input is focused
onBlurFunctionOptional. Callback that is called when the text input is blurred
onSubmittingFunctionOptional. Callback that is called when the text input's submit button is pressed.
onEndEdittingFunctionOptional. Callback that is called when text input ends
maxLengthNumberOptional. Limits the maximum number of characters that can be entered
multilinebooleanOptional. If true, the text input can be multiple lines. The default value is false

Note: It is important to note that this aligns the text to the top on iOS, and centers it on Android. Use with textAlignVertical set to top for the same behavior in both platforms.

PropTypeDescription
numberOfLinesNumberOptional. Use it with multiline set to true to be able to fill the lines
blurOnSubmitbooleanOptional. If true, the text field will blur when submitted
onPressInFunctionOptional. Callback that is called when a touch is engaged
inputRefFunctionOptional. reference of text input
testIDStringOptional. testID of text input
isErrorOutlinebooleanOptional. enable to show bordercolor for textinput when there is error
isErrorBorderColorcolorOptional. border color to text input when there is error must make isErrorOutline to true to use isErrorBorderColor prop
notErrorBorderColorStringOptional. border color to text input when there is no error default is black
textBoxContainerStyleStyleOptional. Specify the styling properties for the outer container of a text box, such as borderRadius and borderWidth.
errorMessageStyleOptional. styling of text box outer container like borderRadius, bordrWidth...
isErrorbooleanOptional. to show error message
errorTextStyleStyleOptional. error text style
errorMessageStringOptional. error message text
imagePositionbooleanOptional. To position an image, such as an eye icon or a calendar icon, on the right corner of a text input,
imageComponentFunctionOptional. To show icon on the right corner of the text input and when pressed, you can implement a functionality, Must make imagePosition to true

To enable a pop-up to appear when hovering over an icon, you would need to install the "react-native-popup-menu" library. This pop-up menu will be displayed adjacent to a text input field, and its primary function is to provide additional information relevant to that particular input.

Installation

npm i react-native-popup-menu

If using iOS please remember to install cocoapods by running: npx pod-install

Wrap your application inside MenuProvider and then simply use Menu component where you need it. Below you can find a simple example.

import { MenuProvider } from 'react-native-popup-menu';

export const App = () => (
      <MenuProvider>
        <YourApp />
      </MenuProvider>
);
      <InputTextComponent
      infoEnable={true}
      menuTriggerImageComponent={ () => <Image
          source={require('./assets/images/icon.png')}/>}
      triggerText={'Text to be shown'}
      triggerTextStyle={{color: 'pink'}}
      triggerStyle={{marginLeft: 10}}
      optionsContainerStyle={{borderColor: 'red',borderRadius:2, marginTop: 19}}
      />

Below are props for react-native-popup-menu

PropTypeDescription
infoEnablebooleanMandatory. to enable pop-up menu
triggerStyleStyleOptional. Define the styles for the triggerWrapper within the MenuTrigger
optionsContainerStyleStyleOptional. Define the styles for the optionsContainer within the MenuOptions
triggerTextStyleStyleOptional. trigger text style
triggerTextStringMandatory. to show trigger text
menuTriggerImageComponentFunctionMandatory. To display an image that triggers a pop-up when hovered over

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.0.11

1 year ago

0.0.10

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago