enh
This commit is contained in:
parent
a09cb936c0
commit
7d33b94c09
3 changed files with 56 additions and 8 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import React, { useState } from 'react';
|
||||
import type { UserAddress } from '@packages/shared'
|
||||
import { View, Alert } from 'react-native';
|
||||
import { View, Alert, Dimensions } from 'react-native';
|
||||
import { useRouter } from 'expo-router';
|
||||
import { AppContainer, MyText, tw, useMarkDataFetchers, MyFlatList, MyTouchableOpacity, BottomDialog, RawBottomDialog } from 'common-ui';
|
||||
import { trpc } from '@/src/trpc-client';
|
||||
|
|
@ -243,6 +243,7 @@ export default function Addresses() {
|
|||
/>
|
||||
|
||||
<RawBottomDialog open={modalVisible} onClose={() => setModalVisible(false)}>
|
||||
<View style={[tw`bg-white rounded-t-2xl`, { height: Dimensions.get('window').height * 0.85 }]}>
|
||||
<AddressForm
|
||||
onSuccess={handleAddressSubmit}
|
||||
initialValues={editingAddress ? {
|
||||
|
|
@ -261,6 +262,7 @@ export default function Addresses() {
|
|||
} : undefined}
|
||||
isEdit={!!editingAddress}
|
||||
/>
|
||||
</View>
|
||||
</RawBottomDialog>
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
import React, { useState } from 'react';
|
||||
import { View, ScrollView, Dimensions } from 'react-native';
|
||||
import { View, ScrollView, KeyboardAvoidingView, Platform } from 'react-native';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import { Formik } from 'formik';
|
||||
import * as Yup from 'yup';
|
||||
import { tw, MyText, MyTouchableOpacity , Checkbox , MyTextInput , LoadingDialog } from 'common-ui';
|
||||
import { trpc } from '../trpc-client';
|
||||
import LocationAttacher from './LocationAttacher';
|
||||
import {KeyboardAwareScrollView} from 'react-native-keyboard-aware-scroll-view';
|
||||
import type { AddressFormProps } from '@packages/shared';
|
||||
|
||||
const AddressForm: React.FC<AddressFormProps> = ({ onSuccess, initialValues, isEdit = false }) => {
|
||||
|
|
@ -56,11 +55,16 @@ const AddressForm: React.FC<AddressFormProps> = ({ onSuccess, initialValues, isE
|
|||
});
|
||||
|
||||
return (
|
||||
<KeyboardAwareScrollView
|
||||
style={[tw`px-4 pt-4 pb-32 bg-white`, {maxHeight: Dimensions.get('window').height * 0.7}]}
|
||||
keyboardShouldPersistTaps="always"
|
||||
keyboardDismissMode="on-drag"
|
||||
<KeyboardAvoidingView
|
||||
style={tw`flex-1 bg-white`}
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
>
|
||||
<ScrollView
|
||||
style={tw`flex-1`}
|
||||
contentContainerStyle={tw`px-4 pt-4 pb-10`}
|
||||
keyboardShouldPersistTaps="handled"
|
||||
showsVerticalScrollIndicator={false}
|
||||
>
|
||||
<MyText style={tw`text-xl font-bold mb-4`}>{isEdit ? 'Edit Address' : 'Add Address'}</MyText>
|
||||
|
||||
{/* Service Area Notice */}
|
||||
|
|
@ -248,7 +252,8 @@ const AddressForm: React.FC<AddressFormProps> = ({ onSuccess, initialValues, isE
|
|||
open={isSubmitting}
|
||||
message={isEdit ? "Updating address..." : "Adding address..."}
|
||||
/>
|
||||
</KeyboardAwareScrollView>
|
||||
</ScrollView>
|
||||
</KeyboardAvoidingView>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
41
change-log.txt
Normal file
41
change-log.txt
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
2026-10-13 13:54:47 AddressForm keyboard + layout fix (user-ui), re-applied on branch `main`.
|
||||
Note: `main` is the pre-region base; its AddressForm is the older form (region dropdown + Google Maps URL paste).
|
||||
These two fixes are self-contained and do not depend on the region work.
|
||||
1/2 apps/user-ui/src/components/AddressForm.tsx:
|
||||
- import { View, ScrollView, Dimensions } from 'react-native';
|
||||
- import {KeyboardAwareScrollView} from 'react-native-keyboard-aware-scroll-view';
|
||||
+ import { View, ScrollView, KeyboardAvoidingView, Platform } from 'react-native';
|
||||
- <KeyboardAwareScrollView
|
||||
- style={[tw`px-4 pt-4 pb-32 bg-white`, {maxHeight: Dimensions.get('window').height * 0.7}]}
|
||||
- keyboardShouldPersistTaps="always"
|
||||
- keyboardDismissMode="on-drag"
|
||||
- >
|
||||
+ <KeyboardAvoidingView
|
||||
+ style={tw`flex-1 bg-white`}
|
||||
+ behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
+ >
|
||||
+ <ScrollView
|
||||
+ style={tw`flex-1`}
|
||||
+ contentContainerStyle={tw`px-4 pt-4 pb-10`}
|
||||
+ keyboardShouldPersistTaps="handled"
|
||||
+ showsVerticalScrollIndicator={false}
|
||||
+ >
|
||||
...content unchanged...
|
||||
- </KeyboardAwareScrollView>
|
||||
+ </ScrollView>
|
||||
+ </KeyboardAvoidingView>
|
||||
2/2 apps/user-ui/app/(drawer)/(tabs)/me/addresses/index.tsx:
|
||||
- import { View, Alert } from 'react-native';
|
||||
+ import { View, Alert, Dimensions } from 'react-native';
|
||||
- <RawBottomDialog ...><AddressForm .../></RawBottomDialog>
|
||||
+ <RawBottomDialog ...>
|
||||
+ <View style={[tw`bg-white rounded-t-2xl`, { height: Dimensions.get('window').height * 0.85 }]}>
|
||||
+ <AddressForm .../>
|
||||
+ </View>
|
||||
+ </RawBottomDialog>
|
||||
(RawBottomDialog renders children bare, so the form needs a bounded height.)
|
||||
Why: AddressForm was the only form using react-native-keyboard-aware-scroll-view (0.9.5, pre-New-Architecture),
|
||||
which mis-handles the keyboard on iOS (input focused but keyboard missing/off-screen); every other working form uses
|
||||
KeyboardAvoidingView. The old `pb-32` (viewport padding) + hardcoded `maxHeight: 70%` also left a blank band and
|
||||
clipped content.
|
||||
No dependency added. No migration. No tests run.
|
||||
Loading…
Add table
Reference in a new issue