phongyewtong
phongyewtong

Reputation: 5319

How to setup sublime 3 with react native so that when you click on the error and it jump to your code?

How to setup sublime 3 with react native? it say add "add something like
REACT_EDITOR=atom to your .bashrc".

Where can add or edit REACT_EDITOR?

PRO TIP

When you see Red Box with stack trace, you can click any stack frame to jump to the source file. The packager will launch your editor of choice. It will first look at REACT_EDITOR environment variable, then at EDITOR. To set it up, you can add something like REACT_EDITOR=atom to your .bashrc.

Upvotes: 4

Views: 3064

Answers (2)

Gil Perez
Gil Perez

Reputation: 1125

Assuming you are using oh-my-zsh and have already created a symbolic link from subl to sublime and have vim installed:

> vim ~/.zshrc

add:

export REACT_EDITOR=sublime

reload .zshrc:

> source ~/.zshrc

restart app: (example for iOS)

> react-native run-ios

Upvotes: 2

NSKevin
NSKevin

Reputation: 574

I got the same idea as you think of. You can do following:

1.We should make sure that sublime can be used in terminal command. So firstly we make the sublime terminal command.

sudo rm -rf /usr/local/bin/subl

sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin

then we run subl sublime.txt you will find it works.

  1. We should change the .bashrc or .zshrc (if you has installed the oh my zsh) by adding

export REACT_EDITOR=subl

3.We restart the terminal and run react native project then click the error message. Amazing things will happen : ) have fun!

enter image description here

Upvotes: 4

Related Questions