Skip to content

Commit 5e1cab0

Browse files
committed
Use destruct and styles.values() everywhere.
1 parent cfd7ab0 commit 5e1cab0

File tree

7 files changed

+19
-15
lines changed

7 files changed

+19
-15
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.linting.pylintArgs": ["--disable=W0612,W0611,C0103,C0111,W0613,C0326"]
3+
}

components/AlbumDetail.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
from components.Button import Button
66

77
React = require("react")
8-
rn = require("react-native"); \
9-
View, Text, Image, Linking = \
10-
rn.View, rn.Text, rn.Image, rn.Linking
8+
View, Text, Image, Linking = \
9+
destruct(require("react-native"), "View", "Text", "Image", "Linking")
1110

1211
def AlbumDetail(props):
1312
artist, image, thumbnail_image, title, url = \

components/AlbumList.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ def __init__(self, props):
1111
self.state = { "albums": [] }
1212

1313
def componentDidMount(self):
14-
def parse(response): return response.json()
15-
def resolve(data): self.setState({ "albums": data })
16-
def reject(error): console.log(error)
14+
def parse(response):
15+
return response.json()
16+
def resolve(data):
17+
self.setState({ "albums": data })
18+
def reject(error):
19+
console.log(error)
1720

1821
promise = fetch("https://rallycoding.herokuapp.com/api/music_albums")
1922
promise.then(parse).then(resolve).catch(reject)

components/Button.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from Component_py.stubs import require, __pragma__ # __:skip
2+
from Component_py.component import destruct
23
React = require("react")
3-
rn = require("react-native"); \
4-
Text, TouchableOpacity = \
5-
rn.Text, rn.TouchableOpacity
4+
Text, TouchableOpacity = \
5+
destruct(require("react-native"), "Text", "TouchableOpacity")
66

77
def Button(props):
88
button_style, text_style = styles.values()

components/Card.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
View = require("react-native").View
44

55
def Card(props):
6-
container_style = styles["containerStyle"]
6+
container_style, = styles.values()
77
return __pragma__("js", "{}", """ (
88
<View style={container_style}>
99
{props.children}

components/CardSection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
View = require("react-native").View
44

55
def CardSection(props):
6-
container_style = styles["containerStyle"]
6+
container_style, = styles.values()
77
return __pragma__("js", "{}", """ (
88
<View style={container_style}>
99
{props.children}

components/Header.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
from Component_py.stubs import require, __pragma__ # __:skip
2+
from Component_py.component import destruct
23
React = require("react")
3-
rn = require("react-native"); \
4-
Text, View = rn.Text, rn.View
4+
Text, View = destruct(require("react-native"), "Text", "View")
55

66
def Header(props):
7-
text_style, view_style = \
8-
_s["textStyle"], _s["viewStyle"]
7+
view_style, text_style = styles.values()
98
return __pragma__("js", "{}", """ (
109
<View style={view_style}>
1110
<Text style={text_style}>{props.header_text}</Text>

0 commit comments

Comments
 (0)