React Native TouchableNativeFeedback - react-native

Using React-Native has a long press error
Using TouchableHighlight And TouchableNativeFeedback
Attempted to transition from state RESPONDER_INACTIVE_PRESS_IN to RESPONDER_ACTIVE_LONG_PRESS_IN
My code

This issue usually only appears in android when you are debugging.
This issue https://github.com/facebook/react-native/issues/5823 goes into further detail.
Try turning debugging off and see if you still get the error.

Aligning the clocks on your phone and computer may solve this problem. My experience is that the two clocks do not need to be exact match, just make sure they are not off by more than a few seconds. You can easily achieve this by adjusting one clock manually.

Yes the same issue I faced it, after a much more research I found its's solution that instead of using TouchableHighlight, you can use TouchableOpacity component .
For detail refer this link -
http://androidseekho.com/others/reactnative/how-to-solve-touchable-longpressdelaytimeout-problem-in-react-native/

Related

rendering different screen based on input by the user React Native

Hello fellow programmers, i wanted to ask how can i achieve different screen rendering based on input by the user. I have done it in one way but i want to know is there any better way to do?
Attached is the link to snack on expo. You can run it and see the code of how i have done it.
If there are better alternates, please let me know.
Thankyou.
please dont mark the question as duplicate before going throught it.
For better choice you can using react-navigation https://reactnavigation.org/docs/auth-flow/ This package work in Expo
The example you posted looks mostly like something I would use conditional rendering techniques for like the && syntax
See here for more guidance:
https://reactjs.org/docs/conditional-rendering.html
If your pages are dramatically different though (not just options flipping on and off) then I would recommend react navigation as giri commented.

React Native / Expo input lags on more than one TextInput

I have been trying to fix this weird problem I am facing with React Native/Expo. I was working on an Authentication page. It is a simple username and password input form. It was going okay for a few weeks until yesterday when the TextInput component started lagging. The weird part is it only lags in my device (Iphone X). When I use a virtual device, it runs fine and there is no lagging when I input something in the TextInput.
I also want to mention that it is not just my code but if a component has more than once TextInput, the TextInput becomes laggy and super slow when anything is typed.
I have tried:
Restarting my phone
Deleting the expo app and downloading it again
Running the app in production mode
Nothing seems to work and the component is still lagging. Has anyone else faced such problem? I have created this simple snack:
https://snack.expo.io/#ayushdev/9d2af8
The issue still persist in this simple snack too.
You should try state colocation here. Other things constant, that is expected to give you at least some speedup.
Separate out the different InputText components in your form, each updating their own states only. This ensures that the entire form is not re-rendered as you change the input in just one of those fields.

Fonts getting cut down in react native on One Plus, Oppo etc

I am facing a very rare and unseen issue that the fonts are getting worn out on some of the devices like the One Plus, Oppo etc.
I don't know what's the reason behind that. But this is a device specific issue on some devices only.
Well, If anyone comes across the same problem I have the solution for them :
Add a space " " at the end of the text
Give the Text a set width.
There is a proposed component at the bottom of the issue.
You can refer to this react native issue link
Also, this expo link helps
But, my main concern is these all are hacks. Is there any rock solid answer to solve these things? Why to do extra work, why can't react native solve that? Or are there any permanent solutions to fix this?
Please don't mark it as duplicate. I have the answer, I want to know the reason or any global answer to solve that in one go. I dont want to change all my 1000 text styles. :(

How to detect a screenshot in a RN application?

I'm having some problem about a screenshot-detector in an application.
I'm using EXPO, but I've no idea about how can I detect a screenshot.
Suppose that I've a profile screen. Each user has a profile page, I want to detect when another user does a screenshot on the screen.
My problem is: how can I detect this? I readed about the gesture here, but it didn't help me. With the gestures I can detect, instead, the scroll in a page, the location x and location y.
I readed also this answer, but about the event touchesCancelled:withEvent:touchesCancelled:withEvent: I have not found anything in React Native docs (and also EXPO docs).
So: which is the idea behind a screenshot detector? Thanks for your help!
You can't do it without detaching EXPO. There is already a feature request for that.
If you decide to detach EXPO, react-native-screenshot-detector might be helpful. The solution is very similar to the one from the linked question.
Currently with expo there is no way to do that, But if you detach you can use this package it supports android&ios screenshot detecting react-native-detector

IntelliJ IDEA 2018.2 shows code completion ctrl+space hints and dissapear after 0.5 sec

I'm working with IDEA 2018.2, and when I use intellisense/autocomplete, hints dissapears after about 0.5 sec. I use ctrl+space, see hints and I can't even read them all when it's gone.
It all started when I began new project in React Native, in my Java projects everything works fine.
I looked in Settings->Editor->Code Completion and didin't find anything.
Also I can mention that since i began React Native project, on my bottom bar file indexation blinks for a while every 2 sec. (that's another problem for another topic, but it might be connected).
CrazyCoder's solution fixed my problem.
I updated my IntelliJ to newest version (EAP), and it resolved both problem, with blinking indexing and broken intellisense.
Reposting link for community: https://confluence.jetbrains.com/display/IDEADEV/EAP
Had the same problem File > Invalidate Caches / Restart fixed it for me.