Skip to content

Commit

Permalink
feat: add local server (#2)
Browse files Browse the repository at this point in the history
* feat: add local server

* feat: allow http connection

* feat: add express dependencies

* feat: update example app

* feat: add preload capability

* feat: update dependencies
  • Loading branch information
kunalchavhan authored Apr 2, 2024
1 parent 0d30ee4 commit 5b83ad2
Show file tree
Hide file tree
Showing 9 changed files with 42,683 additions and 309 deletions.
1 change: 1 addition & 0 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:usesCleartextTraffic="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
Expand Down
12 changes: 5 additions & 7 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import * as React from 'react';

import { StyleSheet, View, Text } from 'react-native';
import { multiply } from 'react-native-server-component';
import { StyleSheet, View } from 'react-native';
import { createServerComponent } from 'react-native-server-component';

export default function App() {
const [result, setResult] = React.useState<number | undefined>();

React.useEffect(() => {
multiply(3, 7).then(setResult);
const { ServerComponent } = React.useMemo(() => {
return createServerComponent({});
}, []);

return (
<View style={styles.container}>
<Text>Result: {result}</Text>
<ServerComponent source={{ uri: 'http://10.0.2.2:8080' }} />
</View>
);
}
Expand Down
Loading

0 comments on commit 5b83ad2

Please sign in to comment.