Skip to content

Commit d655e51

Browse files
committed
Update KeyboardTrackView example screen
1 parent d3af6be commit d655e51

File tree

1 file changed

+34
-16
lines changed

1 file changed

+34
-16
lines changed

demo/src/screens/nativeComponentScreens/KeyboardTrackingViewScreen.js

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,15 @@ import {
1212
Constants,
1313
Spacings
1414
} from 'react-native-ui-lib';
15+
import _ from 'lodash';
16+
1517
const KeyboardTrackingView = Keyboard.KeyboardTrackingView;
1618

17-
const URIs = [
18-
{
19-
uri:
20-
'https://static.pexels.com/photos/50721/pencils-crayons-colourful-rainbow-50721.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260'
21-
},
22-
{
23-
uri:
24-
'https://static.pexels.com/photos/60628/flower-garden-blue-sky-hokkaido-japan-60628.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260'
25-
},
26-
{
27-
uri:
28-
'https://images.pexels.com/photos/140234/pexels-photo-140234.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260'
29-
}
19+
const messages = [
20+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
21+
'integer feugiat scelerisque varius morbi enim nunc faucibus a pellentesque sit amet porttitor eget dolor',
22+
'turpis cursus in hac habitasse',
23+
'neque gravida in fermentum et sollicitudin ac orci phasellus egestas'
3024
];
3125

3226
export default class KeyboardTrackingViewScreen extends PureComponent {
@@ -40,6 +34,32 @@ export default class KeyboardTrackingViewScreen extends PureComponent {
4034
});
4135
};
4236

37+
renderChatBubbles() {
38+
return (
39+
<View flex>
40+
{_.map(messages, (message, i) => {
41+
const isLeftBubble = i % 2 === 0;
42+
return (
43+
<View right={!isLeftBubble}>
44+
<View
45+
bg-blue40={isLeftBubble}
46+
bg-white={!isLeftBubble}
47+
br20
48+
marginB-s4
49+
padding-s2
50+
width={'70%'}
51+
>
52+
<Text white={isLeftBubble} grey10={!isLeftBubble} text80>
53+
{message}
54+
</Text>
55+
</View>
56+
</View>
57+
);
58+
})}
59+
</View>
60+
);
61+
}
62+
4363
render() {
4464
const {trackInteractive} = this.state;
4565

@@ -63,9 +83,7 @@ export default class KeyboardTrackingViewScreen extends PureComponent {
6383
marginL-10
6484
/>
6585
</View>
66-
{URIs.map((uri, index) => (
67-
<Image style={styles.image} source={uri} key={index} />
68-
))}
86+
{this.renderChatBubbles()}
6987
</ScrollView>
7088
<KeyboardTrackingView
7189
style={styles.trackingToolbarContainer}

0 commit comments

Comments
 (0)