Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Problem with example #11

Open
Lauman opened this issue Nov 24, 2022 · 1 comment
Open

Problem with example #11

Lauman opened this issue Nov 24, 2022 · 1 comment

Comments

@Lauman
Copy link

Lauman commented Nov 24, 2022

Describe the bug
I followed the code in the example but I get an error in the build.

SDK Version

  • Client: React Native
  • Version 0.70.5

To Reproduce
Steps to reproduce the behavior:

  1. Create a new project.
  2. Install a package @waku/react-native.
  3. Copy example.
  4. Build and run the project.

Screenshots
Error1

Thanks!

@fryorcraken fryorcraken added this to Waku Nov 24, 2022
@richard-ramos
Copy link
Member

@Lauman, do you see this issue if you execute the following?

npx create-react-native-app
cd YOUR_PROJECT_NAME_GOES_HERE
npm install @waku/react-native

edit App.js with this example code:

import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { newNode, start, isStarted, peerID} from '@waku/react-native';

export default function App() {

  React.useEffect(() => {
    (async () => {
      const nodeStarted = await isStarted();
      if (!nodeStarted) {
        await newNode(null);
        await start();
      }
      console.log("The peer ID:", await peerID())
    })();
  }, []);

  return (
    <View style={styles.container}>
      <Text>Open up App.js to start working on your app!</Text>
      <StatusBar style="auto" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Execute npm run ios
The app should run succesfully in the emulator, and print also in the terminal the peer ID of the node.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants