Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 23 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,53 +26,51 @@ npm i --save react-native-slider
| <0.25.0 | <0.7.0 |
| v0.25.x | v0.7.x |
| v0.26.0+ | v0.8.x |
| v0.43.0+ | v0.10.x |
| v0.44.0+ | v0.11.x |

## Usage

```jsx
'use strict';

var React = require('react');
var Slider = require('react-native-slider');
var {
AppRegistry,
StyleSheet,
View,
Text,
} = require('react-native');

var SliderExample = React.createClass({
getInitialState() {
return {
value: 0.2,
};
},
import React from "react";
import Slider from "react-native-slider";
import { AppRegistry, StyleSheet, View, Text } from "react-native";

class SliderExample extends React.Component {
state = {
value: 0.2
};

render() {
return (
<View style={styles.container}>
<Slider
value={this.state.value}
onValueChange={(value) => this.setState({value})} />
<Text>Value: {this.state.value}</Text>
onValueChange={value => this.setState({ value })}
/>
<Text>
Value: {this.state.value}
</Text>
</View>
);
}
});
}

var styles = StyleSheet.create({
const styles = StyleSheet.create({
container: {
flex: 1,
marginLeft: 10,
marginRight: 10,
alignItems: 'stretch',
justifyContent: 'center',
},
alignItems: "stretch",
justifyContent: "center"
}
});

AppRegistry.registerComponent('SliderExample', () => SliderExample);
AppRegistry.registerComponent("SliderExample", () => SliderExample);
```

Try this example [live on Expo Snack](https://snack.expo.io/HkbAqpbwb).

## Props

Prop | Type | Optional | Default | Description
Expand Down
Loading