From 0ba2eeab967d7273fbce37048fe8ecea4955c020 Mon Sep 17 00:00:00 2001 From: balzack Date: Sat, 18 Jan 2025 22:45:27 -0800 Subject: [PATCH] avoiding text input label on android --- app/client/mobile/src/access/Access.tsx | 38 ++++++++++++------- .../mobile/src/settings/Settings.styled.ts | 1 + app/client/mobile/src/settings/Settings.tsx | 27 ++++++++----- 3 files changed, 44 insertions(+), 22 deletions(-) diff --git a/app/client/mobile/src/access/Access.tsx b/app/client/mobile/src/access/Access.tsx index 271b4356..c41b668c 100644 --- a/app/client/mobile/src/access/Access.tsx +++ b/app/client/mobile/src/access/Access.tsx @@ -1,5 +1,5 @@ import React, {useState} from 'react'; -import {View, Image} from 'react-native'; +import {Platform, View, Image} from 'react-native'; import {KeyboardAwareScrollView} from 'react-native-keyboard-aware-scroll-view'; import {useAccess} from './useAccess.hook'; import {styles} from './Access.styled'; @@ -66,7 +66,8 @@ export function Access() { autoCapitalize="none" autoComplete="off" autoCorrect={false} - label={state.strings.server} + label={Platform.OS==='ios'?state.strings.server:undefined} + placeholder={Platform.OS!=='ios'?state.strings.server:undefined} value={state.node} left={} onChangeText={value => actions.setNode(value)} @@ -77,7 +78,8 @@ export function Access() { autoCapitalize="none" autoComplete="off" autoCorrect={false} - label={state.strings.username} + label={Platform.OS==='ios'?state.strings.username:undefined} + placeholder={Platform.OS!=='ios'?state.strings.username:undefined} value={state.username} left={} onChangeText={value => actions.setUsername(value)} @@ -89,7 +91,8 @@ export function Access() { autoComplete="off" autoCorrect={false} value={state.password} - label={state.strings.password} + label={Platform.OS==='ios'?state.strings.password:undefined} + placeholder={Platform.OS!=='ios'?state.strings.password:undefined} secureTextEntry={!showPassword} left={} right={ @@ -128,7 +131,8 @@ export function Access() { autoCapitalize="none" autoComplete="off" autoCorrect={false} - label={state.strings.token} + label={Platform.OS==='ios'?state.strings.token:undefined} + placeholder={Platform.OS!=='ios'?state.strings.token:undefined} left={} onChangeText={value => actions.setToken(value)} /> @@ -138,7 +142,8 @@ export function Access() { autoCapitalize="none" autoComplete="off" autoCorrect={false} - label={state.strings.server} + label={Platform.OS==='ios'?state.strings.server:undefined} + placeholder={Platform.OS!=='ios'?state.strings.server:undefined} value={state.node} left={} onChangeText={value => actions.setNode(value)} @@ -165,7 +170,8 @@ export function Access() { autoCapitalize="none" autoComplete="off" autoCorrect={false} - label={state.strings.token} + label={Platform.OS==='ios'?state.strings.token:undefined} + placeholder={Platform.OS!=='ios'?state.strings.token:undefined} left={} onChangeText={value => actions.setToken(value)} /> @@ -177,7 +183,8 @@ export function Access() { autoCapitalize="none" autoComplete="off" autoCorrect={false} - label={state.strings.server} + label={Platform.OS==='ios'?state.strings.server:undefined} + placeholder={Platform.OS!=='ios'?state.strings.server:undefined} value={state.node} left={} onChangeText={value => actions.setNode(value)} @@ -189,7 +196,8 @@ export function Access() { autoComplete="off" autoCorrect={false} error={state.taken} - label={state.strings.username} + label={Platform.OS==='ios'?state.strings.username:undefined} + placeholder={Platform.OS!=='ios'?state.strings.username:undefined} value={state.username} left={} onChangeText={value => actions.setUsername(value)} @@ -202,7 +210,8 @@ export function Access() { autoCorrect={false} textContentType={'oneTimeCode'} value={state.password} - label={state.strings.password} + label={Platform.OS==='ios'?state.strings.password:undefined} + placeholder={Platform.OS!=='ios'?state.strings.password:undefined} secureTextEntry={!showPassword} left={} right={ @@ -222,7 +231,8 @@ export function Access() { autoCorrect={false} textContentType={'oneTimeCode'} value={state.confirm} - label={state.strings.confirmPassword} + label={Platform.OS==='ios'?state.strings.confirmPassword:undefined} + placeholder={Platform.OS!=='ios'?state.strings.confirmPassword:undefined} secureTextEntry={!showConfirm} left={} right={ @@ -254,7 +264,8 @@ export function Access() { autoCapitalize="none" autoComplete="off" autoCorrect={false} - label={state.strings.server} + label={Platform.OS==='ios'?state.strings.server:undefined} + placeholder={Platform.OS!=='ios'?state.strings.server:undefined} value={state.node} left={} onChangeText={value => actions.setNode(value)} @@ -265,7 +276,8 @@ export function Access() { autoCapitalize="none" autoComplete="off" autoCorrect={false} - label="Password" + label={Platform.OS==='ios'?state.strings.password:undefined} + placeholder={Platform.OS!=='ios'?state.strings.password:undefined} value={state.password} secureTextEntry={!showPassword} left={} diff --git a/app/client/mobile/src/settings/Settings.styled.ts b/app/client/mobile/src/settings/Settings.styled.ts index 639116a4..83c8098c 100644 --- a/app/client/mobile/src/settings/Settings.styled.ts +++ b/app/client/mobile/src/settings/Settings.styled.ts @@ -239,6 +239,7 @@ export const styles = StyleSheet.create({ labelSet: { fontSize: 16, flexGrow: 1, + width: '10%', }, allControl: { flexShrink: 1, diff --git a/app/client/mobile/src/settings/Settings.tsx b/app/client/mobile/src/settings/Settings.tsx index 2549fa09..40e56485 100644 --- a/app/client/mobile/src/settings/Settings.tsx +++ b/app/client/mobile/src/settings/Settings.tsx @@ -713,7 +713,8 @@ export function Settings({showLogout}: {showLogout: boolean}) { autoComplete="off" autoCorrect={false} value={state.sealPassword} - label={state.strings.password} + label={Platofrm.OS==='ios'?state.strings.password:undefined} + placeholder={Platform.OS!=='ios'?state.strings.password:undefined} secureTextEntry={!showPassword} left={} right={ @@ -732,7 +733,8 @@ export function Settings({showLogout}: {showLogout: boolean}) { autoComplete="off" autoCorrect={false} value={state.sealConfirm} - label={state.strings.confirmPassword} + label={Platform.OS==='ios'?state.strings.confirmPassword:undefined} + placeholder={Platform.OS!=='ios'?state.strings.confirmPassword:undefined} secureTextEntry={!showConfirm} left={} right={ @@ -764,7 +766,8 @@ export function Settings({showLogout}: {showLogout: boolean}) { autoComplete="off" autoCorrect={false} value={state.sealPassword} - label={state.strings.password} + label={Platform.OS==='ios'?state.strings.password:undefined} + placeholder={Platform.OS!=='ios'?state.strings.password:undefined} secureTextEntry={!showPassword} left={} right={ @@ -823,7 +826,8 @@ export function Settings({showLogout}: {showLogout: boolean}) { autoComplete="off" autoCorrect={false} value={state.sealDelete} - label={state.strings.deleteKey} + label={Platform.OS==='ios'?state.strings.deleteKey:undefined} + placeholder={Platform.OS!=='ios'?state.strings.deleteKey:undefined} left={} onChangeText={value => actions.setSealDelete(value)} /> @@ -845,7 +849,8 @@ export function Settings({showLogout}: {showLogout: boolean}) { autoComplete="off" autoCorrect={false} value={state.sealPassword} - label={state.strings.password} + label={Platform.OS==='ios'?state.strings.password:undefined} + placeholder={Platform.OS!=='ios'?state.strings.password:undefined} secureTextEntry={!showPassword} left={} right={ @@ -884,7 +889,8 @@ export function Settings({showLogout}: {showLogout: boolean}) { autoCapitalize="none" autoComplete="off" autoCorrect={false} - label={state.strings.name} + label={Platform.OS==='ios'?state.strings.name:undefined} + placeholder={Platform.OS!=='ios'?state.strings.name:undefined} value={state.name} left={} onChangeText={value => actions.setName(value)} @@ -895,7 +901,8 @@ export function Settings({showLogout}: {showLogout: boolean}) { autoCapitalize="none" autoComplete="off" autoCorrect={false} - label={state.strings.location} + label={Platform.OS==='ios'?state.strings.location:undefined} + placeholder={Platform.OS!=='ios'?state.strings.location:undefined} value={state.location} left={} onChangeText={value => actions.setLocation(value)} @@ -906,7 +913,8 @@ export function Settings({showLogout}: {showLogout: boolean}) { autoCapitalize="none" autoComplete="off" autoCorrect={false} - label={state.strings.description} + label={Platform.OS==='ios'?state.strings.description:undefined} + placeholdfer={Platform.OS!=='ios'?state.strings.description:undefined} value={state.description} left={} onChangeText={value => actions.setDescription(value)} @@ -1103,7 +1111,8 @@ export function Settings({showLogout}: {showLogout: boolean}) { autoComplete="off" autoCorrect={false} value={state.remove} - label={state.strings.deleteKey} + label={Platform.OS==='ios'?state.strings.deleteKey:undefined} + placeholder={Platform.OS!=='ios'?state.strings.deleteKey:undefined} left={} onChangeText={value => actions.setRemove(value)} />