Git Product home page Git Product logo

react-native-nested-scrollview's Introduction

react-native-nested-scrollview

React native wrapper for android NestedScrollView. It's extract from react-native-bottom-sheet-behavior

Install

$ npm install react-native-nested-scrollview

Install with RNPM

$ react-native link react-native-nested-scrollview

Install Manually

Edit the current files as follows.

MainApplication.java

+   import com.mohtada.nestedscrollview.NestedScrollViewPackage;

    public class MainApplication extends Application implements ReactApplication {

      @Override
      protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
+           new NestedScrollViewPackage()
        );
      }
    }

android/app/build.gradle

    dependencies {
        compile fileTree(dir: "libs", include: ["*.jar"])
        compile "com.android.support:appcompat-v7:23.0.1"
        compile "com.facebook.react:react-native:+"  // From node_modules
+       compile project(':react-native-nested-scrollview')
    }

android/settings.gradle

include ':app'

+   include ':react-native-nested-scrollview'
+   project(':react-native-nested-scrollview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-nested-scrollview/android')

Usage

You should use NestedScrollView instead of ScrollView.

    import NestedScrollView from 'react-native-nested-scrollview';
    render() {
      return (
          <NestedScrollView>
            <NestedScrollView>
            </NestedScrollView>
          </NestedScrollView>
      );
    }

react-native-nested-scrollview's People

Contributors

mohtada-h avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-native-nested-scrollview's Issues

Compilation failed in React Native 0.48.3

Hey, @mohtada-h !

In React Native 0.48.3 I got some errors:

  • [ReactNestedScrollViewHelper]: ScrollEvent.obtain method signature has changed. Added 2 additional parameters (xVelocity, yVelocity)
  • [ReactNestedScrollViewManager]: ScrollEventType does not has ANIMATION_END
  • [ReactNestedScrollViewPackage]: createJSModules - does not override method from its superclass

ScrollEvent

ScrollEvent's obtaib now has the following signature:

public static ScrollEvent obtain(
      int viewTag,
      ScrollEventType scrollEventType,
      int scrollX,
      int scrollY,
      float xVelocity,
      float yVelocity,
      int contentWidth,
      int contentHeight,
      int scrollViewWidth,
      int scrollViewHeight) {

ScrollEventType

ScrollEventType now it looks like this:

public enum ScrollEventType {
  BEGIN_DRAG("topScrollBeginDrag"),
  END_DRAG("topScrollEndDrag"),
  SCROLL("topScroll"),
  MOMENTUM_BEGIN("topMomentumScrollBegin"),
  MOMENTUM_END("topMomentumScrollEnd");
...
}
public static Map createExportedCustomDirectEventTypeConstants() {
    return MapBuilder.builder()
        .put(ScrollEventType.SCROLL.getJSEventName(), MapBuilder.of("registrationName", "onScroll"))
        .put(ScrollEventType.BEGIN_DRAG.getJSEventName(), MapBuilder.of("registrationName", "onScrollBeginDrag"))
        .put(ScrollEventType.END_DRAG.getJSEventName(), MapBuilder.of("registrationName", "onScrollEndDrag"))
        .put(ScrollEventType.MOMENTUM_BEGIN.getJSEventName(), MapBuilder.of("registrationName", "onMomentumScrollBegin"))
        .put(ScrollEventType.MOMENTUM_END.getJSEventName(), MapBuilder.of("registrationName", "onMomentumScrollEnd"))
        .build();
  }

ReactPackage

ReactPackage interface now has only 2 methods:

public interface ReactPackage {

  /**
   * @param reactContext react application context that can be used to create modules
   * @return list of native modules to register with the newly created catalyst instance
   */
  List<NativeModule> createNativeModules(ReactApplicationContext reactContext);

  /**
   * @return a list of view managers that should be registered with {@link UIManagerModule}
   */
  List<ViewManager> createViewManagers(ReactApplicationContext reactContext);
}

I was able to run the project after deleting ScrollEventType.ANIMATION_END, createJSModules and passing random values to velocity parameters.

Please take a look at this problem and do appropriate updates.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.