Git Product home page Git Product logo

react-fullscreen-image's Introduction

react-fullscreen-image's People

Contributors

timc1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-fullscreen-image's Issues

Fullscreen responsiveness issue

When showing a image at full screen in some weird screen aspect ratios the image get width/height higher values than the screen:

fullscreen-viewer-issue

"Determine whether we are scaling by height or width. We will scale based on which ever one is smaller." - This is correct when the image has an 1:1 aspect ratio, but with images with different aspect ratio this doesn't work properly.

Instead may use the minimum scale between width (innerWidth / width) scale and height scale (innerHeight / height).

Opacity is white in standard

I have a dark mode switch in my web app. Is there a way to link the opacity color of the fullscreen mode to the context parameter of my dark mode?

How to keep full picture visible?

All the upright pictures are cropped at the upper and lower end. Where do I have to tweak the parameters to get see 100% of the picture when zoomed in?

Error when running React app: `SyntaxError: Unexpected token 'export'`

I have a next.js + React project, and after starting to use this package, I get the following error when I try to run the project:

SyntaxError: Unexpected token 'export'
    at wrapSafe (internal/modules/cjs/loader.js:992:16)
    at Module._compile (internal/modules/cjs/loader.js:1040:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:941:32)
    at Function.Module._load (internal/modules/cjs/loader.js:782:14)
    at Module.require (internal/modules/cjs/loader.js:965:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.react-fullscreen-image (/Users/richardrobinson/WebstormProjects/instantish/web/.next/server/static/development/pages/i/[code].js:420:18)
    at __webpack_require__ (/Users/richardrobinson/WebstormProjects/instantish/web/.next/server/static/development/pages/i/[code].js:23:31)
    at Module../pages/i/[code].tsx (/Users/richardrobinson/WebstormProjects/instantish/web/.next/server/static/development/pages/i/[code].js:222:80)
    at __webpack_require__ (/Users/richardrobinson/WebstormProjects/instantish/web/.next/server/static/development/pages/i/[code].js:23:31)
    at Object.4 (/Users/richardrobinson/WebstormProjects/instantish/web/.next/server/static/development/pages/i/[code].js:364:18)
    at __webpack_require__ (/Users/richardrobinson/WebstormProjects/instantish/web/.next/server/static/development/pages/i/[code].js:23:31)
    at /Users/richardrobinson/WebstormProjects/instantish/web/.next/server/static/development/pages/i/[code].js:91:18
    at Object.<anonymous> (/Users/richardrobinson/WebstormProjects/instantish/web/.next/server/static/development/pages/i/[code].js:94:10)
    at Module._compile (internal/modules/cjs/loader.js:1076:30)
/Users/richardrobinson/WebstormProjects/instantish/web/node_modules/react-fullscreen-image/lib/index.js:1
export { ImageGroup, Image } from './fullscreen';
^^^^^^

I'm using React v16.8.4 and next v9.0.1.

This is my next.config.js:

const { parsed: localEnv } = require('dotenv').config();
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

const path = require('path');
const Dotenv = require('dotenv-webpack');

// next.config.js
module.exports = {
  target: 'serverless',
  serverRuntimeConfig: {
    // Will only be available on the server side
  },
  env: {
  },
  webpack(config) {
    config.plugins = config.plugins || [];

    const rule = {
      test: /\.css$/,
      exclude: /node_modules\/(?!(react-fullscreen-image)\/).*/,
      use: [MiniCssExtractPlugin.loader, 'css-loader'],
    };

    config.module.rules.push(rule);

    config.module.rules.push({
      test: /\.(png|woff|woff2|eot|ttf|svg)$/,
      use: [
        {
          loader: 'url-loader',
          options: {
            limit: 100000,
          },
        },
      ],
    });

    config.module.rules.push({
      test: /\.ts|\.tsx$/,
      use: 'awesome-typescript-loader',
      include: path.resolve(__dirname, '../api'),
    });

    config.plugins = [
      ...config.plugins,

      // Read the .env file
      new Dotenv({
        path: path.join(__dirname, '.env'),
        systemvars: true,
      }),
      new MiniCssExtractPlugin(),
    ];

    return config;
  },
};

and this is my project's tsconfig.json file:

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": false,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve"
  },
  "exclude": [
    "node_modules"
  ],
  "include": [
    "next-env.d.ts",
    "**/*.ts",
    "**/*.tsx"
  ]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.