0.0.5 • Published 1 year ago

@unitools/image-expo v0.0.5

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

@unitools/image ALPHA

This is the official documentation of the @unitools/image package.

For Next.js

Installation

npm install @unitools/image
npm install -D @unitools/babel-plugin-image

or

yarn add @unitools/image
yarn add -D @unitools/babel-plugin-image

Add module resolver to your next.config.js file.

// next.config.js

module.exports = {
  webpack(config) {
    config.resolve.alias["@unitools/image"] = "next/image";
    return config;
  },
};

For Expo

Installation

npm install @unitools/image expo-image
npm install -D @unitools/babel-plugin-image

or

yarn add @unitools/image expo-image
yarn add -D @unitools/babel-plugin-image

Add babel plugin to your babel.config.js file.

// babel.config.js

module.exports = {
  plugins: [
    [
      "@unitools/babel-plugin-image",
      {
        assets: "src/assets", // Path to your assets folder where images are stored
      },
    ],
  ],
};

Usage

import Image from "@unitools/image";

export default function Home() {
  return (
    <View>
      <Image src="/logo.png" alt="Logo" width={200} height={200} />
    </View>
  );
}

Props

PropTypeDefaultDescriptionStatusSupport Status
srcstring | NextImage TypeImage sourcerequired
altstringImage alt textrequired
widthnumberImage widthrequired
heightnumberImage heightrequired
loaderstringImage loader-
fillstringImage fill-
sizesstringImage sizes-
qualitynumber (integer 1-100)Image quality-
prioritybooleanImage priority-
placeholderstringImage placeholder-
styleobjectImage style-
onErrorfunctionError function-
onLoadfunctionLoad function-
onLoadingCompletefunctionCallback function-
loadingstringImage loading-
blurDataURLstringImage blur data-
0.0.3

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.2

1 year ago