NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

Select element takes focus from input element on react native web on Safari browser

Open jvzTrifork opened this issue 3 years ago • 13 comments

Description

Only a single character is accepted on controlled input when a Select element is present

CodeSandbox/Snack link

https://snack.expo.dev/MOBQ7fNEN

Steps to reproduce

  1. On Safari browser
  2. In Expo snack, type a letter in input component - shows up
  3. Type another letter - It doesn't show up

NativeBase Version

3.4.7

Platform

  • [ ] Android
  • [ ] CRA
  • [X] Expo
  • [ ] iOS
  • [ ] Next

Other Platform

Web - Safari

Additional Information

I think it is the internal input element of a Select element which takes focus.

jvzTrifork avatar Jun 28 '22 14:06 jvzTrifork

Hi @jvzTrifork, Thank you for reporting this issue. We will look into it.

Krithikj20 avatar Jun 29 '22 04:06 Krithikj20

Hi there. We have the exact same problem. Do you have any workarounds? Or when will it be updated? We have a big form and lots of Safari users...but changing it to another Select element is painful...

himgodfreyho avatar Aug 11 '22 09:08 himgodfreyho

We ended up downgrading to version 3.4.6 which does not have this bug.

jvzTrifork avatar Aug 12 '22 09:08 jvzTrifork

Any update on this issue?

CasuallyCaffeinated avatar Sep 14 '22 13:09 CasuallyCaffeinated

Also experiencing this, version 3.4.19. Does anyone know of a compatible Select element for a replacement?

josephtannenbaum avatar Dec 19 '22 19:12 josephtannenbaum

Also experiencing this. Has there been any progress made on this issue?

DPflasterer avatar Jan 09 '23 18:01 DPflasterer

Any update?

omigueis avatar Feb 07 '23 22:02 omigueis

We have this issue too. I'd appreciate any workaround or fix, or even suggestions to other select libraries.

@Krithikj20

gfviegas avatar Mar 01 '23 11:03 gfviegas

After some digging, I've found out the reason is the prop selection in the commonInput rendered on the Select component. After cloning the select component inside my project and removing this prop (which is extracted in nonLayoutProps) the bug goes away.

Also, the component works just fine without this prop. Perhaps it should be added only on safari on web.

gfviegas avatar Mar 01 '23 12:03 gfviegas

not only on Safari, mobile Chrome also has this issue. Any update?

CyanoFresh avatar Jun 12 '23 20:06 CyanoFresh

@lts-po and I made a work around in our codebase for this issue by creating two custom components that inherit Select.

The first is basically a no-op but needs to wrap Select from native-base https://github.com/spr-networks/super/blob/main/frontend/src/components/Select.js

The second is for the web clients https://github.com/spr-networks/super/blob/main/frontend/src/components/Select.web.js

Here is the implementation

import React from 'react'

import { Select as NBSelect } from 'native-base'


const Select = (props) => {
  const isSafari = () =>
    /Safari/.test(navigator.userAgent) &&
    /Apple Computer/.test(navigator.vendor);


  return (
    <NBSelect {...props} selection={isSafari() ? 1 : null}/>
  );
};

Select.Item = NBSelect.Item
export default Select
export { Select }

lts-rad avatar Jun 29 '23 00:06 lts-rad

Mobile Chrome for iOS has the same issue.

robbporto avatar Sep 12 '23 22:09 robbporto

Mobile Chrome for iOS has the same issue.

Yes confirm. Maybe this problem has disappeared in Glustack-ui?

NamorNimash avatar Feb 05 '24 21:02 NamorNimash