title: How to show numbers with 2 Decimal Places in React Native
body: <p>I am creating a calculator app to help with decimals and would like something to two decimal places like below:</p>
  <pre><code>number     output
  ------     -------
  1          1.00
  1.446      1.45
  1.567      1.57
  </code></pre>
  <p>I have tried using toFixed(2) but I get an error as I'm using maths and not strings.</p>
  <p>I've also tried using toPrecision(4) but I also get an error</p>
  <p>Any help would be really appreciated.</p>
  <pre><code>import React from 'react';
  import {StyleSheet, Text, View, TouchableOpacity, Vibration} from 'react-native';
  import {useState} from 'react';
  import { Entypo } from '@expo/vector-icons';
  
  export default function App() {
    const [darkMode, setDarkMode] = useState(false);
    const [currentNumber, setCurrentNumber] = useState('');
    const [lastNumber, setLastNumber] = useState('');
  
    const buttons = ['C', 'DEL', '/', 7, 8, 9, '*', 4, 5, 6, '-', 1, 2, 3, '+', 0, '.', '=']
  
    function calculator() {
      
      let lastArr = currentNumber[currentNumber.length-1];
      
      if(lastArr === '/' || lastArr === '*' || lastArr === '-' || lastArr === '+' || lastArr === '.') {
        setCurrentNumber(currentNumber)
        return
      }
      else {
        let result = eval(currentNumber).toString();
        setCurrentNumber(result)
        return
      }
    }
  
    function handleInput(buttonPressed) {
      if(buttonPressed  === '+' || buttonPressed === '-' || buttonPressed === '*' || buttonPressed === '/') {
        Vibration.vibrate(35);
        setCurrentNumber(currentNumber + buttonPressed)
        return
      }
      else if (buttonPressed === 1 || buttonPressed === 2 || buttonPressed === 3 || buttonPressed === 4 || buttonPressed === 5 ||
              buttonPressed === 6 || buttonPressed === 7 || buttonPressed === 8 || buttonPressed === 9 || buttonPressed === 0 || buttonPressed === '.' ) {
        Vibration.vibrate(35);
      }
      switch(buttonPressed) {
        case 'DEL':
          Vibration.vibrate(35);
          setCurrentNumber(currentNumber.substring(0, (currentNumber.length - 1)))
          return
        case 'C':
          Vibration.vibrate(35);
          setLastNumber('')
          setCurrentNumber('')
          return 
        case '=':
          Vibration.vibrate(35);
          setLastNumber(currentNumber + '=')
          calculator()
          return
      }
      setCurrentNumber(currentNumber + buttonPressed)
    }
  </code></pre>