2
votes

I am following the official react native documentation to install and run a sample react native app. I created a sample app by doing:

create-react-native-app AwesomeProject

cd and then I installed Expo app as directed and scanned the QR code and I opened the app.js file

app.js

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

export default class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <Text>Open up App.js to start working on your app!</Text>
        <Text>Changes you make will automatically reload.</Text>
        <Text>Shake your phone to open the developer menu.</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },https://stackguides.com/questions/278192/view-the-change-history-of-a-file-using-git-versioning
});

Then I removed <Text>Shake your phone to open the developer menu.</Text> and saved to check if the changes on the editor are reflecting on the mobile app. But I am not seeing any changes on the expo app yet. I even opened the chrome browser on android mobile and entered the ip address, still no changes.

2
Did you try to shake your device (or Cmd+M on emulator) and Reload JavaScript?jevakallio
I tried shaking my phone several times but didnt workuser3576036
I've noticed that on (some) Android devices, the shaking is a bit flakey, and you need to really put your wrist in it! :) - However, the app won't automatically reload the javascript until you turn on either Live reload or Hot reload from the developer shake menu. If you really can't get the shake menu to appear, then that's a problem.jevakallio
You were right. I had to shake it real hard to even get that js load menu. Once I enabled Hot Reload the changes started appearing.user3576036

2 Answers

8
votes

The app won't automatically reload the JavaScript until you turn on either Live reload or Hot reload from the developer menu.

The dev menu can be accessed by shaking the device, or pressing Cmd+D on iOS simulator, or Cmd+M on the Android simulator. Note that on some Android devices, the shake needs to be quite vigorous to register.

1
votes
  1. Make sure npm server is running(if not start the service by command 'npm start')
  2. Access developer menu by shaking device or use command 'adb shell input keyevent 82 ' or press ctrl+M (on linux)
  3. Select 'Enable Live Reload' from dev menu option
  4. The screen should reload with your changes once you save it.