$ git show password-strength
Password strength meter
As you type, a bar grows and shifts from red to green, with the label updating to match.
// Reanimated 4: a plain style with a CSS transition, no shared value
const COLORS = ['#E5484D', '#F76B15', '#F5B301', '#7CC23A', '#2BA84A'];
const LABELS = ['Too weak', 'Weak', 'Okay', 'Good', 'Strong'];
const score = scorePassword(password); // 0..4
<TextInput secureTextEntry value={password} onChangeText={setPassword} style={styles.input} />
<View style={styles.track}>
<Animated.View style={{
height: '100%', borderRadius: 3,
width: password ? ((score + 1) / 5) * 100 + '%' : '0%',
backgroundColor: COLORS[score],
transitionProperty: ['width', 'backgroundColor'],
transitionDuration: '300ms',
transitionTimingFunction: 'ease-out',
}} />
</View>
<Text style={styles.hint}>{password ? LABELS[score] : ' '}</Text>