问题标签 [touchableopacity]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
react-native - 滚动时如何禁用 TouchableOpacity 的高亮效果?
我有一个TouchableOpacity
里面的列表ScrollView
。我想禁用. TouchableOpacity
滚动时,我只想在onPress
触发事件时突出显示。因为它可能会使用户混淆它被按下。
react-native - React-Native TouchableHighlight activates wrong button when next to each other
I have a React-Native view where I have to buttons side by side from each other.
What is happening is when I click Back, it does what it is supposed to do: console.log(-1)
However, when I click on Next, the console.log
of "Back" is being activated almost 70% of the time and only 30% of the time it shows a console.log(+1)
I have no idea why this is happening. Here is a screenshot of what is rendered. Left side is what you see from the code below and the right side is what you see if I add a red border to styles.footerButtonContainer
.
What is even weirder is, if I add this border, then the above issue completely disappears and the buttons act as they are supposed do.
Code
reactjs - 无需按下组件即可随时在 onPress 渲染中反应本机条件状态
如果 project_id 不为空,当我更改状态的任何属性时,为什么在不按 TouchableOpacity 的情况下随时激活此 onPress?
示例流程:
- 我按下这个可触摸的和 project_id == 1 ,模态将打开。
- 我关闭模态
- 我用 textinput 改变了 feedback.name
- 因为 project_id 仍然是 1 modal 会打开
android - Rotated TouchableOpacity crashes on Android when selected
I rotate a TouchableOpacity
(without any animation) as this:
It works fine on iOS, but crashes on Android (see tested versions below):
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Double
I can't put a Double on rotate
, as I get a Invariant violation. What can I do?
Environment :
- OS: macOS High Sierra 10.13.5
- Node: 7.10.0
- Yarn: 1.9.4
- npm: 4.2.0
- Watchman: 4.9.0
- Xcode: Xcode 9.4.1 Build version 9F2000
- Android Studio: 3.2 AI-181.5540.7.32.5014246
Packages:(wanted => installed)
- react: 16.3.1 => 16.3.1
- react-native: 0.55.1 => 0.55.1
Tested on:
- iOS 12 (worked fine on device and simulator)
- Android 7.0 and 8.1 (both device and emulator)
javascript - 更改 touchableopacity backgroundColor on button press react native
我想在本机反应中更改动态生成的 TouchableOpacity BackgroundColor OnPress。
android - TouchableOpacity onLongPress 拦截 FlatList 滚动
我在 FlatList 行中的 TouchableOpacity 组件上使用 onLongPress 时遇到问题。每当您滚动 FlatList 时,都会触发 onLongPress 方法。onPress 方法没有这个问题,我可以改用它,但这并不理想。
我曾尝试弄乱 TouchableOpacity 的 delayPressIn 值,但我尝试过的没有任何帮助。
我还考虑过在滚动开始时设置一个标志,我可以检查 onLongPress 方法,但是 FlatList 上的 onScroll、onScrollEndDrag 或 onScrollBeginDrag 方法都不起作用。
有人对修复滚动问题或 onScroll 事件有任何想法吗?如果这是一个错误,我可以在必要时使用 onPress 事件。
版本:React 0.55.4,NativeBase:2.8.1
javascript - 点击 TouchableOpacity onPress 时旋转图标
单击 TouchableOpacity 时,我最难旋转我的 FontAwesome 图标。我想让 FontAwesome pro 图标在单击时指向下方,并在再次单击时返回其原始状态。
react-native - 如何正确使用 React Native onLongPress?
我有一段简单的代码,它只是一个带有 onLongPress 道具的 TouchableOpacity,但它似乎不起作用。
我试过删除延迟道具,但这仍然不起作用。然而,将 onLongPress 更改为 onPress 似乎确实有效,但我想要长按功能。我正在 Android 模拟器上对此进行测试。
android - 反应本机 TouchableOpacity onPress 在 Android 上不起作用
TouchabelOpacity 在 iOS 上运行良好,但 onPress 方法对我来说在 Android 上不起作用。
我的本机版本:0.57.4
我的代码: