简体   繁体   中英

Modalize React-Native Error: It is not supported to use minDist with activeOffsetX or activeOffsetY

I'm using RN Modalize and have had several projects using the react-native-modalize library and no problems so far. but this time I created a new project and have followed the tutorial to apply react-native-modalize but get an error like this image

Here my Login.js:

import React, {useRef} from 'react';
import {
  ImageBackground,
  StyleSheet,
  Text,
  TouchableOpacity,
  View,
} from 'react-native';
import {Modalize} from 'react-native-modalize';
import {login_bottom, login_top} from '../assets';
import {colors} from '../constants';

const Login = ({navigation}) => {
  const modalizeRef = useRef(null);
  const onPressLogin = () => {
    modalizeRef.current?.open();
  };

  return (
    <>
      <Modalize ref={modalizeRef}></Modalize>
      <View style={styles.container}>
        <View style={{flex: 1, justifyContent: 'space-around'}}>
          <ImageBackground
            source={login_top}
            style={{
              width: null,
              height: '100%',
            }}
          />
        </View>
        <View style={{flex: 1, justifyContent: 'space-around'}}>
          <View style={styles.containerLogin}>
            <TouchableOpacity style={styles.loginButton} onPress={onPressLogin}>
              <Text style={styles.loginButtonText}>LOGIN</Text>
            </TouchableOpacity>
          </View>
        </View>
        <View style={{flex: 1, justifyContent: 'space-around'}}>
          <ImageBackground
            source={login_bottom}
            style={{
              width: null,
              height: '105%',
            }}
          />
        </View>
      </View>
    </>
  );
};

Here my index.js:

/**
 * @format
 */
import {AppRegistry} from 'react-native';
import App from './src/App';
import {name as appName} from './app.json';
import {gestureHandlerRootHOC} from 'react-native-gesture-handler';

AppRegistry.registerComponent(appName, () => gestureHandlerRootHOC(App));

Here my MainActivity.java:

package com.backbone;

import com.facebook.react.ReactActivity;

import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;

public class MainActivity extends ReactActivity {

  /**
   * Returns the name of the main component registered from JavaScript. This is
   * used to schedule
   * rendering of the component.
   */
  @Override
  protected String getMainComponentName() {
    return "BackBone";
  }

  @Override
  protected ReactActivityDelegate createReactActivityDelegate() {
    return new ReactActivityDelegate(this, getMainComponentName()) {
      @Override
      protected ReactRootView createRootView() {
        return new RNGestureHandlerEnabledRootView(MainActivity.this);
      }
    };
  }

}

And this my depedency:

    "react": "16.13.1",
    "react-native": "0.63.4",
    "react-native-gesture-handler": "^2.0.0",
    "react-native-modalize": "^2.0.12",

react-native-modalize is currently not built to support v2 of react-native-gesture-handler.

There is a PR open on Github: https://github.com/jeremybarbet/react-native-modalize/pull/375

We need to wait until this is fixed. In the meantime you downgrade your react-native-gesture-handler version

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM