react-native-counters
react-native-counters copied to clipboard
Doesn't work start props of Counter component in React Native
const [coffeeCount,setCoffeCount] = useState(0); <Counter start={coffeeCount} onChange={(newCount) => { 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
componentDidUpdate(prevProps) { if (prevProps.start !== this.props.start) { this.setState({ count: this.props.start }); } }
Please add this part and then fixed
If you satisfy, I hope you to hep my job seeking [email protected]