我在为我正在开发的应用程序开发功能时遇到了一些问题。
目标是:使用 FlatList 开发coverflow。该组件应该能够处理其视图上的手势并做出相应的反应。
我正在使用的是:PanResponder 和一个 FlatList。
当我接到“onPanResponderRelease”的调用时,我能够检测到组件上的滑动。
检测到滑动后,目标是使用 FlatList 的“scrollToOffset”方法计算要滚动到的目标偏移量,具体取决于滑动速度。
我从“onPanResponderRelease”回调中收到的对象“gestureState”中检索速度。
我的问题是在标题中,这个速度的单位是什么?它是一个像素/毫秒吗?
感谢您的帮助,如果您需要更多信息以更好地理解我的问题,请告诉我。
我正在使用AWS的放大框架在 Vue.js 中构建一个 web 应用程序。
至于现在,我正在使用cognito服务来验证用户。
我想在用户第一次创建他的帐户时触发一个 lambda 函数。我已经使用以下命令创建了一个 lambda 函数:
amplify function add
Run Code Online (Sandbox Code Playgroud)
我使用以下命令测试了我的功能:
amplify function invoke myLambdaFunction
Run Code Online (Sandbox Code Playgroud)
现在我想在用户创建帐户时触发此功能。
知道我该怎么做吗?
谢谢你,亚历克西斯
amazon-web-services amazon-cognito aws-lambda aws-amplify aws-amplify-cli
我正在开发一个本机应用程序,我想在屏幕上处理触摸.
一个用例是当用户在屏幕上"按下"时,我希望能够获得屏幕上特定组件的位置(x,y)以知道它是否与触摸的(x,y)匹配.
我已经搜索了堆栈溢出,但没有一个给定的解决方案有效...
在我的根组件中:
_onPress = () => {
// How can I get the position of my component ?
this._myComponent.xxx();
};
render() {
return (
<View><MyComponent ref={(r) => this._myComponent = r;} /></View>
);
}
Run Code Online (Sandbox Code Playgroud)
编辑: 尝试此解决方案后(React Native:获取元素的位置)我使其工作如下:
在MyComponent.js中:
getPosition () => {
this._ref._component.measure((width, height, px, py, fx, fy) => {
const location = {
fx: fx,
fy: fy,
px: px,
py: py,
width: width,
height: height
}
console.log(location)
});
};
render() {
return (
<View ref={(r) => …Run Code Online (Sandbox Code Playgroud)