react-native-scrollview

React Native “keyboardDismissMode” at FlatList

ⅰ亾dé卋堺 提交于 2020-05-15 10:37:39
问题 Is there any possibility to prevent the keyboard from dismissing when scrolling a FlatList ? When using a ScrollView setting the prop "keyboardDismissMode" to "none" is the solution to this problem, but this doesn't work for me at a FlatList... I use the FlatList inside a self-made component, that is in a Stack-Navigator, while there is a focussed TextInput in its header. I render the FlatList like this: <View style={{flex: 1}}> <FlatList style={{flex: 1}} data={this.props.data} keyExtractor=

React Native “keyboardDismissMode” at FlatList

心不动则不痛 提交于 2020-05-15 10:37:26
问题 Is there any possibility to prevent the keyboard from dismissing when scrolling a FlatList ? When using a ScrollView setting the prop "keyboardDismissMode" to "none" is the solution to this problem, but this doesn't work for me at a FlatList... I use the FlatList inside a self-made component, that is in a Stack-Navigator, while there is a focussed TextInput in its header. I render the FlatList like this: <View style={{flex: 1}}> <FlatList style={{flex: 1}} data={this.props.data} keyExtractor=

React Native - how to scroll a ScrollView to a given location after navigation from another screen

ぃ、小莉子 提交于 2020-01-01 05:28:06
问题 Is it possible to tell a ScrollView to scroll to a specific position when we just navigated to the current screen via StackNavigator? I have two screens; Menu and Items. The Menu is a list of Buttons, one for each item. The Items screen contain a Carousel built using ScrollView with the picture and detailed description of each Item. When I click on a button in the Menu screen, I want to navigate to the Items screen, and automatically scroll to the Item that the button represent. I read that

Create a bidirectional repeating/looping infinite scrollView in react native

本秂侑毒 提交于 2019-12-22 12:45:13
问题 I want to create a scroll that repeats itself, again and again, i.e. when I keep scrolling to the top I reach the last row and when I scroll to the bottom I reach the first row again. I have tried searching components for the same, but the best I could find were these - react-native-infinite-scroll and this stackoverflow answer but both of them only tell about how can I load more data when I reach the ScrollView or ListView end. 回答1: I searched a lot for this type component but couldn't find

Horizontal scrollview snapping react native

不羁岁月 提交于 2019-12-20 09:36:13
问题 Hi I am trying to achieve scrollview snap to center like below gif link Check This Gif But unable to do so. Following is my react native code to achieve this. or is there any method to scroll to particular index of scrollview elements like android ? Any help would be appreciated. Thanks in advance <ScrollView style={[styles.imgContainer,{backgroundColor:colorBg,paddingLeft:20}]} automaticallyAdjustInsets={false} horizontal={true} pagingEnabled={true} scrollEnabled={true} decelerationRate={0}

scrollview can't scroll when focus textinput react native

我的未来我决定 提交于 2019-12-20 01:59:08
问题 I have a TextInput inside a ScrollView. The scroll isn't working when the TextInput is on focus. This problem is only affecting Android. 回答1: setting <ScrollView keyboardShouldPersistTaps="always" in combination with the textInout component below (custom component that i created for text inputs to solve this issue) solved my problem: <TouchableOpacity activeOpacity={1} onPress={()=>this.input.focus()}> <View pointerEvents="none" <TextInput ref = {(input) => this.input = input} /> </View> <

Finding out scroll direction in react-native listview/scrollview

自古美人都是妖i 提交于 2019-12-18 03:16:09
问题 Is there a way to find out the scroll direction of react-native's listview/scrollview components? Native iOS components seem to be able to do it by calculating the offset from scrollViewWillBeginDragging and scrollViewDidScroll , but there seems to be no bindings for these. 回答1: You can use the onScroll event of a ScrollView and check the contentOffset in the event callback: https://rnplay.org/apps/FltwOg 'use strict'; var React = require('react-native'); var { AppRegistry, StyleSheet,

How to get currently visible index in RN flat list

大兔子大兔子 提交于 2019-12-09 04:35:33
问题 I have a horizontal flat list where each item is width:300 All I am trying to do is to get index of currently visible item. <FlatList onScroll={(e) => this.handleScroll(e)} horizontal={true} data={this.state.data} renderItem... Tried this: handleScroll(event) { let index = Math.ceil( event.nativeEvent.contentOffset.x / 300 ); And something like this: handleScroll(event) { let contentOffset = event.nativeEvent.contentOffset; let index = Math.floor(contentOffset.x / 300); but nothing is

RefreshControl in ListView does not work for some unknown reason

我们两清 提交于 2019-12-08 07:53:44
问题 I get an error when I pull down to refresh. The code is something like this- loadData: function(){ var _this = this; this.API(); //check if data is loaded setTimeout(function(){ if(_this.isMounted()){ if(_this.state.loaded===false){ _this.setState({ isReloadRequired: true }) } } }, 10000); }, API: function(){ var _this = this; this.setState({ rawData: [], isReloadRequired: false, loaded: false, isRefreshing: true }); Parse.Cloud.run('fetchBookingListForUserCloudFunction', { user_id: Parse

Automatically scroll the view up when keyboard is shown in react-native

邮差的信 提交于 2019-12-08 01:52:27
问题 How can I automatically scroll the view up when I focus in a TextInput box and a keyboard is shown such that the TextInput box is not hidden behind the keyboard? This question has been asked on StackOverflow a few times and I implemented the solution here which is the general solution advised in most of the answers. This solution works fine in the iPhone simulator but doesn't work on the actual phone. Has anyone else experienced this problem that the solution doesn't work on the actual phone?