Cnilton / react-native-floating-label-input

A customizable React Native TextInput with its placeholder always shown. Includes masks, global styles, character count, and a bunch else.
MIT License
293 stars 60 forks source link

Refactor `onChangeTextCallback` function #101

Closed erheron closed 2 years ago

erheron commented 2 years ago

Intro

Some time ago we needed a special functionality for Text Inputs, which wasn't available in this library. I spent a few hours, trying to do this in our code, then few hours more trying to patch react-native-floating-label-input. Eventually I didn't succeed, and we decided to postpone this change, but I noticed that the code in onChangeTextCallback might be refactored for better readability and maintainability, so I decided to wrap up the PR.

What

Refactor onChangeTextCallback function

Why

For better readability, maintainability, and to help introduce features

Misc

Some changes in this PR are caused by auto-formatting. The biggest change is refactoring of onChangeTextCallback function and extracting it to a new file, also splitting into helper functions and adding types for it

erheron commented 2 years ago

@Cnilton could you please review? Also, I tried to run tests or ios using yarn test or yarn ios but it kept showing errors 😕 Maybe you could help testing it/running test suite? 🙏🏻

Cnilton commented 2 years ago

Hi @erheron, I'm reviewing it right now, soon I'll give you feedback.