react-native-keyboard-aware-scroll-view icon indicating copy to clipboard operation
react-native-keyboard-aware-scroll-view copied to clipboard

scrolling not working on android - ios works

Open caiorrsdeg opened this issue 4 years ago • 2 comments

Here is the snippet

// this is a react navigation 6 modal

<KeyboardScroll
        showsVerticalScrollIndicator={false}
        ref={scrollRef}
        style={{ backgroundColor: theme.white, flexGrow: 1, flex: 1 }}
        contentContainerStyle={{ paddingVertical: 20 }}
        onScroll={onScroll}
        onStartShouldSetResponder={(e) => true}
        onResponderGrant={(e) => resetInactivity()}>
        
        // My code with some inputs
        
        </KeyboardScroll>

KeyboardScroll component code

import { KeyboardAwareScrollView, KeyboardAwareScrollViewProps } from "react-native-keyboard-aware-scroll-view";
import React, { forwardRef, useImperativeHandle, useRef } from "react";

import { Platform } from "react-native";

const KeyboardScroll: React.FC<KeyboardAwareScrollViewProps & { children?: React.ReactNode }> = (
  { children, ...props },
  ref: KeyboardAwareScrollView,
) => {
  const scrollRef = useRef<KeyboardAwareScrollView>(null);

  useImperativeHandle(ref, () => ({
    scrollToPosition: (x: number, y: number) => scrollRef.current?.scrollToPosition(x, y, true),
  }));

  return (
    <KeyboardAwareScrollView
      enableOnAndroid
      enableAutomaticScroll={Platform.OS === "ios"}
      keyboardOpeningTime={0}
      extraHeight={Platform.select({ android: 200 })}
      contentContainerStyle={{ padding: 20 }}
      showsVerticalScrollIndicator={false}
      keyboardShouldPersistTaps="handled"
      {...props}
      ref={scrollRef}>
      {children}
    </KeyboardAwareScrollView>
  );
};

export default forwardRef(KeyboardScroll);

I noticed that changing import { ScrollView } from "react-native"; to import { ScrollView } from "react-native-gesture-handler"; in KeyboardAwareScrollView.js it works. Will you move to gesture handler any time soon or do you know why is this issue happening?

package.json

"dependencies": {
    "@react-navigation/bottom-tabs": "^6.0.9",
    "@react-navigation/native": "^6.0.6",
    "@react-navigation/stack": "^6.0.11",
    "axios": "^0.24.0",
    "moment": "^2.29.1",
    "moment-timezone": "^0.5.34",
    "react": "17.0.2",
    "react-native": "0.66.4",
    "react-native-gesture-handler": "^2.1.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-modal": "^13.0.0",
    "react-native-pager-view": "^5.4.9",
    "react-native-reanimated": "^2.3.0",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.10.1",
    "react-native-splash-screen": "^3.3.0",
    "react-native-svg": "^12.1.1",
    "react-native-vector-icons": "^9.0.0",
    "react-native-webview": "^11.15.0",
    "vanilla-masker": "^1.2.0"
  },

caiorrsdeg avatar Jan 07 '22 18:01 caiorrsdeg

Ensure you have config the 'AndroidManifest.xml' file according to the README !

koploop avatar Jan 18 '22 07:01 koploop

Ensure you have config the 'AndroidManifest.xml' file according to the README !

Sorry about that, I did not pay attention, it's working (I feel ashamed hahhaha)

caiorrsdeg avatar Jan 18 '22 12:01 caiorrsdeg