marcocesarato / react-native-input-spinner

An extensible input number spinner component for react-native highly customizable. This component enhance a text input for entering numeric values, with increase and decrease buttons.
https://marcocesarato.github.io/react-native-input-spinner/
GNU General Public License v3.0
414 stars 34 forks source link

Formatting the displayed value (feature) #72

Closed Codeshark-NET closed 2 years ago

Codeshark-NET commented 2 years ago

Hey there! Thanks for a great library!

I've found myself in a pickle trying to format the value, in this particular case, we have a food picker where the user selects how many "grams" or "micro grams" they want of a certain item.

However, the append/prepend props doesn't seem to cover this use case so well.

Here's what I'm visually trying to achieve: input-spinner-unit

Is there a way to go about this? Or do you accept pull requests? I could give this an attempt then. 👍

I'm thinking of a property ala: valueFormat={(value) => `${value}mg`}

Thanks again!

Codeshark-NET commented 2 years ago

I managed to achieve this by simply removing the input with: inputStyle={{ display: "none" }}

And then adding the appropriate text I wanted as a child element. This of course doesn't enable editing the input field, but it served my purposes fine. Closing this for now. 🙂👍