React-native: Cmd-R not refreshing?

Created on 27 Mar 2015  ·  49Comments  ·  Source: facebook/react-native

Everything loads up fine, example are are running smoothly, but if I make a change in the JS file and hit Cmd-R in the simulator, nothing happens. Did I forget something?

xcode - Version 6.2 (6C131e)
simulator - Version 8.2 (553.8
watchman - 3.0.0
node - 0.12.1

Locked

Most helpful comment

Turns out it's a simple hardware keyboard setting in the simulator menu. Never would have thought to check that, especially since things like alt-drag work for multi-touch emulation without this setting enabled.

image

All 49 comments

+1 -- I've even deleted the folder, re-created a new folder, run the app, and I'm still seeing my changes from before the delete.

xcode - Version 6.2 (6C131e)
yosemite - 10.10.1
node 0.12.0

Can you try restarting your computer? The FileWatcher might be in a bad state

I restarted a few times, uninstalled/reinstalled node and watcher, and now reinstalling xcode.

It works fine for me. Make sure to use the latest stable version of XCode, and install XCode Command Line Tools.

Installing xcode from the app store, should I grab a different one?

I doubt Xcode is the problem here. If the app opens in the simulator and renders it's probably something in the packager. This is a long shot but maybe the packager is run in in the wrong directory. Can you go to the directory you're changing and manually start the packager? You can use react-native start

I was running npm start from react-native root, but even starting it deeper in still pacakages from the main directory.

> [email protected] start /Users/me/react/react-native
> ./packager/packager.sh

Also watching some others on youtube and it seems there's a blink or flash in the simulator on the reload. When I hit Cmd-R there's no blink or anything, nothing happens at all.

Are there any logs in your terminal? It should say something about the
requests and time taken.

If there aren't any then there might be something wrong with the Cmd r
itself

On Thursday, March 26, 2015, tehfailsafe [email protected] wrote:

Also watching some others on youtube and it seems there's a blink or flash
in the simulator on the reload. When I hit Cmd-R there's no blink or
anything, nothing happens at all.


Reply to this email directly or view it on GitHub
https://github.com/facebook/react-native/issues/306#issuecomment-86816774
.

When I make a change in the editor I see this in the terminal:

[21:46:15] <START> find dependencies
[21:46:15] <END>   find dependencies(5ms)
[21:46:15] <START> transform
[21:46:15] <END>   transform(189ms)

But that is when I save from the editor, before attempting to hit Cmd-R

hitting Cmd-R in the simulator produces no logs in the terminal or in xcode console.

You have to hit Cmd+R twice, every time :)

I am spamming it 50 times, doubt that's the problem... :)

Fun note, learned from @jordwalke on twitter to use the shake gesture to bring up the dev dialog, and reloading from there works great. Also enabling live reload now works by just saving the JS file without touching Cmd-R.

Turns out it's a simple hardware keyboard setting in the simulator menu. Never would have thought to check that, especially since things like alt-drag work for multi-touch emulation without this setting enabled.

image

Glad you could figure it out. What to send a PR with the tip?

On Mar 26, 2015, at 10:41 PM, tehfailsafe [email protected] wrote:

Turns out it's a simple hardware keyboard setting in the simulator menu. Never would have thought to check that, especially since things like alt-drag work for multi-touch emulation without this setting enabled.


Reply to this email directly or view it on GitHub.

Sure first thing in the morning!
On Thu, Mar 26, 2015 at 10:45 PM Spencer Ahrens [email protected]
wrote:

Glad you could figure it out. What to send a PR with the tip?

On Mar 26, 2015, at 10:41 PM, tehfailsafe [email protected]
wrote:

Turns out it's a simple hardware keyboard setting in the simulator menu.
Never would have thought to check that, especially since things like
alt-drag work for multi-touch emulation without this setting enabled.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
https://github.com/facebook/react-native/issues/306#issuecomment-86834621
.

@tehfailsafe Fixed, thanks!

326 is related. If you don't have a qwerty/azerty keyboard layout, it won't work

Unfortunately, the keyboard toggle does not fix the issue for me. Have tried that as well as uninstalls and reboots. Two near identical machines:

Yosemite 10.10.2
Xcode 6.2
iOS Simulator 8.2
node v0.12.1

First run of the project:

[12:26:54 AM] <START> request:/index.ios.bundle
[12:26:54 AM] <START> find dependencies
[12:27:00 AM] <END>   find dependencies(6496ms)
[12:27:00 AM] <START> transform
[12:27:00 AM] <END>   transform(202ms)

Cmd-R (2x) in the simulator causes a screen flash, as if a reload is happening; but new content is not pulled in.

@rywhee no <END> request:/index.ios.bundle event?

@amasad my bad, I snipped it!

[12:39:38 AM] <START> request:/index.ios.bundle
[12:39:38 AM] <START> find dependencies
[12:39:44 AM] <END>   find dependencies(5888ms)
[12:39:44 AM] <START> transform
[12:39:45 AM] <END>   transform(234ms)
[12:39:45 AM] <END>   request:/index.ios.bundle(6140ms)

So it seems like the simulator is requesting the package and receiving it. Maybe the packager isn't picking up your changes. Try stopping the packager and starting it manually via react-native start in your project dir.

Thanks @amasad. Unfortunately, a manual start does not resolve the issue for me.

FYI - I have had to bump MAX_WAIT_TIME in FileWatcher to avoid the 'Watcher took too long to load' error...

Does it at least pick up changes between stopping and starting the packager? (Trying to make sure it's not a file watcher issue)

@amasad yep, when stopping then re-starting the packager; changes are picked up fine. It's just the live reload that's not happening.

@rywhee are you using sublime text 3? I had to disable atomic save for refresh to work properly.

My issue refresh issue was related to watchman permissions.... solved here

facebook/watchman#90

Closing this issue for now since it seems resolved, please re-open if you face it again

If you have time please update the troubleshooting page with the your workarounds/fixes.

updated to add the watchman permissions fix.
https://github.com/facebook/react-native/pull/585

@rywhee Thanks dude! Solved all my issues!

@eyaleizenberg :thumbsup: - happy coding!

In case somebody is using Dvorak layout, you need to refresh with Cmd+P.

Maybe it's just caused by the different build mode,you need to change the build mode into debug if it is release mode currently. command+R and command+D is the special key combination while you debug the program with simulator....the concrete step is : [In Xcode 6 & 7] Choose Product -> Scheme -> Edit Scheme. Change the Build Configuration under the Info tab.
hope that it will work for you

@Bob1993 many thanks, was as simple as such!

@dvisco It's my pleasure ~

@Bob1993 Ditto -- forgot I had to change the scheme back to debug!

@sashafklein Hahahaha...

@tehfailsafe save my life. 👍 I added a reaction to make sure the others can see it.

@jordanfloyd thanks ,solved my problem
does that mean autosave will disable live loading ?

@tehfailsafe thanks, it is work!

@Bob1993 Thank you so much! Yes changing the mode to Debug fixed this refresh issue for me.

I have this issue.
Mac os : Sierra.
watchman : 4.7.0
react-native : 0.38.1
react-native-cli: 1.2.0
xcode : 8.1
I did watchman install --HEAD ... not work..

Solved.. with one line of command.. But, I did some other stuffs, so I am not sure this is the only source.

rm -rf /usr/local/var/run/watchman/ && brew uninstall watchman && brew install watchman

Quit the simulator and start again. Works for me.

image

In my case I could only get cmd+R working after disabling "Send Menu Shortcuts to Device":

captura de tela 2018-02-25 as 00 24 59

in my case my build configuration was set to release. changing it to debug solved the problem

For me, a restart of the simulator worked: "Hardware" -> "Restart"

Was this page helpful?
0 / 5 - 0 ratings