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