title: Format TextInput in onChangeText to dollar amount in React Native using Redux
body: <p>I struggle to find a proper solution to format the number input in a TextInput using the onChangeText function in React Native using Redux.</p>
  
  <p>I tried using the function <code>.toFixed(2)</code>, but the issue is that as soon as I have one digit typed in the function it interprets the next digit as the first decimal and rounds it right back to 0. This is because I control the input with Redux. As soon as one digit is typed it gets saved to the Redux state and the value prop of the TextInput is hooked up to that part of the Redux state. </p>
  
  <p>Example: I type <code>5</code>, then <code>toFixed(2)</code> returns <code>5.00</code>. When I now type a <code>3</code> it interprets it as <code>5.03</code> and the function rounds it down and returns <code>5.00</code> again.</p>
  
  <hr>
  
  <p>I also tried using <code>react-native-masked-text</code>, but the issue is that due to a bug in the actual TextInput of React Native I have a terrible flickering effect and can't get rid of it. (<a href="https://github.com/benhurott/react-native-masked-text/issues/12" rel="nofollow noreferrer">https://github.com/benhurott/react-native-masked-text/issues/12</a>)</p>
  
  <hr>
  
  <p>The ideal way would be to enter one digit and have it as the first decimal when I hit the next digit the decimal point would move one to the right. Example: I type <code>7</code>, the TextInput should show <code>0.07</code>, then I type <code>9</code> and the TextInput should show <code>0.79</code>. Then I type <code>4</code> and the TextInput should show <code>7.94</code> etc.</p>
  
  <p>A lot of Banking apps in the US do that as a standard practice.</p>