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

Picker text overflow issue when using trailingAccessory #3490

Open
3 of 7 tasks
janoslc opened this issue Jan 22, 2025 · 0 comments
Open
3 of 7 tasks

Picker text overflow issue when using trailingAccessory #3490

janoslc opened this issue Jan 22, 2025 · 0 comments
Labels
bug a bug in one of the components

Comments

@janoslc
Copy link

janoslc commented Jan 22, 2025

Description

At the Picker element if the content is too long the text / label on iOS disappears. It kind of works on Android: the text appears, but it pushes the trailingAccessory out of position.

Related to

  • Components
  • Demo
  • Docs
  • Typings

Steps to reproduce

  1. use Picker component
  2. Pass value for trailingAccessory prop
  3. Select an item with long label - which can't fit the container

Expected behavior

Ellipsis appears at the end of the label, the trailing icon shows at the same position regardless of the label length.

Actual behavior

The label disappears on iOS and the trailingAccessory overflows on Android.

More Info

Picker component doesn't load its default trailing icon (down-icon) as implemented here and I have to pass my own.

Using innerFlexBehavior doesn't solve the issue.

Code snippet

import { useState } from 'react';
import { FontAwesome } from '@expo/vector-icons';

export const TestPicker = (): JSX.Element => {

const [selectedValue, setSelectedValue] = useState('lorem');
const items = [
   {
      label:
        'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce gravida, nulla vel tristique varius',
      value: 'lorem',
    },
    { label: 'banana', value: 'banana' },
  ];

  return (
        <Picker
          containerStyle={{ backgroundColor: 'yellow' }}
          value={selectedValue}
          onChange={(value: string) => setSelectedValue(value)}
          useSafeArea
          items={items}
          trailingAccessory={
            <FontAwesome name="chevron-down" style={{ backgroundColor: 'green' }} />
          }
        />
   )
}

Screenshots/Video

iOS:
Image

Android:
Image

If I change lorem to banana, it looks good.
iOS:
Image

Android:
Image

Environment

  • React Native version: "0.76.6"
  • React Native UI Lib version: "7.35.0"

Affected platforms

  • Android
  • iOS
  • Web
@janoslc janoslc added the bug a bug in one of the components label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug a bug in one of the components
Projects
None yet
Development

No branches or pull requests

1 participant