Clarification on behaviour of `fullWidth`
arkarsg opened this issue · comments
Hi,
I’m trying out Forms with react-hook-forms and I would like the clarify the behaviour of fullWdith
property in LmInputRhf
.
Currently, I wish to stretch the input form to the end of the screen. Using the fullWidth
prop causes the input to actually overflow the screen. This is not just for iPhone simulator screens, but also for larger devices like iPad. Screenshot attached below:
![Screenshot 2024-04-07 at 9 38 16 PM](https://private-user-images.githubusercontent.com/84555527/320285455-42d424c0-8f9b-4362-83d6-bb14f6b11a00.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAwOTQ3NzQsIm5iZiI6MTcyMDA5NDQ3NCwicGF0aCI6Ii84NDU1NTUyNy8zMjAyODU0NTUtNDJkNDI0YzAtOGY5Yi00MzYyLTgzZDYtYmIxNGY2YjExYTAwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA0VDEyMDExNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTlhMmQ3NDgwNTYwYjg3MzBkNWY0NzY2MzZiYzg4Yzc1NjEyNmMwODYyN2I0ODJmNTM5MmM0OWM4YzU4MWU4ZmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.GznxZcGbzSZalTj0qIW4jvYbhe0QPReOTXf1FFEQ6jM)
I am currently following one of the snippets With Tamagui Form 2
.
I have tried adding YStack
with padding
but the issue still persists. Code snippet for the above screenshot:
import React from 'react';
import { Stack, XStack, Paragraph, Form, YStack } from 'tamagui';
import { LmInputRhf } from '@tamagui-extras/form';
import { LmAlert, LmButton } from '@tamagui-extras/core';
import { useForm } from 'react-hook-form';
export default function TripForm(): React.JSX.Element {
const { control, handleSubmit, reset } = useForm({
defaultValues: {
name: '',
email: undefined,
password: undefined,
},
});
return (
<YStack fullscreen padding="$4">
<Form
gap={'$3'}
onSubmit={handleSubmit((data) => {
console.log(data);
})}
>
<LmAlert
severity={'info'}
outlined
text='You can use `useForm` directly from "react-hook-form"'
></LmAlert>
<LmInputRhf
name={'name'}
control={control}
label={'Name'}
placeholder={'Type your name...'}
labelInline
required
fullWidth
/>
<LmInputRhf
name={'email'}
control={control}
label={'Name'}
placeholder={'Type your email...'}
labelInline
/>
<LmInputRhf
name={'password'}
control={control}
label={'Password'}
isPassword
placeholder={'Your password...'}
labelInline
/>
<XStack gap={'$3'}>
<LmButton onPress={() => reset()}>Reset</LmButton>
<Form.Trigger asChild>
<LmButton colorVariant={'primary'}>Submit</LmButton>
</Form.Trigger>
</XStack>
</Form>
</YStack>
);
}
Thanks!
Hi, I faced with the same issue. Please let us know if we do something wrong.
Thanks.
If this overflow happens, this means that the outer wrapping component might miss a flexGrow:1
or width:100%
property to limit the total visible width