小编ton*_*sta的帖子

让用户不参与反应本机

我要显示的是如果用户在1分钟内未与应用程序进行交互的图像。我尝试通过在所有元素上的所有用户事件(如onPress onSwipe等)上设置计时器来实现它。但是处理这些是一个复杂的过程。然后,我尝试使用InteractionManager尝试了一下,但也没有解决。我想知道有什么办法可以知道是否发生了任何用户事件?

react-native

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

如果我触摸 Touchables(TouchableHighlight、TouchableOpacity、TouchableWithoutFeedback),PanResponder 无法检测到触摸

我已经在我的项目中实现了PanResponder,但它仅在我触摸不可触摸元素时才有效。当我触摸触摸的元素,如TouchableOpacity,当我移动我的手指上PanReponder不responds.But TouchableOpacity PanResponder响应。

Button 也发生了同样的事情

请告诉我可能是什么问题。

世博链接:https : //snack.expo.io/SyYrtq87W

import React, { Component } from 'react';
import { Button, PanResponder, View, StyleSheet,TouchableOpacity } from 'react-native';
import { Constants } from 'expo';

export default class App extends Component {
  state = {
    show : false
  };
  _panResponder = {};

  componentWillMount() {
    this._panResponder = PanResponder.create({

      onStartShouldSetPanResponder: () => {
        alert('clicked')
        console.log('clicked')
        return true
      },
      onMoveShouldSetPanResponder: () => {
        alert('moved')
        console.log('moved')
        return true
      },
      onStartShouldSetPanResponderCapture: () => false, …
Run Code Online (Sandbox Code Playgroud)

react-native

4
推荐指数
2
解决办法
6546
查看次数

标签 统计

react-native ×2