mirror of
https://github.com/waku-org/waku-lab.git
synced 2025-01-22 13:51:04 +00:00
add react native example
This commit is contained in:
parent
5e1be42b9d
commit
4b7fb2e327
29
examples/react-native/App.js
vendored
Normal file
29
examples/react-native/App.js
vendored
Normal 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',
|
||||||
|
},
|
||||||
|
});
|
31
examples/react-native/app.json
Normal file
31
examples/react-native/app.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
examples/react-native/assets/adaptive-icon.png
Normal file
BIN
examples/react-native/assets/adaptive-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
examples/react-native/assets/favicon.png
Normal file
BIN
examples/react-native/assets/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
examples/react-native/assets/icon.png
Normal file
BIN
examples/react-native/assets/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
examples/react-native/assets/splash.png
Normal file
BIN
examples/react-native/assets/splash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
6
examples/react-native/babel.config.js
Normal file
6
examples/react-native/babel.config.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module.exports = function(api) {
|
||||||
|
api.cache(true);
|
||||||
|
return {
|
||||||
|
"presets": ['babel-preset-expo'],
|
||||||
|
};
|
||||||
|
};
|
13
examples/react-native/metro.config.js
Normal file
13
examples/react-native/metro.config.js
Normal 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;
|
32
examples/react-native/package.json
Normal file
32
examples/react-native/package.json
Normal 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
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user