react-native-keyboard-input icon indicating copy to clipboard operation
react-native-keyboard-input copied to clipboard

flash android

Open jiangchunyun opened this issue 5 years ago • 11 comments

when switch the keyboard , android will flash.

jiangchunyun avatar Dec 13 '19 15:12 jiangchunyun

YES SAME ISSUE

OmarBasem avatar Feb 07 '20 18:02 OmarBasem

Same thing at me, only on android, it happens randomly, not always.

ggunti avatar Apr 30 '20 19:04 ggunti

Hi @jiangchunyun,

Please add more information if this is still relevant.

  1. Does this happen in the demo app? a. If yes, on what device - real\emulator, OS and type? b. If not, please provide an example that it happens on.
  2. A video of the problem if you can.

M-i-k-e-l avatar May 07 '20 09:05 M-i-k-e-l

@M-i-k-e-l I made a little video, you can access it below. The device is a Samsung S5, running android 6. The keyboard flickers starting second 20 of video (until second 20 do not flickered, flickering is random at me when I switch keyboard). On iOS I did not meet this problem. https://vimeo.com/417267483

ggunti avatar May 11 '20 16:05 ggunti

It looks to me like the height of the keyboard is changed, is that what you mean? I was unable to reproduce with my code on my device. If one of you can provide an example in which this is reproduced on I'll try to investigate further.

M-i-k-e-l avatar May 14 '20 14:05 M-i-k-e-l

No, it's a very fast flash immediately after second 20. I will try to setup an example, but it is enough hard because as I mentioned, the flash is random.

ggunti avatar May 14 '20 14:05 ggunti

@M-i-k-e-l I was able to setup an example repo: https://github.com/ggunti/math-keyboard-example

You can simply run it for android using the react-native run-android command. In order to reproduce the keyboard flash, for example, try to switch multiple times between Text and Basic Math keyboards: Captură de ecran din 2020-05-15 la 18 56 27

Sometimes, randomly, you should see the flash (like in the video I linked above).

ggunti avatar May 15 '20 16:05 ggunti

Hi @ggunti,

I think I was able to reproduce the problem with your example (thanks for the effort!), however I do not think the problem is within react-native-keyboard-input. If what I saw was what you meant, then I think this has to do with the FlatList. If you allow YellowBox (remove these), you will receive a warning about "Each child in an array should have a unique "key" prop.". I can't say for sure but when I changed the usage from FlatList to ScrollView (see here) the problem did not occur. I suggest that you create a unique key mechanism for your items and hopefully that will solve the problem with FlatList.

I will not close the ticket for now, with the hope that I am correct and you will close it once you solved the issue. Please either close it or let me know this is not resolved and you still think the problem lies within react-native-keyboard-input.

M-i-k-e-l avatar May 21 '20 12:05 M-i-k-e-l

@M-i-k-e-l Thank you for your feedback. The "Each child in an array should have a unique "key" prop." warning was not coming from the FlatList, it was because of the renderRow function inside MathKeyboard class, I forgot to pass a key to the renderButton function.

Now it's fixed: Captură de ecran din 2020-05-21 la 16 56 14

So, now we do not have the "Each child in an array should have a unique "key" prop." warning, but the flickering still happens. I will check what happen if I change the FlatList to ScrollView, as you suggested. I will come back soon.

ggunti avatar May 21 '20 14:05 ggunti

@M-i-k-e-l I think you are right, if we use ScrollView instead FlatList, there is no flickering anymore. The problem is that in my use-case I will have to use the FlatList component because I will need to load more comments when end of the list is reached (infinite-scroll).

So, I'm wondering what could cause the flickering in case of FlatList component. It makes some additional undesired re-rendering when keyboard changes?

FlatList is used frequently, so that's why also other people reported 'flash bug'. Anyhow, it looks that the bug is not in the react-native-keyboard-input package. Anyhow, it would be nice to find a solution also for the case when FlatList is used.

ggunti avatar May 21 '20 15:05 ggunti

Since it's not the key, then I'm not sure what's the correct way to approach this. I agree that using FlatList should be possible and not cause issues.

I'll try to take a look at this again at a later date, please do not close it.

M-i-k-e-l avatar May 21 '20 15:05 M-i-k-e-l