I am building a react-native application that should work in both the Android simulator and the iOS simulator. I've been developing primarily on my Windows machine, and I would use command prompt react-native run-android
to see my changes in an Android simulator. Once in a while, I would go to my mac mini, do a git pull origin master
, and then run react-native run-ios
to see my changes in an iOS simulator.
Everything has been working fine until a few days ago. Now when I'm on my mac mini, the following will happen:
react-native run-android
from my terminal, I see my latest react-native changes in the android simulator, which is perfect react-native run-ios
from my terminal, I see an EARLIER/OLDER version of my react-native changes of the ios simulator. This is NOT what I want. I want my ios simulator to show my latest changes the way a developer would expect. I tried typing garbage, syntax errors, deleting files in my react-native project to see if the compiler will respect these errors and fail, but it does not. The react-native run-ios
command ignores my clearly broken project and continues to build the same earlier version of my react-native project and puts it in the ios simulator. I tried deleting the project, and doing a fresh new git pull, but still the same issue occurs and simulator shows the same earlier version of my project. Why won't my react-native run-ios
command build the latest version of my react-native code and put it in the ios simulator?
Ok, I found a workaround.
I started a completely new react-native project with the react-native init <sameprojectnameasmybrokenproject>
. Then I copied all my react components and project files (The ones that I created, and not the stuff that react creates boiler templates for) and my package.json file from my broken project to my new project. Then I ran react-native run-ios
to make sure this new project works fine.
EDIT
I also copied these four files from my new project into my broken project, and it got the broken project to show the latest build versions again.
So something about these four files was broken in my broken project.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.