Skip to content

Commit 731b8f6

Browse files
feat(slider): fix ios example
1 parent be60e4c commit 731b8f6

File tree

7 files changed

+27
-16
lines changed

7 files changed

+27
-16
lines changed

example/App.js

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
*/
99

1010
import React, {Component} from 'react';
11-
import {Platform, StyleSheet, Text, View} from 'react-native';
12-
13-
const { examples } = require('react-native/RNTester/js/SliderExample');
11+
import {Platform, StyleSheet, Text, ScrollView, View} from 'react-native';
12+
import { examples } from './SliderExample';
1413

1514
const instructions = Platform.select({
1615
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
@@ -23,30 +22,36 @@ type Props = {};
2322
export default class App extends Component<Props> {
2423
render() {
2524
return (
26-
<View style={styles.container}>
27-
<Text style={styles.welcome}>Welcome to React Native!</Text>
28-
<Text style={styles.instructions}>To get started, edit App.js</Text>
29-
<Text style={styles.instructions}>{instructions}</Text>
30-
31-
{
32-
examples.map((e) => e.render())
33-
}
34-
</View>
25+
<ScrollView
26+
style={styles.scrollView}
27+
contentContainerStyle={styles.container}
28+
>
29+
<Text style={styles.title}>{'<Slider />'}</Text>
30+
{examples.map((e, i) => (
31+
<View key={`slider${i}`}>
32+
<Text>{e.title}</Text>
33+
{e.render()}
34+
</View>
35+
))}
36+
</ScrollView>
3537
);
3638
}
3739
}
3840

3941
const styles = StyleSheet.create({
42+
scrollView: {
43+
backgroundColor: '#F5FCFF',
44+
},
4045
container: {
41-
flex: 1,
4246
justifyContent: 'center',
4347
alignItems: 'center',
44-
backgroundColor: '#F5FCFF',
48+
paddingVertical: 20,
4549
},
46-
welcome: {
50+
title: {
4751
fontSize: 20,
4852
textAlign: 'center',
49-
margin: 10,
53+
width: '100%',
54+
marginVertical: 20,
5055
},
5156
instructions: {
5257
textAlign: 'center',
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

js/Slider.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ const Slider = (
241241
);
242242
};
243243

244+
/* $FlowFixMe (<0.89.0)
245+
* React 16.3 introduced a new forwardRef() API,
246+
* for which Flow does not currently have a definition.
247+
* It should be fixed with flow v0.89
248+
* (ref. https://github.com/facebook/flow/issues/6103)
249+
*/
244250
const SliderWithRef = React.forwardRef(Slider);
245251

246252
/* $FlowFixMe(>=0.89.0 site=react_native_fb) This comment suppresses an error

0 commit comments

Comments
 (0)