Skip to content

Commit c2b3d7d

Browse files
committed
fix TouchableOpacity example scren
1 parent 5b9c101 commit c2b3d7d

File tree

2 files changed

+14
-40
lines changed

2 files changed

+14
-40
lines changed

demo/src/screens/PlaygroundScreen.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
import _ from 'lodash';
22
import React, {Component} from 'react';
33
import {StyleSheet} from 'react-native';
4-
import {View, Text} from 'react-native-ui-lib'; //eslint-disable-line
5-
4+
import {View, Text, Card} from 'react-native-ui-lib'; //eslint-disable-line
65

76
export default class PlaygroundScreen extends Component {
8-
97
render() {
108
return (
119
<View center bg-dark80 flex>
12-
<Text text50>Playground Screen</Text>
10+
<Card height={100} center padding-20>
11+
<Text text50>Playground Screen</Text>
12+
</Card>
1313
</View>
1414
);
1515
}
1616
}
1717

1818
const styles = StyleSheet.create({
19-
container: {
20-
}
19+
container: {}
2120
});

demo/src/screens/wrapperScreens/TouchableOpacityScreen.js

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
1-
import React, { Component } from 'react';
1+
import React, {Component} from 'react';
22
import {View, Text, TouchableOpacity} from 'react-native-ui-lib'; //eslint-disable-line
33

44
export default class TouchableOpacityScreen extends Component {
5-
65
state = {
7-
count: 0,
8-
}
9-
10-
componentDidMount() {
11-
const snippet = this.example.getSnippet();
12-
this.setState({
13-
snippet,
14-
});
15-
}
6+
count: 0
7+
};
168

179
count() {
1810
this.setState({
19-
count: this.state.count + 1,
11+
count: this.state.count + 1
2012
});
2113
}
2214

@@ -25,33 +17,16 @@ export default class TouchableOpacityScreen extends Component {
2517
<View flex bg-dark70 useSafeArea>
2618
<View flex center>
2719
<View marginB-20>
28-
<Text center>
29-
TouchableOpacity with support for throttling.
30-
</Text>
31-
<Text center>
32-
In this example, throttleTime is set to 1200
33-
</Text>
20+
<Text center>TouchableOpacity with support for throttling.</Text>
21+
<Text center>In this example, throttleTime is set to 1200</Text>
3422
</View>
35-
<TouchableOpacity
36-
throttleTime={1200}
37-
onPress={() => this.count()}
38-
ref={element => this.example = element}
39-
>
40-
<Text text40>
41-
Click Me!
42-
</Text>
23+
<TouchableOpacity throttleTime={1200} onPress={() => this.count()} ref={element => (this.example = element)}>
24+
<Text text40>Click Me!</Text>
4325
</TouchableOpacity>
4426
<View center marginT-20>
45-
<Text text20>
46-
{this.state.count}
47-
</Text>
27+
<Text text20>{this.state.count}</Text>
4828
</View>
4929
</View>
50-
<View bg-dark10 margin-10 padding-10>
51-
<Text white>
52-
{this.state.snippet}
53-
</Text>
54-
</View>
5530
</View>
5631
);
5732
}

0 commit comments

Comments
 (0)