Skip to content

Instantly share code, notes, and snippets.

@pytqqq
Created April 12, 2023 09:20
Show Gist options
  • Save pytqqq/f34b963ff52e98f8c7ed76a5b8d2d001 to your computer and use it in GitHub Desktop.
Save pytqqq/f34b963ff52e98f8c7ed76a5b8d2d001 to your computer and use it in GitHub Desktop.
import React from "react";
import { Federated } from "@callstack/repack/client";
import { ActivityIndicator, StyleSheet, View } from "react-native";
const MiniAppNavigator = React.lazy(() =>
Federated.importModule("MiniApp", "./MiniAppNavigator")
);
const FallbackComponent = () => (
<View style={styles.container}>
<ActivityIndicator size="large" />
</View>
);
const MiniAppScreen = () => {
return (
<React.Suspense fallback={<FallbackComponent />}>
<MiniAppNavigator />
</React.Suspense>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
},
});
export default MiniAppScreen;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment