Merge branch 'fix/stop-keyboard-from-overlapping-with-inputs' into 'main'
Fix: Define isKeyboardOffset based on Platform See merge request bloodyhealth/drip!523
This commit is contained in:
@@ -33,7 +33,7 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:windowSoftInputMode="adjustResize"
|
android:windowSoftInputMode="adjustPan"
|
||||||
android:screenOrientation="sensorPortrait">
|
android:screenOrientation="sensorPortrait">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|||||||
@@ -1,30 +1,15 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { KeyboardAvoidingView, StyleSheet, TextInput } from 'react-native'
|
import { StyleSheet, TextInput } from 'react-native'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import { Colors, Spacing, Typography } from '../../styles'
|
import { Colors, Spacing, Typography } from '../../styles'
|
||||||
|
|
||||||
const AppTextInput = ({ style, isKeyboardOffset, ...props }) => {
|
const AppTextInput = ({ style, ...props }) => (
|
||||||
const behavior = isKeyboardOffset ? 'padding' : 'height'
|
<TextInput style={[styles.input, style]} {...props} />
|
||||||
const keyboardVerticalOffset = isKeyboardOffset ? 300 : 0
|
)
|
||||||
|
|
||||||
return (
|
|
||||||
<KeyboardAvoidingView
|
|
||||||
behavior={behavior}
|
|
||||||
keyboardVerticalOffset={keyboardVerticalOffset}
|
|
||||||
>
|
|
||||||
<TextInput style={[styles.input, style]} {...props} />
|
|
||||||
</KeyboardAvoidingView>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
AppTextInput.propTypes = {
|
AppTextInput.propTypes = {
|
||||||
style: PropTypes.object,
|
style: PropTypes.object,
|
||||||
isKeyboardOffset: PropTypes.bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
AppTextInput.defultProps = {
|
|
||||||
isKeyboardOffset: true,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
|
|||||||
@@ -109,6 +109,13 @@ const SymptomEditView = ({ date, onClose, symptom, symptomData }) => {
|
|||||||
}
|
}
|
||||||
const iconName = shouldShowInfo ? 'chevron-up' : 'chevron-down'
|
const iconName = shouldShowInfo ? 'chevron-up' : 'chevron-down'
|
||||||
const noteText = symptom === 'note' ? data.value : data.note
|
const noteText = symptom === 'note' ? data.value : data.note
|
||||||
|
const inputProps = {
|
||||||
|
multiline: true,
|
||||||
|
numberOfLines: 3,
|
||||||
|
scrollEnabled: false,
|
||||||
|
style: styles.input,
|
||||||
|
textAlignVertical: 'top',
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppModal onClose={onSave}>
|
<AppModal onClose={onSave}>
|
||||||
@@ -157,7 +164,7 @@ const SymptomEditView = ({ date, onClose, symptom, symptomData }) => {
|
|||||||
/>
|
/>
|
||||||
{isOtherSelected && (
|
{isOtherSelected && (
|
||||||
<AppTextInput
|
<AppTextInput
|
||||||
multiline={true}
|
{...inputProps}
|
||||||
placeholder={sharedLabels.enter}
|
placeholder={sharedLabels.enter}
|
||||||
value={data.note}
|
value={data.note}
|
||||||
onChangeText={(value) => onSelectBoxNote(value)}
|
onChangeText={(value) => onSelectBoxNote(value)}
|
||||||
@@ -179,8 +186,7 @@ const SymptomEditView = ({ date, onClose, symptom, symptomData }) => {
|
|||||||
<Segment style={styles.segmentBorder}>
|
<Segment style={styles.segmentBorder}>
|
||||||
<AppText>{symtomPage[symptom].note}</AppText>
|
<AppText>{symtomPage[symptom].note}</AppText>
|
||||||
<AppTextInput
|
<AppTextInput
|
||||||
multiline={true}
|
{...inputProps}
|
||||||
numberOfLines={3}
|
|
||||||
onChangeText={onEditNote}
|
onChangeText={onEditNote}
|
||||||
placeholder={sharedLabels.enter}
|
placeholder={sharedLabels.enter}
|
||||||
testID="noteInput"
|
testID="noteInput"
|
||||||
@@ -233,6 +239,9 @@ const styles = StyleSheet.create({
|
|||||||
zIndex: 3, // works on ios
|
zIndex: 3, // works on ios
|
||||||
elevation: 3, // works on android
|
elevation: 3, // works on android
|
||||||
},
|
},
|
||||||
|
input: {
|
||||||
|
height: Sizes.base * 5,
|
||||||
|
},
|
||||||
modalContainer: {
|
modalContainer: {
|
||||||
paddingHorizontal: Spacing.base,
|
paddingHorizontal: Spacing.base,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { Alert, StyleSheet, View } from 'react-native'
|
import { Alert, KeyboardAvoidingView, StyleSheet, View } from 'react-native'
|
||||||
import nodejs from 'nodejs-mobile-react-native'
|
import nodejs from 'nodejs-mobile-react-native'
|
||||||
|
|
||||||
import AppPage from './common/app-page'
|
import AppPage from './common/app-page'
|
||||||
@@ -68,22 +68,23 @@ const PasswordPrompt = ({ enableShowApp }) => {
|
|||||||
<>
|
<>
|
||||||
<Header isStatic />
|
<Header isStatic />
|
||||||
<AppPage contentContainerStyle={styles.contentContainer}>
|
<AppPage contentContainerStyle={styles.contentContainer}>
|
||||||
<AppTextInput
|
<KeyboardAvoidingView behavior="padding" keyboardVerticalOffset={150}>
|
||||||
isKeyboardOffset={false}
|
<AppTextInput
|
||||||
onChangeText={setPassword}
|
onChangeText={setPassword}
|
||||||
secureTextEntry={true}
|
secureTextEntry={true}
|
||||||
placeholder={labels.enterPassword}
|
placeholder={labels.enterPassword}
|
||||||
/>
|
/>
|
||||||
<View style={styles.containerButtons}>
|
<View style={styles.containerButtons}>
|
||||||
<Button onPress={onConfirmDeletion}>{labels.forgotPassword}</Button>
|
<Button onPress={onConfirmDeletion}>{labels.forgotPassword}</Button>
|
||||||
<Button
|
<Button
|
||||||
disabled={!isPasswordEntered}
|
disabled={!isPasswordEntered}
|
||||||
isCTA={isPasswordEntered}
|
isCTA={isPasswordEntered}
|
||||||
onPress={unlockApp}
|
onPress={unlockApp}
|
||||||
>
|
>
|
||||||
{labels.title}
|
{labels.title}
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
|
</KeyboardAvoidingView>
|
||||||
</AppPage>
|
</AppPage>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { Alert, StyleSheet, View } from 'react-native'
|
import { Alert, KeyboardAvoidingView, StyleSheet, View } from 'react-native'
|
||||||
import nodejs from 'nodejs-mobile-react-native'
|
import nodejs from 'nodejs-mobile-react-native'
|
||||||
|
|
||||||
import AppTextInput from '../../common/app-text-input'
|
import AppTextInput from '../../common/app-text-input'
|
||||||
@@ -53,7 +53,7 @@ const ConfirmWithPassword = ({ onSuccess, onCancel }) => {
|
|||||||
const isPassword = password !== null
|
const isPassword = password !== null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<KeyboardAvoidingView behavior="padding" keyboardVerticalOffset={150}>
|
||||||
<AppTextInput
|
<AppTextInput
|
||||||
onChangeText={setPassword}
|
onChangeText={setPassword}
|
||||||
placeholder={labels.enterCurrent}
|
placeholder={labels.enterCurrent}
|
||||||
@@ -70,7 +70,7 @@ const ConfirmWithPassword = ({ onSuccess, onCancel }) => {
|
|||||||
{shared.confirmToProceed}
|
{shared.confirmToProceed}
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
</>
|
</KeyboardAvoidingView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import { StyleSheet } from 'react-native'
|
import { KeyboardAvoidingView, StyleSheet } from 'react-native'
|
||||||
import nodejs from 'nodejs-mobile-react-native'
|
import nodejs from 'nodejs-mobile-react-native'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
@@ -41,9 +41,8 @@ const EnterNewPassword = ({ changeEncryptionAndRestart }) => {
|
|||||||
const isButtonActive = password.length > 0 && passwordConfirmation.length > 0
|
const isButtonActive = password.length > 0 && passwordConfirmation.length > 0
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<KeyboardAvoidingView behavior="padding" keyboardVerticalOffset={150}>
|
||||||
<AppTextInput
|
<AppTextInput
|
||||||
isKeyboardOffset={false}
|
|
||||||
onChangeText={setPassword}
|
onChangeText={setPassword}
|
||||||
placeholder={labels.enterNew}
|
placeholder={labels.enterNew}
|
||||||
textContentType="password"
|
textContentType="password"
|
||||||
@@ -51,7 +50,6 @@ const EnterNewPassword = ({ changeEncryptionAndRestart }) => {
|
|||||||
secureTextEntry={true}
|
secureTextEntry={true}
|
||||||
/>
|
/>
|
||||||
<AppTextInput
|
<AppTextInput
|
||||||
isKeyboardOffset={false}
|
|
||||||
onChangeText={setPasswordConfirmation}
|
onChangeText={setPasswordConfirmation}
|
||||||
placeholder={labels.confirmPassword}
|
placeholder={labels.confirmPassword}
|
||||||
textContentType="password"
|
textContentType="password"
|
||||||
@@ -68,7 +66,7 @@ const EnterNewPassword = ({ changeEncryptionAndRestart }) => {
|
|||||||
>
|
>
|
||||||
{labels.savePassword}
|
{labels.savePassword}
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</KeyboardAvoidingView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user