showing results for - "react native toggle button with text"
Miller
16 Nov 2020
1import React, { Component } from 'react'
2import { View, Text, Button } from 'react-native'
3
4export default class App extends Component {
5  state = {
6    textValue: 'Change me'
7  }
8
9  onPress = () => {
10    this.setState({
11      textValue: 'THE NEW TEXT GOES HERE'
12    })
13  }
14
15  render() {
16    return (
17      <View style={{paddingTop: 25}}>
18        <Text>{this.state.textValue}</Text>
19        <Button title="Change Text" onPress={this.onPress} />
20      </View>
21    )
22  }
23}
Lena
27 Nov 2019
1import { Switch } from 'react-native-switch';
2
3<Switch
4	value={true}  
5	onValueChange={(val) => console.log(val)}
6	disabled={false}
7	activeText={'On'}
8	inActiveText={'Off'}
9	backgroundActive={'green'}
10	backgroundInactive={'gray'}
11	circleActiveColor={'#30a566'}
12	circleInActiveColor={'#000000'}
13/>