react-native-counters
react-native-counters copied to clipboard
React native Minus(-) (Number) Plus(+) Component
Min value is 1 and the max value is 100, If I need to input 56 , I need to press 56 times in + button, show there should be...
What prop do I use to access the actual value of the counter? So for example I want to console.log '5' when the counter reads 5
please add the following method into your class to update this component when parent states get changed. ```JS static getDerivedStateFromProps(nextProps) { return { count: nextProps.start } } ``` Thanks
start props doesn't reflect the state of parent component
const [coffeeCount,setCoffeCount] = useState(0); { console.log(coffeeCount.toString); console.log(newCount); setCoffeeCount(newCount); setInteractionMade(true); }} buttonStyle={styles.counterButton} buttonTextStyle={styles.counterButtonText} countTextStyle={styles.counterText} /> coffeeCount is state of Component. Stat props doesn't work, but start={3} works
This change allows a developer to provide a function which formats the count text as required by their needs. For instance: ``` `${count}%`} /> ``` will display the count like...