Skip to content
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

Merged
merged 52 commits into from
May 30, 2018
Merged

Modified for flatlist (from #629) #705

merged 52 commits into from
May 30, 2018

Conversation

xcarpentier
Copy link
Collaborator

From #629

@xcarpentier xcarpentier changed the title Modified for flatlist Modified for flatlist (from #629) Jan 15, 2018
@codecov
Copy link

codecov bot commented Jan 15, 2018

Codecov Report

Merging #705 into master will decrease coverage by 0.69%.
The diff coverage is 23.33%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/Bubble.js 46.15% <ø> (ø) ⬆️
src/Send.js 71.42% <ø> (ø) ⬆️
src/Composer.js 30.76% <ø> (ø) ⬆️
src/Day.js 85.71% <ø> (ø) ⬆️
src/InputToolbar.js 63.33% <0%> (-4.53%) ⬇️
src/Avatar.js 81.25% <100%> (ø) ⬆️
src/utils.js 87.5% <100%> (+45.83%) ⬆️
src/Message.js 60.71% <100%> (ø) ⬆️
src/MessageContainer.js 25.64% <14.28%> (-13.25%) ⬇️
src/MessageText.js 43.33% <50%> (-1.5%) ⬇️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cbbf812...b55d841. Read the comment docs.

@xcarpentier
Copy link
Collaborator Author

I think we need to have an expo publish on every PR to test easely...

@cooperka
Copy link
Collaborator

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.

@cooperka cooperka removed their request for review January 16, 2018 15:47
@brunocascio
Copy link
Collaborator

brunocascio commented Jan 16, 2018

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?

@xcarpentier xcarpentier self-assigned this Jan 17, 2018
{...invertibleScrollViewProps}
ref={(component) => (this._invertibleScrollViewRef = component)}
/>
<View style={{ transform: [{ scaleY: -1 }, { perspective: 1280 }] }}>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this?

enableEmptySections
automaticallyAdjustContentInsets={false}
initialListSize={20}
pageSize={20}
ref="flatListRef"

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
  }
}

renderItem={this.renderRow}
renderHeader={this.renderFooter}
renderFooter={this.renderLoadEarlier()}
style={{ transform: [{ scaleY: -1 }, { perspective: 1280 }] }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this?

justifyContent: 'flex-end',
headerWrapper: {
flex: 1,
transform: [{ scaleY: -1 }, { perspective: 1280 }],

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}

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,

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,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this?

Copy link

@brunolemos brunolemos left a 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?

@xcarpentier
Copy link
Collaborator Author

Thanks, @brunolemos I removed this style transform: [{ scaleY: -1 }, { perspective: 1280 }]

@xcarpentier
Copy link
Collaborator Author

Thanks @brunocascio, I removed state and extends PureComponent

Copy link

@brunolemos brunolemos left a 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}

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? 🤪

@howg0924
Copy link

howg0924 commented May 15, 2018

@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.

@brunolemos
Copy link

@howg0924 unfortunately cherry-picking this commit did not solve the issue... maybe because your branch is outdated?

@howg0924
Copy link

@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.

@brunolemos
Copy link

@howg0924 yeah I merged master on it, maybe it was that

@b4stien
Copy link

b4stien commented May 21, 2018

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).

@xcarpentier
Copy link
Collaborator Author

@b4stien some performance issue. Need to add some suc and maybe change some pure component

@sibelius
Copy link
Collaborator

@FaridSafi can we merge this, and track some regression in new issues?

@xcarpentier
Copy link
Collaborator Author

@sibelius I will merge it tomorrow.

@helielson
Copy link
Contributor

Nice @xcarpentier! Can't wait! Let me know if you need any help

@xcarpentier xcarpentier merged commit c143b5f into master May 30, 2018
@socksrust
Copy link

awesome PR!! Thanks @xcarpentier pretty sure this will help a lot of devs!

@dead23angel
Copy link

bump version pls

this.setState({
position: 'relative',
});
if (this.state !== 'relative') {
Copy link

@varungupta85 varungupta85 May 30, 2018

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.

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)

@fbartho
Copy link
Contributor

fbartho commented May 30, 2018

@varungupta85 that bug looks like it just got merged into master!

chilinh added a commit to chilinh/react-native-gifted-chat that referenced this pull request Jun 18, 2018
* 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
@ChrisEdson
Copy link

Is it possible to get a release with the new flat list design?

@glebez
Copy link
Contributor

glebez commented Jun 28, 2018

Is it just me, or rednerFooter prop of gifted chat stopped properly working after this branch has been merged?

On first sight it seems to me, that FlatList does not expect props renderHeader and renderFooter, but instead ListHeaderComponent and ListFooterComponent, which makes them be ignored.

@xcarpentier
Copy link
Collaborator Author

@glebez Do you have any screenshot or code to share?
Or maybe think about create a PR with the fix...

@sibelius
Copy link
Collaborator

We should have an issue with all possible regressions of this PR

@glebez
Copy link
Contributor

glebez commented Jun 28, 2018

@xcarpentier, I'll try to put together a reduced test case first and afterwards a PR.

@glebez
Copy link
Contributor

glebez commented Jun 28, 2018

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).

@nandiniparimi1107
Copy link
Contributor

@glebez Did we ever find a solution for this?

@xcarpentier xcarpentier deleted the modified-for-flatlist branch May 7, 2020 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.