Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in native call from js #110

Open
rishikeshwovvtech opened this issue Dec 28, 2021 · 3 comments
Open

Exception in native call from js #110

rishikeshwovvtech opened this issue Dec 28, 2021 · 3 comments

Comments

@rishikeshwovvtech
Copy link

rishikeshwovvtech commented Dec 28, 2021

Im getting following error not able to proceed further

Screenshot 2021-12-28 at 2 32 40 PM

Here is my code

  import React, { useRef, useState, useEffect } from 'react';
  import { View, Text } from 'react-native';
  import StaticServer from 'react-native-static-server';
  const serverConfig = { localOnly: true, keepAlive: true };
  const App = () => {
    useEffect(() => {
       let server = new StaticServer(8080);
      // Start the server
      server.start().then((url) => {
        console.log("Serving at URL", url);
      });
   }, []);

  return (
    <View style={{ flex: 1, backgroundColor: 'red' }}>
    </View>
  )
}
export default App;

package.json

"dependencies": { "react": "16.8.1", "react-native": "0.61.3", "react-native-static-server": "^0.5.0" },

@freddygarcia
Copy link

Same here

@stockhuman
Copy link

Take your server instantiation out of useEffect, you're using the hook improperly.

@yasintorun
Copy link

I got the same error.
I solved it by entering the path value.

new StaticServer(8080, RNFS.DocumentDirectoryPath); // <- added path

It worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants