template-react-native-tsup
v0.0.3
Published
A simple React Native library with WebView functionality
Readme
template-react-native-tsup
A simple React Native library with WebView functionality.
Installation
npm install template-react-native-tsup
# or
yarn add template-react-native-tsupThis package requires peer dependencies:
npm install react-native-webview
# or
yarn add react-native-webviewDevelopment
This project uses tsup for bundling and follows the Total TypeScript tsconfig recommendations.
Available Scripts
npm run build- Build the librarynpm run dev- Build with watch modenpm run typecheck- Type check the codebase without emitting files
Project Structure
src/- TypeScript source filescomponents/- React Native components
dist/- Compiled output (generated)
TypeScript Configuration
The project uses a modern TypeScript configuration with:
- Modern ES2022 target
- React Native JSX support
- Strict type checking
- Optimal library build settings
Components
SimpleWebView
A simple WebView component that displays a web page. By default, it shows example.com.
import React from "react";
import { View } from "react-native";
import { SimpleWebView } from "template-react-native-tsup";
const MyScreen = () => {
return (
<View style={{ flex: 1 }}>
<SimpleWebView
url="https://example.com"
onLoadEnd={() => console.log("Page loaded!")}
/>
</View>
);
};
export default MyScreen;Props
| Prop | Type | Default | Description | | -------------- | -------------------- | --------------------- | ------------------------------------------------ | | url | string | 'https://example.com' | The URL to load in the WebView | | containerStyle | ViewStyle | undefined | Optional style for the WebView container | | onLoadStart | () => void | undefined | Callback when the page starts loading | | onLoadEnd | () => void | undefined | Callback when the page finishes loading | | onError | (error: any) => void | undefined | Callback when there is an error loading the page |
