next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Responsive layouts not working on mobile phone

Open dbrowne24 opened this issue 8 years ago • 5 comments

Bug report

Describe the bug

I have created a next js application. I have used both semantic ui and bootstrap to create some simple responsive layouts in pages/index.js

These layouts are pretty much just some grids that should collapse on smaller screens such as mobiles.

I have deployed the app to a server. I'm using pm2 to manage the app and nginx as a reverse proxy.

Everything works perfectly on a computer. You can shrink the screen and at the breakpoint the grids collapse the way that they should. If you shrink the browser and load the app it looks perfect.

However when I access the site from my phone's web browser (chrome) it does not collapse. So everything looks very small and squashed. My phone is a samsung galaxy A5 (android)

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Create a basic next application with either bootstrap or semanti-ui-react
  2. Deploy the application to a server
  3. Use pm2 to manage the application
  4. Use nginx to reverse proxy
  5. Access the application from a mobile phone (android at least)

Here is a repo to the code I have deployed: https://github.com/dbrowne24/bootstrap-nextjs-issues

This example uses bootstrap, but the same thing happens when using semantic-ui-reacts responsive layouts.

Expected behavior

Expected the responsive layout to work on both mobile and desktop.

Screenshots

Here are some screen shots that might help:

Computer Full Screen: screenshot from 2018-09-08 02-02-04

Computer Window shrank: screenshot2

Mobile Phone (no responsiveness) screenshot_20180908-020129_chrome

System information

  • OS: Ubuntu 18.04 and Android
  • Browser Chrome on both
  • Version of Next.js: 6.1.2

Additional context

Add any other context about the problem here.

dbrowne24 avatar Sep 08 '18 01:09 dbrowne24

This is not a Next.js bug. You probably forgot to add the viewport meta tag:

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

timneutkens avatar Sep 08 '18 08:09 timneutkens

had a similar issue, @timneutkens pointed in the right direction, thanks a bunch!

Nahueleti avatar Sep 11 '18 18:09 Nahueleti

:pray: this bites a lot of people doing responsive websites unfortunately 😅

timneutkens avatar Sep 11 '18 19:09 timneutkens

How can I add meta tags in nextjs?

DiegoVallejoDev avatar Oct 17 '18 16:10 DiegoVallejoDev

@Destructor1702 https://nextjs.org/docs#populating-head

whoyawn avatar Oct 21 '18 10:10 whoyawn