-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Key issues when using FlatList #38
Comments
Check #3 As for the key prop, you either have to pass the key prop to your renderItem function:
or implement
|
Thank you for your reply. I have tried all of these things and I still get the same errors. I tried burning it down and rebuilding the component and my problem now is that I cant get the swipeable components to activate when setting state. If I remove the setState event and put a log there it works fine. `import React, { Component } from 'react'; import { import _ from 'lodash'; import { class DiscogsSearch extends Component {
}
), componentWillMount() { searchDiscogs = () => {
}; clearTextInput = () => { handleRefresh = () => { handleLoadMore = () => { renderFooter = () => { render() {
} const styles = { inputStyleContainer: { const mapStateToProps = (state) => { export default connect(mapStateToProps, mapDispatchToProps)(DiscogsSearch); |
What do you mean by: |
onLeftActionActivate is not activating at the threshold when trying to update state. it works fine with a console log but not when changing state. |
Hmmm. Does console log work when state is there as well?
|
ok with the console log and the setState it now has the opposite problem. It's always firing. Before It said Keep Pulling and would never change to Release, now it's only saying release and the log says it is firing over 50 times with a single swipe. I have followed the steps for issue #3 and no luck. The only difference I can see between the example and my code is I am using react-native 0.44.0 react 16.0.0.alpha-6 and the FlatList component. |
Logging the state onLeftActionActivated shows that OnLeftActionActivated is logging at the correct threshold but not setting the state. Any clues? ` <FlatList
` |
How are you checking if it’s set? SetState is async.
Thanks,
Marti Markov
… On 12 Sep 2017, at 04:32, Chris Robbins ***@***.***> wrote:
Logging the state onLeftActionActivated shows that OnLeftActionActivated is logging at the correct threshold but not setting the state. Any clues?
` <FlatList
data={this.state.albums}
renderItem={({item}) => (
<Swipeable
leftContent= {leftContent}
leftActionActivationDistance={200}
onLeftActionActivate={() => { this.setState({leftActionActivated:true})
console.log("action triggered", this.state.leftActionActivated)
}
}
onLeftActionDeactivate={() =>
this.setState({leftActionActivated: false})
}
onSwipeStart={() => this.setState({isSwiping: true})}
onSwipeRelease={() => this.setState({isSwiping: false})}
>
<SearchResultItem
item={item}
collectionRecords={this.props.collection.collection.albums}
{...this.props}
/>
</Swipeable>
)}
keyExtractor={this._keyExtractor}
ListFooterComponent={this.renderFooter}
refreshing={this.state.refreshing}
onEndReached={this.handleLoadMore}
onEndReachedThreshold={40}
style={styles.renderAlbums}
scrollEnabled={!this.state.isSwiping}
// backgroundColor={'#1A1A1A'}
// itemBackgroundColor={'#1A1A1A'}
/>
`
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Can you paste the |
Had this issue as well, though it was only showing up on iOS. Resolved it by adding a |
When trying to render swipeable in FlatList component, i get the following error:
ExceptionsManager.js:71 Warning: Each child in an array or iterator should have a unique "key" prop.
Check the render method of
Swipeable
. It was passed a child from DiscogsSearch. See https://fb.me/react-warning-keys for more information.Is Swipeable compatible with Flatlist?
Also the swipe actions fire multiple times on one swipe, but i'm not sure if that is a related issue.
The text was updated successfully, but these errors were encountered: