web-ridge / react-native-paper-autocomplete

The autocomplete package you wished for on all platforms (iOS, Android, web)
MIT License
19 stars 6 forks source link

When having a selected value, focussing the field which is lower than the top scroll causes the X mark and dropdown items to pop up at the top of the scrollview #2

Closed Rubenvdveen closed 3 years ago

Rubenvdveen commented 3 years ago

When having a selected value once, focussing the field which is lower than the top scroll causes the X mark and dropdown items to pop up at the top of the scrollview.

Image how it's supposed to work:

Screenshot 2021-06-25 at 10 14 13

Image after selecting a value once and re-focussing:

Screenshot 2021-06-25 at 10 14 54
RichardLindhout commented 3 years ago

Do you have body scroll? You can't have body scroll in React Native Web apps

RichardLindhout commented 3 years ago

You should use it inside a

<ScrollView></ScrollView> 
RichardLindhout commented 3 years ago

Hmm I have the same problem now :-D

RichardLindhout commented 3 years ago

Nevermind, it was because expo does allow body scroll by default. You should be fine by something like this in your css

body,html,#root{min-height:100%;height:100%;max-height:100%;overflow:hidden;}

And use a ScrollView for the elements

RichardLindhout commented 3 years ago

For expo users, wrap your whole app in a custom View

export default function App() {
  return (
    <View
      style={
        Platform.OS === 'web' ? { flex: 1, maxHeight: '100vh' } : { flex: 1 }
      }
    >
      <PaperProvider>
        <AppInner />
      </PaperProvider>
    </View>
  );
}
RichardLindhout commented 3 years ago

Please update to v0.2.0, I think I fixed the issue you are describing by recalculating the position if the user clicks the element

Rubenvdveen commented 3 years ago

Thanks for the updates, it seems to work fine using a scrollview and the View wrapped around the App component, but there is one new problem now:

When having the autocomplete focussed, it's impossible to scroll.

Video: https://youtu.be/0yGnSWfeleM