react-native-counters icon indicating copy to clipboard operation
react-native-counters copied to clipboard

Doesn't work start props of Counter component in React Native

Open minhphuongvong07 opened this issue 1 year ago • 2 comments

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

minhphuongvong07 avatar Feb 28 '24 22:02 minhphuongvong07

componentDidUpdate(prevProps) { if (prevProps.start !== this.props.start) { this.setState({ count: this.props.start }); } }

Please add this part and then fixed

minhphuongvong07 avatar Feb 28 '24 23:02 minhphuongvong07

If you satisfy, I hope you to hep my job seeking [email protected]

minhphuongvong07 avatar Feb 28 '24 23:02 minhphuongvong07