Skip to content

Commit

Permalink
Re-initialized Expo example app and extracted RN components into a se…
Browse files Browse the repository at this point in the history
…parate package (#107)

* Re-initialized Expo example app and extracted RN components into a separate package

* Specifying files for the package
  • Loading branch information
kraenhansen committed Mar 19, 2024
1 parent 23a271c commit 5ada93e
Show file tree
Hide file tree
Showing 10 changed files with 10,717 additions and 12,718 deletions.
102 changes: 0 additions & 102 deletions examples/expo/App.js

This file was deleted.

49 changes: 49 additions & 0 deletions examples/expo/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { StatusBar } from 'expo-status-bar';
import React from "react";
import { StyleSheet, View, SafeAreaView } from 'react-native';

import { MochaRemoteProvider, ConnectionText, StatusEmoji, StatusText } from "mocha-remote-react-native";

function loadTests() {
require('./simple.test.js');
}

export default function App() {
return (
<MochaRemoteProvider tests={loadTests}>
<StatusBar hidden />
<SafeAreaView style={styles.container}>
<ConnectionText style={styles.connectionText} />
<View style={styles.statusContainer}>
<StatusEmoji style={styles.statusEmoji} />
<StatusText style={styles.statusText} />
</View>
</SafeAreaView>
</MochaRemoteProvider>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
},
statusContainer: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
statusEmoji: {
fontSize: 30,
margin: 30,
textAlign: "center",
},
statusText: {
fontSize: 20,
margin: 20,
textAlign: "center",
},
connectionText: {
textAlign: "center",
},
});
8 changes: 3 additions & 5 deletions examples/expo/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ const path = require('path');
// Find the project and workspace directories
const projectRoot = __dirname;
// This can be replaced with `find-yarn-workspace-root`
const workspaceRoot = path.resolve(projectRoot, '../..');
const monorepoRoot = path.resolve(projectRoot, '../..');

const config = getDefaultConfig(projectRoot);

// 1. Watch all files within the monorepo
config.watchFolders = [workspaceRoot];
config.watchFolders = [monorepoRoot];
// 2. Let Metro know where to resolve packages and in what order
config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, 'node_modules'),
path.resolve(workspaceRoot, 'node_modules'),
path.resolve(monorepoRoot, 'node_modules'),
];
// 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths`
config.resolver.disableHierarchicalLookup = true;

module.exports = config;
15 changes: 8 additions & 7 deletions examples/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@
"dependencies": {
"expo": "~50.0.13",
"expo-status-bar": "~1.11.1",
"mocha-remote": "1.8.0",
"mocha-remote-react-native": "1.8.0",
"react": "18.2.0",
"react-native": "0.72.6",
"@types/react": "~18.2.66",
"react-native-web": "~0.19.10",
"react-dom": "18.2.0",
"@expo/webpack-config": "^19.0.1"
"react-native": "0.73.5"
},
"devDependencies": {
"@babel/core": "^7.24.0"
"@babel/core": "^7.20.0",
"@react-native/eslint-config": "0.73.2",
"@types/react": "~18.2.45"
},
"eslintConfig": {
"extends": ["@react-native"]
}
}
7 changes: 6 additions & 1 deletion examples/expo/simple.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ describe("A test suite", () => {

it("can succeed", (done) => {
// It might take some time to succeed
setTimeout(done, 1000);
setTimeout(done, 500);
});

it("can succeed twice", (done) => {
// It might take some time to succeed again
setTimeout(done, 500);
});
});
6 changes: 4 additions & 2 deletions examples/expo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"compilerOptions": {},
"extends": "expo/tsconfig.base"
"extends": "expo/tsconfig.base",
"compilerOptions": {
"strict": true
}
}
Loading

0 comments on commit 5ada93e

Please sign in to comment.