Skip to content

Commit 91fdd02

Browse files
committed
Prevent scrolling on mobile browsers for the playground
1 parent 8d84d81 commit 91fdd02

6 files changed

Lines changed: 23 additions & 9 deletions

File tree

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Playground: Alert areas example working ok
55
* Playground: Link to docs and inspiration working ok
66
* Playground: Fixed slides for test settings
7+
* Playground: Prevent scrolling on mobile browsers
78

89
## v0.3.0
910
* First public version, almost everything working ok, playground included

playground/public/index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@
2020
Learn how to configure a non-root public URL by running `npm run build`.
2121
-->
2222
<title>React App</title>
23+
<style>
24+
body, html {
25+
overscroll-behavior: contain;
26+
overflow: hidden;
27+
}
28+
</style>
2329
</head>
2430
<body>
2531
<noscript>
2632
You need to enable JavaScript to run this app.
2733
</noscript>
28-
<div id="root" style="height: 100vh"></div>
34+
<div id="root" style="height: 100%"></div>
2935
<!--
3036
This HTML file is a template.
3137
If you open it directly in the browser, you will see an empty page.

playground/src/App.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { Component } from 'react';
2+
import Screen from './Screen'
23
import {
34
Platform,
45
Dimensions,
@@ -183,7 +184,9 @@ const styles = StyleSheet.create({
183184
flex: 1,
184185
alignItems: 'stretch',
185186
backgroundColor: 'white',
186-
width: 480
187+
width: '100%',
188+
maxWidth: 480,
189+
maxHeight: Screen.height
187190
},
188191
header: {
189192
height: isIphoneX ? 100 : (Platform.OS === 'ios') ? 70 : 60,
@@ -197,7 +200,7 @@ const styles = StyleSheet.create({
197200
body: {
198201
flex: 1,
199202
zIndex: 1000,
200-
height: 580,
203+
height: Screen.height,
201204
overflow: 'hidden'
202205
},
203206
menuContainer: {

playground/src/Screen.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {Dimensions} from 'react-native'
2+
3+
let dim = Dimensions.get('window')
4+
5+
export default {
6+
width: Math.min( 480, dim.width ),
7+
height: dim.height
8+
}

playground/src/examples/AlertAreas.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import React, { Component } from 'react';
22
import { StyleSheet, View, Dimensions, Text } from 'react-native';
33
import Interactable from 'react-native-interactable';
4-
5-
const Screen = {
6-
width: 480,
7-
height: Dimensions.get('window').height - 75
8-
};
4+
import Screen from '../Screen'
95

106
export default class AlertAreas extends Component {
117

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Just install via npm or yarn
88
```
99
npm install --save react-interactable
1010
```
11-
Special thanks to @souporserious for lending the npm package :)
11+
Special thanks to [@souporserious](https://github.com/souporserious) for lending the npm package :)
1212

1313

1414
[MIT licensed](LICENSE)

0 commit comments

Comments
 (0)