React Native events do not work - ios

I have a trivial react component that only shows a button:
<Button onPress={() => console.log("test")} title="Button"/>
When I put this button into a project I created with react-native init, it works as expected.
However, I have an existing project into which I integrated React Native (0.51.0) manually (because it doesn't use cocoa pods; I followed this guide: https://medium.com/#joshyhargreaves/adding-react-native-to-existing-ios-project-without-cocoapods-6f1ee9106009).
The project seems to work fine: the UI loads, the button gives visual feedback when I tap it. But the buttons onPress event is not fired, so it does not log anything.
There are no errors or warnings (except Class RCTCxxModule was not exported, but it seems to be safe to ignore this).
I'm now out of ideas of what I could try or how I could debug this issue short of diving into Reacts touch handling code. Here's what I tried:
Made sure to only have one RCTRootView, and that it is created in the main thread.
Checked for any suspicious things happening in the remote debugger; everything looks normal (no exceptions thrown or warnings logged).
Tested a few other components that should fire events; for example, TouchableOpacity does not work either.
Logging something after a timeout does work, so it doesn't seem like anything is deallocated prematurely
Checking for errors reported by the metro bundler: it doesn't print anything
Any ideas on what I need to do to get my button to print "test" when I tap it?

I think you have not Debug JS Remotely option enabled. If you don't you have to open React Native Debug Menu Pressing (command / control) + D or shake your device if you are debugging with real device. Then just press Debug JS Remotely and it should appear in the Google Chrome. Then inspect and open the console. There it is!

This mite caused by date diff between the host (your computer) and the client (the mobile device)
You can check this by running adb shell "date" && date
to see if there is a diff.
If there is one go to your mobile device and toggle automatic date & time off and back on.
Then test time diff again as mentioned, if there is no more diff, tap events should work in debug mode
More details in the original git issue answer by - Alex Ciarlillo

Related

(click) event is not working only on IOS devices - angular 10 app

I noticed that my buttons are not working on the IOS devices, it seems that the click event is not called. Everything is working perfectly on the windows, android, Linux. Since I don't have access to any mac I was trying to debug it on the browserStack, I am getting this error every time I am trying to click the button:
ERROR TypeError: undefined is not an object (evaluating 't.path[4]')
I might be completely wrong, but I think that it might be related with the SVG's rect that is inside of the button (I am using it as a progress bar), on the rect load event I am accessing it to find its length. Maby it is called "too early" so it cannot access the rect correctly. Previously I was using the ngAfterViewInit with the setTimeout inside to manage the same effect.
<rect
#rect
width="96"
height="96"
rx="8"
fill="none"
stroke-width="4"
[ngStyle]="{
'stroke-dasharray': strokeDasharray,
'stroke-dashoffset': strokeDashoffset
}"
(load)="getRectLength()"
/>
getRectLength() {
this.length = this.rect.nativeElement.getTotalLength();
this.strokeDasharray = this.length;
}
Code:
https://github.com/mateuszkornecki/chess-clock/tree/master/src
Live demo:
https://mateuszkornecki.github.io/chess-clock/settings
Steps to reproduce:
Simply click on one of the big buttons with the counter, after a click it should start counting.
I tested it on several IOS devices, it was not working on everyone regardless of the IOS version. That's my first project made with Angular so there is a chance that I've made a simple mistake. Any help will be appreciated!
I have found the source of the problem. I was trying to use the event.path array on the click event. It looks that it is not available on the Safari. I fixed the problem by using the event.composedPath instead of the event.path
References:
https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath

view iphone console logs without a mac

Is there a way to view the iphone console logs without having a mac ?
It used to be possible using the iPhone Configuration Utility but it does not seem to be available any longer.
I saw a tool called iTools but it seems to require a 32bit version of itunes which is also not available any more.
Given an iPhone device + windows + linux, Is there any workaround / tool to view the iphone console logs?
Realizing it is over half a year ago you asked this, but since it does not have an accepted answer yet:
I ran into this very same issue over and over, and got fed up with it, so I decided to have a go at writing a script that displays console messages in HTML, so you can just view everything in the webpage itself, without having to resort to a console-replacement or a tedious remote debugger (for which you, indeed, require a Mac), without having to modify each console call in existing code.
The key lies in 'replacing' the four main functions in window.console: log, warn, error and trace. This is done by redifining each method, adding own code to that, and calling the original method in the end. Jakub Fiala wrote the basic script for that, on which I built the rest: https://gist.github.com/jakubfiala/8fe3461ab6508f46003d
I dubbed it 'MobileConsole'. It is quite unobtrusive and will 'catch' all console.log (or .warn, .error or .trace) events, and even bind to window.onerror.
I have created a separate page for this script with an elaborate explanation on how it works, including a demo, over here.
Download this from the app store onto the iphone, you can then view logs directly on the phone:
https://itunes.apple.com/us/app/console/id317676250?mt=8
Please note, this is an old app, it will crash when launched, then on reopening it will show you the device logs.
If that fails, here is a link to the iPhone configuration utility for windows:
http://download.cnet.com/iPhone-Configuration-Utility-for-Windows/3000-20432_4-10969175.html

Keyboard events in atom-shell

I am trying to use atom-shell, but I don't understand how the DOM events differ from a normal browser. I can't find doc about it either.
If I add:
document.onkeydown = function() { alert('...'); }
to index.html, it seems that atom-shell doesn't capture the event, and instead forwards the call to the terminal in which I ran atom-shell myapp.
Is there any documentation somewhere about how the DOM events work in atom-shell?
Edit: This only happens when I run atom-shell from the terminal window (in OSX). If I run the app by first starting the Atom application and dragging my app inside the drag area, then it works fine...
It's a bug: here is the GitHub issue

Google Chrome does not render page after losing focus in AwesomeWM

I have installed fresh Arch Linux with linux-ck and awesomewm. After that I have installed google-chrome and started it. Everything works well, but if I open other application (chrome lose focus) and then got back to the chrome, it freezes. Mouse cursor works as expected (cursor changes after hovering link, input field, etc) but view is not updated.
Everything works well again if I change desktop to the second and go back to the first again (mod+2, mod+1). Chrome works, responses etc well.
I bet this issue has something in common with hardware acceleration. If I run some game (steam), lose focus, get back to the game - it shows last rendered screen before focus has been lost (sound is ok, game is responsible but does not update screen).
I use nvidia. Do I need some extra configuration to handle it ?
You want to disable "Use hardware acceleration when available" in Chrome settings.
For me, disabling hardware acceleration as Alex pointed out solved the issue. This bug has been brought forward before in awesome's issues GitHub page.
Apparently, the problem is not awesome. Graphics drivers might be involved but the main suspect seems to be the compositing manager. Running awesome with the "--no-argb" flag and disabling the comp manager seems to solve the problem.
The problem was xcompmgr which caused "freezing" view. I switched it to unagi and all of the problems have gone.

Pspad "File contents were changed. Reload?" dialog bug

I've been using PsPad for quite some time now, always on Windows XP never a problem. But since I've upgraded to Windows7, PsPad is throwing the confirmation dialog "File contents were changed. Reload?" when it doesn't have to. I can reproduce this annoying message by: editing a file, saving it (to the fileserver win3k over a network), viewing that file/page in the browser, going back to PsPad to work on the file. After that last point it throws the dialog, while obviously nothing has changed in the meantime.
Does anybody experience the same bug? Is there something to do about it? PsPad forum has a thread about this, but no solution is provided there.
You can switch it off in program settings / Direct edit button
CheckDocChanges=0
You can switch it off in program settings / Direct edit button CheckDocChanges=0
The DIRECT EDIT button it's a button to the left of the OK button on the program settings dialog box ( in version 4.5.4 ). It's not entirely intuitive but it's there alright if you look.
This occurs because the time on your server and your workstations are not in sync. You can set your workstation to synchronize with the same timeserver as your server, which you will have to find out yourself or from your admin.
To change the time server on your workstation do the following
Open date and time
Go to Internet Time
Change Settings
Put in the server
Click update now and OK

Resources