Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification on behaviour of fullWidth #46

Open
arkarsg opened this issue Apr 7, 2024 · 2 comments
Open

Clarification on behaviour of fullWidth #46

arkarsg opened this issue Apr 7, 2024 · 2 comments

Comments

@arkarsg
Copy link

arkarsg commented Apr 7, 2024

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

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!

@yegor-klymenchuk
Copy link

Hi, I faced with the same issue. Please let us know if we do something wrong.

Thanks.

@dohomi
Copy link
Owner

dohomi commented Apr 18, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants