Skip to content

Commit 7c9c4bd

Browse files
authored
chore(react-native): populate SDK response in TextInput (#194)
1 parent 387b9c0 commit 7c9c4bd

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

packages/react-native/App.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import React, {useState} from 'react';
10-
import {Button, StyleSheet, ScrollView, View, Text} from 'react-native';
10+
import {Button, StyleSheet, View, Text, TextInput} from 'react-native';
1111

1212
import {Colors} from 'react-native/Libraries/NewAppScreen';
1313

@@ -44,16 +44,22 @@ const App: () => Node = () => {
4444
<View style={styles.sectionContainer}>
4545
<Text style={styles.sectionTitle}>AWS SDK for JavaScript (v2):</Text>
4646
<Button title="Call with v2" onPress={fetchV2Response} />
47-
<ScrollView style={styles.resultWindow}>
48-
<Text style={styles.sectionDescription}>{v2Response}</Text>
49-
</ScrollView>
47+
<TextInput
48+
style={styles.sectionDescription}
49+
multiline={true}
50+
placeholder="v2 response will be populated here"
51+
value={v2Response}
52+
/>
5053
</View>
5154
<View style={styles.sectionContainer}>
5255
<Text style={styles.sectionTitle}>AWS SDK for JavaScript (v3):</Text>
5356
<Button title="Call with v3" onPress={fetchV3Response} />
54-
<ScrollView style={styles.resultWindow}>
55-
<Text style={styles.sectionDescription}>{v3Response}</Text>
56-
</ScrollView>
57+
<TextInput
58+
style={styles.sectionDescription}
59+
multiline={true}
60+
placeholder="v3 response will be populated here"
61+
value={v3Response}
62+
/>
5763
</View>
5864
</View>
5965
);
@@ -64,8 +70,8 @@ const styles = StyleSheet.create({
6470
flex: 1,
6571
},
6672
sectionContainer: {
73+
flex: 1,
6774
borderWidth: 1,
68-
flex: 2,
6975
padding: 16,
7076
},
7177
sectionTitle: {
@@ -74,13 +80,12 @@ const styles = StyleSheet.create({
7480
fontWeight: '600',
7581
color: Colors.black,
7682
},
77-
resultWindow: {
78-
backgroundColor: Colors.lighter,
79-
},
8083
sectionDescription: {
84+
flex: 1,
8185
fontSize: 14,
8286
fontWeight: '400',
8387
color: Colors.dark,
88+
backgroundColor: Colors.lighter,
8489
},
8590
});
8691

0 commit comments

Comments
 (0)