小编 i*_*sis的帖子

React-native-gesture-handler swipeable 在 Android 上不起作用

这是我的代码。

应用程序.js

import Swipeable from 'react-native-gesture-handler/Swipeable';

const RightActions = () => {
  return (
    <TouchableOpacity onPress={() => console.warn('works'))}>
      <Icon name="md-trash" size={18} color={Colors.red} />
    </TouchableOpacity>
  );
};

const App = () => {
  return (
    <ScrollView>
    ...
      {Object.keys(data).map(key => {
        return (
          <Swipeable key={key} renderRightActions={RightActions}>
            <View>
              <Text>Swipe left</Text>
            </View>
          </Swipeable>
        );
      });
    </ScrollView>
  );
};

export default App;
Run Code Online (Sandbox Code Playgroud)

这是我的 MainActivity.java,如包所示。

package com.project;

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 …
Run Code Online (Sandbox Code Playgroud)

android gesture react-native

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

gesture ×1

react-native ×1