add react native example

This commit is contained in:
Sasha 2024-03-27 13:41:40 +01:00
parent 5e1be42b9d
commit 4b7fb2e327
No known key found for this signature in database
9 changed files with 111 additions and 0 deletions

29
examples/react-native/App.js vendored Normal file
View File

@ -0,0 +1,29 @@
import 'event-target-polyfill';
import 'text-encoding-polyfill';
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';
import { createLightNode } from "@waku/sdk";
export default function App() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<StatusBar style="auto" />
<Waku />
</View>
);
}
const Waku = () => {
const node = createLightNode();
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});

View File

@ -0,0 +1,31 @@
{
"expo": {
"name": "tmp",
"slug": "tmp",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#ffffff"
}
},
"web": {
"bundler": "webpack",
"favicon": "./assets/favicon.png"
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -0,0 +1,6 @@
module.exports = function(api) {
api.cache(true);
return {
"presets": ['babel-preset-expo'],
};
};

View File

@ -0,0 +1,13 @@
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');
const path = require("path");
/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname);
config.resolver.unstable_enablePackageExports = true;
config.resolver.extraNodeModules = {
"url": path.resolve(__dirname, "node_modules", "react-native-url-polyfill"),
};
module.exports = config;

View File

@ -0,0 +1,32 @@
{
"name": "tmp",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"@expo/metro-runtime": "~3.1.3",
"@expo/webpack-config": "~19.0.1",
"@waku/sdk": "^0.0.23",
"event-target-polyfill": "^0.0.4",
"event-target-shim": "^6.0.2",
"expo": "~50.0.13",
"expo-status-bar": "~1.11.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.73.6",
"react-native-url-polyfill": "^2.0.0",
"react-native-web": "~0.19.6",
"text-encoding": "^0.7.0",
"text-encoding-polyfill": "^0.6.7"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"babel-plugin-module-resolver": "^5.0.0"
},
"private": true
}