Conversation
|
I will work on travis failures but feel free to take a look @koke |
|
we'll need to merge WordPress/gutenberg#12946 first |
# Conflicts: # src/block-management/block-manager.js
| extraScrollHeight={ extraScrollHeight } | ||
| extraHeight={ 0 } | ||
| innerRef={ ( ref ) => { | ||
| ( this: any ).flatList = ref; |
There was a problem hiding this comment.
I believe that all these ( this: any ) notation in this file are not necessary. I tried changing them to this. and it works fine and flow is still happy.
There was a problem hiding this comment.
Also, this reference seems to be to the scrollView and not to the flatList? I might be a bit lost 😅
There was a problem hiding this comment.
I believe that all these ( this: any ) notation in this file are not necessary. I tried changing them to this. and it works fine and flow is still happy.
flow isn't happy to me :( that was the reason I used ( this: any ) in the first place, maybe you can have error if you run travis check in your local.
Also, this reference seems to be to the scrollView and not to the flatList? I might be a bit lost
right, I was using KeyboardAwareFlatList before and then changed it to KeyboardAwareScrollList but it looks like I forgot updating the name flatList. Will push a new commit for this 👍
There was a problem hiding this comment.
flow isn't happy to me :( that was the reason I used ( this: any ) in the first place, maybe you can have error if you run travis check in your local.
May that be because we are declaring variables "on the fly" in a stateless function component instead of "properly" declaring them in a class before accessing them?
There was a problem hiding this comment.
But again, I'm not asking to make that change, just trying to understand the issue 👍
There was a problem hiding this comment.
yes right.. but we don't have a class here, KeyboardAwareFlatList is a function and we want these variable to be shared among these sub functions of KeyboardAwareFlatList.
so by using this we just insert the variables in the current context, not the ideal solution I agree.
I tried declaring KeyboardAwareFlatList as a React.PureCompoent/React.Compoent also but it causes unnecessary re-renders because extraData prop of FlatList changes and that change makes KeyboardAwareScrollView re-render.
Another solution would be declaring these variables in BlockManager and updating them via functions declared in the KeyboardAwareFlatList props, but I think that wouldn't be good since that variables are only needed here in iOS code :(
There was a problem hiding this comment.
I see now. Sounds good to me! Let's ✅
| @@ -0,0 +1,65 @@ | |||
| import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'; | |||
| /** | |||
| * @format | |||
There was a problem hiding this comment.
Small nitpicking:
Can we have the import bellow those comments?
There was a problem hiding this comment.
I put this here as a solution to flow error "Cannot resolve module react-native-keyboard-aware-scroll-view"
I think that happens because I added react-native-keyboard-aware-scroll-view to flowconfig ignore list because flow was trying to validate library source code as well. if there's another solution to this I can apply that happily I just couldn't find any.
There was a problem hiding this comment.
I see, that makes sense. In that case can we put a small comment explaining that? :)
etoledom
left a comment
There was a problem hiding this comment.
Hey @pinarol - This is looking really good! 🎉
Auto scrolling behaves nice and consistent, and I love that the inner toolbar remains visible.
I added a couple of non-blocking/non-important comments to the code but in general it looks super good.
I saw something weird with the scrolling indicator, and a very big extra bottom padding when the keyboard is showing. There's a gif showing it:
I don't think this issue is blocking this PR since I don't see it really as something annoying for the users (as it was the auto-scrolling before). I would completely recommend you to merge this PR and just create an issue for that to be handled somewhen in the future (unless is really easy/fast to fix).
Great job! ✅
cc @mzorz - I haven't tested the Android WP App. In the Example app on android, autoscroll looks good but it doesn't show the inner toolbar. If that's how it was before, it would be great to match that behavior :)
| extraScrollHeight={ extraScrollHeight } | ||
| extraHeight={ 0 } | ||
| innerRef={ ( ref ) => { | ||
| ( this: any ).flatList = ref; |
There was a problem hiding this comment.
Also, this reference seems to be to the scrollView and not to the flatList? I might be a bit lost 😅
Also replaced some spaces with tabs
I've been testing this for a while (smoke tests mostly), it seems to be OK as per my tests. |
|
@etoledom @mzorz about showing the inner toolbar on Android: as far as I know KeyboardAvoidingView can't do it, I had tried KeyboardAwareScrollView on Android side also to achieve that but it behaves different, it first scrolls to the cursor and after some little time it scrolls again, this time for showing the inner toolbar. This is because Android already provides scrolling to the cursor position in the OS level(I guess) and the library just handles the extra scroll, this makes it look scrolling happen in 2 parts and doesn't look very good. |
| * @format | ||
| * @flow | ||
| */ | ||
| import { FlatList, KeyboardAvoidingView } from 'react-native'; |
There was a problem hiding this comment.
Hey @pinarol . Late one...
We didn't use KeyboardAvoidingView from 'rect-native' but we had our abstract presentation of it in components/keyboard-avoiding-view.ios.js and components/keyboard-avoiding-view.android.js
That was introduced to fix the problem with toolbar visibility after orientation change in WPiOS.
| import BlockPicker from './block-picker'; | ||
| import HTMLTextInput from '../components/html-text-input'; | ||
| import BlockToolbar from './block-toolbar'; | ||
| import KeyboardAvoidingView from '../components/keyboard-avoiding-view'; |
There was a problem hiding this comment.
Hey @pinarol , here we are importing from our file.


Fixes #197 partially
This change fixes inconsistent scroll behavior with input texts on iOS. Android behavior didn't change since it wasn't problematic.
iOS Before:

After:
Testing prerequisites
For WPiOS
yarn install,yarn start:resetFor Android
wp.BUILD_GUTENBERG_FROM_SOURCE = trueto grade.propertiesyarn install,yarn start:resetyarn wpandroidon a separate terminal in the same directoryTo Test
Test 1 - Empty post on WPiOS with return button
Test 2 - Add block with (+) button
Test 3 - Verify inner block buttons are working
Test 4 - Repeat tests for Android and make sure we didn't break anything, Android behavior shouldn't change with this PR.