Ensure reps are always positive - 2.15 🚀
This commit is contained in:
parent
1921ecb9f4
commit
9c3d6772a9
|
@ -239,9 +239,11 @@ export default function EditSet() {
|
||||||
value={reps}
|
value={reps}
|
||||||
onChangeText={(newReps) => {
|
onChangeText={(newReps) => {
|
||||||
const fixed = fixNumeric(newReps);
|
const fixed = fixNumeric(newReps);
|
||||||
setReps(fixed);
|
setReps(fixed.replace(/-/g, ''))
|
||||||
if (fixed.length !== newReps.length)
|
if (fixed.length !== newReps.length)
|
||||||
toast("Reps must be a number");
|
toast("Reps must be a number");
|
||||||
|
else if (fixed.includes('-'))
|
||||||
|
toast("Reps must be a positive value")
|
||||||
}}
|
}}
|
||||||
onSubmitEditing={() => weightRef.current?.focus()}
|
onSubmitEditing={() => weightRef.current?.focus()}
|
||||||
selection={selection}
|
selection={selection}
|
||||||
|
|
11
EditSets.tsx
11
EditSets.tsx
|
@ -21,6 +21,8 @@ import { DrawerParams } from "./drawer-params";
|
||||||
import GymSet from "./gym-set";
|
import GymSet from "./gym-set";
|
||||||
import Settings from "./settings";
|
import Settings from "./settings";
|
||||||
import PrimaryButton from "./PrimaryButton";
|
import PrimaryButton from "./PrimaryButton";
|
||||||
|
import { fixNumeric } from "./fix-numeric";
|
||||||
|
import { toast } from "./toast";
|
||||||
|
|
||||||
export default function EditSets() {
|
export default function EditSets() {
|
||||||
const { params } = useRoute<RouteProp<StackParams, "EditSets">>();
|
const { params } = useRoute<RouteProp<StackParams, "EditSets">>();
|
||||||
|
@ -98,7 +100,14 @@ export default function EditSets() {
|
||||||
label={`Reps: ${oldReps}`}
|
label={`Reps: ${oldReps}`}
|
||||||
keyboardType="numeric"
|
keyboardType="numeric"
|
||||||
value={reps}
|
value={reps}
|
||||||
onChangeText={setReps}
|
onChangeText={(newReps) => {
|
||||||
|
const fixed = fixNumeric(newReps);
|
||||||
|
setReps(fixed.replace(/-/g, ''))
|
||||||
|
if (fixed.length !== newReps.length)
|
||||||
|
toast("Reps must be a number");
|
||||||
|
else if (fixed.includes('-'))
|
||||||
|
toast("Reps must be a positive value")
|
||||||
|
}}
|
||||||
selection={selection}
|
selection={selection}
|
||||||
onSelectionChange={(e) => setSelection(e.nativeEvent.selection)}
|
onSelectionChange={(e) => setSelection(e.nativeEvent.selection)}
|
||||||
autoFocus={!!name}
|
autoFocus={!!name}
|
||||||
|
|
|
@ -150,9 +150,11 @@ export default function StartPlan() {
|
||||||
value={reps}
|
value={reps}
|
||||||
onChangeText={(newReps) => {
|
onChangeText={(newReps) => {
|
||||||
const fixed = fixNumeric(newReps);
|
const fixed = fixNumeric(newReps);
|
||||||
setReps(fixed);
|
setReps(fixed.replace(/-/g, ''))
|
||||||
if (fixed.length !== newReps.length)
|
if (fixed.length !== newReps.length)
|
||||||
toast("Reps must be a number");
|
toast("Reps must be a number");
|
||||||
|
else if (fixed.includes('-'))
|
||||||
|
toast("Reps must be a positive value")
|
||||||
}}
|
}}
|
||||||
onSubmitEditing={() => weightRef.current?.focus()}
|
onSubmitEditing={() => weightRef.current?.focus()}
|
||||||
selection={selection}
|
selection={selection}
|
||||||
|
|
|
@ -85,8 +85,8 @@ android {
|
||||||
applicationId "com.massive"
|
applicationId "com.massive"
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 36229
|
versionCode 36230
|
||||||
versionName "2.14"
|
versionName "2.15"
|
||||||
}
|
}
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "massive",
|
"name": "massive",
|
||||||
"version": "2.14",
|
"version": "2.15",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in New Issue