We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b96f6c3 commit 7a2c110Copy full SHA for 7a2c110
1 file changed
components/BatteryInfo.tsx
@@ -22,6 +22,8 @@ const BatteryInfo = () => {
22
openBatteryOptimizationSettings,
23
} = useBattery();
24
25
+ const batteryPercent = batteryLevel !== null ? batteryLevel * 100 : null;
26
+
27
const [animatedWidth] = useState(new Animated.Value(0));
28
const [pulseOpacity] = useState(new Animated.Value(1));
29
@@ -121,7 +123,10 @@ const BatteryInfo = () => {
121
123
inputRange: [0, 100],
122
124
outputRange: ["5%", "100%"], // Ensure minimum width for visibility
125
}),
- backgroundColor: getBatteryColor(batteryLevel * 100),
126
+ backgroundColor:
127
+ batteryPercent !== null
128
+ ? getBatteryColor(batteryPercent)
129
+ : styles.batteryBarContainer.backgroundColor,
130
opacity: pulseOpacity, // Charging animation effect
131
},
132
]}
0 commit comments