timc1 / react-fullscreen-image Goto Github PK
View Code? Open in Web Editor NEWAn accessible, fast, and snappy fullscreen React image viewer.
License: MIT License
An accessible, fast, and snappy fullscreen React image viewer.
License: MIT License
When showing a image at full screen in some weird screen aspect ratios the image get width/height higher values than the screen:
"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).
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?
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?
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"
]
}
Are you planning to implement the possibility to trigger a fullscreen view outside of the image?
Example: I want to have a button with the text Full size
or Show full size
near the image or gallery.
Hi, my picture overview is a page below a appbar and right of a sidelist similar to that example:
https://mui.com/material-ui/getting-started/templates/dashboard/
When I go into fullscreen by clicking on one pic, the left arrow and the x button hide behind the appbar/sidelist respectively.
Can I avoid that by setting some parameter in the fullscreen.css?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.