-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Modified for flatlist (from #629) #705
Conversation
Codecov Report
@@ Coverage Diff @@
## master #705 +/- ##
=========================================
- Coverage 43.17% 42.47% -0.7%
=========================================
Files 20 20
Lines 498 485 -13
Branches 104 106 +2
=========================================
- Hits 215 206 -9
+ Misses 216 210 -6
- Partials 67 69 +2
Continue to review full report at Codecov.
|
I think we need to have an expo publish on every PR to test easely... |
Thanks for cleaning this up @xcarpentier 🍻 But fyi I probably won't have time to review this week, you may want to find someone else to review. |
Great work @xcarpentier ! I am in vacation now, but I saw part of the code. Is there a way to remove internal state and use only props in order to make this lib completely stateless? What do you think? |
src/MessageContainer.js
Outdated
{...invertibleScrollViewProps} | ||
ref={(component) => (this._invertibleScrollViewRef = component)} | ||
/> | ||
<View style={{ transform: [{ scaleY: -1 }, { perspective: 1280 }] }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this?
src/MessageContainer.js
Outdated
enableEmptySections | ||
automaticallyAdjustContentInsets={false} | ||
initialListSize={20} | ||
pageSize={20} | ||
ref="flatListRef" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String ref was deprecated a year ago, you should use callback refs only.
ref={flatListRef =>
if (flatListRef) {
this.flatListRef = flatListRef
}
}
src/MessageContainer.js
Outdated
renderItem={this.renderRow} | ||
renderHeader={this.renderFooter} | ||
renderFooter={this.renderLoadEarlier()} | ||
style={{ transform: [{ scaleY: -1 }, { perspective: 1280 }] }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this?
src/MessageContainer.js
Outdated
justifyContent: 'flex-end', | ||
headerWrapper: { | ||
flex: 1, | ||
transform: [{ scaleY: -1 }, { perspective: 1280 }], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this?
pageSize={20} | ||
renderFooter={[Function]} | ||
renderFooter={null} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this?
"scaleY": -1, | ||
}, | ||
Object { | ||
"perspective": 1280, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this?
"scaleY": -1, | ||
}, | ||
Object { | ||
"perspective": 1280, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found very weird that the code transform: [{ scaleY: -1 }, { perspective: 1280 }]
appears at least 4 times in this PR and I'm not sure why they are necessary. Maybe this can be optimized? Implemented differently?
Thanks, @brunolemos I removed this style |
Thanks @brunocascio, I removed state and extends PureComponent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is another issue that only happens on this branch.
If there are no messages and you tap the TextInput, the TextInput won't move up, it will stay below the keyboard.
If there are messages, it works as expected.
The third image shows the issue. The second image if from the live version.
Does anyone know what caused this one?
contentContainerStyle={styles.contentContainerStyle} | ||
renderItem={this.renderRow} | ||
renderHeader={this.renderFooter} | ||
renderFooter={this.renderLoadEarlier} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is renderHeader=renderFooter
and renderFooter=renderLoadEarlier
? 🤪
@brunolemos as for the TextInput does not move up problem, I fixed it in my fork, maybe you could take it as a reference: howg0924@06e78be I solved it by calling keyboard listeners directly in GiftedChat.js. I don't understand why these listeners were passed down to the FlatList in MessageContainer.js. The problem only happens on iOS on my app. |
@howg0924 unfortunately cherry-picking this commit did not solve the issue... maybe because your branch is outdated? |
@brunolemos: My fork is not outdated on this branch. I also fixed some other issues and did a little enhancement on my fork. I guess maybe these modification also helped to fixed the issue. Or maybe the root cause of your problem is different from mine. |
@howg0924 yeah I merged master on it, maybe it was that |
Hello everyone, I am not sure what's blocking this PR, can we help in any way? We're using this project at my company and would be willing to help land this (which seems to be fixing a rendering issue with messages not appearing until scroll). |
@b4stien some performance issue. Need to add some |
@FaridSafi can we merge this, and track some regression in new issues? |
@sibelius I will merge it tomorrow. |
Nice @xcarpentier! Can't wait! Let me know if you need any help |
awesome PR!! Thanks @xcarpentier pretty sure this will help a lot of devs! |
bump version pls |
this.setState({ | ||
position: 'relative', | ||
}); | ||
if (this.state !== 'relative') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be this.state.position
? Same for the if condition in keyboardWillHide
also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably what caused this bug: #705 (review)
@varungupta85 that bug looks like it just got merged into master! |
* r_master: Move listViewProps to the end (FaridSafi#882) chore(package): update react-test-renderer to version 16.4.0 (FaridSafi#868) chore(package): update babel-jest to version 23.0.0 (FaridSafi#869) Update and Fix Slack Example (FaridSafi#895) Remove prop removeClippedSubviews on Flatlist (FaridSafi#897) Update Chatkit readme.md Fix typos in TS Types (FaridSafi#877) Modified for flatlist (from FaridSafi#629) (FaridSafi#705) fix tabs ignore example folder Add Chatkit asset to README.md Add Chatkit banner asset chore(package): update react-test-renderer to version 16.3.2 (FaridSafi#829) Update README.md (FaridSafi#827) add image beacon to readme chore(package): update react-test-renderer to version 16.3.1 (FaridSafi#821) # Conflicts: # .eslintignore # src/MessageContainer.js
Is it possible to get a release with the new flat list design? |
Is it just me, or On first sight it seems to me, that |
@glebez Do you have any screenshot or code to share? |
We should have an issue with all possible regressions of this PR |
@xcarpentier, I'll try to put together a reduced test case first and afterwards a PR. |
Here's a test case using current npm package, so before the FlatList was introduced and the footer is displayed properly: https://snack.expo.io/@glebkost/listview-example If you change the package to use current master the footer is not displayed. (Unfortunately it's not possible in expo snack to set the package to github url, so you need to copy the snack to your local env to test that). |
@glebez Did we ever find a solution for this? |
From #629