0.0.0 • Published 4 months ago

@dynamix/fs v0.0.0

Weekly downloads
-
License
-
Repository
github
Last release
4 months ago

@dynamix/fs

Dynamix filesystem utilities. This package is a utility package for handling file transfer between the host and the webview.

This package is compatible with

  • React Native
  • React
  • Vue
  • Other JS frameworks

Installation

yarn add @dynamix/fs

Usage

Below example is using React for host and React Native for webview.

// WEB NextJS
// mypage/page.tsx
import { useDynamix } from "@dynamix/react";

function WebMyPage(){
  const [photo, setPhoto] = useState(null);

  const onPhotoSelectClick = usePhotoPicker({
    readAs: "DataURL",
    multiple: false,
    onLoad: setPhoto
  });

  return (
    <Avatar onClick={onPhotoSelectClick} src={photo}/>
  )
}

// WEBVIEW on React Native
// pages/mypage.tsx
import { WebView } from "@dymamix/react-native";
import fs from "@dynamix/fs";

function AppMyPage() {
  return (
    <Webview>
      <DynamixFSProvider fs={fs}/>
    </WebView>
  )
}