Skip to content

Commit fe3ec16

Browse files
committed
fix safe area view styles
1 parent 73d1819 commit fe3ec16

File tree

2 files changed

+40
-13
lines changed

2 files changed

+40
-13
lines changed

examples/RNOneSignalTS/OSConsole.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import React, { useCallback, useRef } from 'react';
1212
import { Platform, ScrollView, StyleSheet, Text, View } from 'react-native';
13-
import { SafeAreaView } from 'react-native-safe-area-context';
1413

1514
export interface Props {
1615
value: string;
@@ -24,10 +23,11 @@ const OSConsole: React.FC<Props> = ({ value }) => {
2423
}, []);
2524

2625
return (
27-
<SafeAreaView style={styles.body}>
26+
<View style={styles.body}>
2827
<ScrollView
2928
nestedScrollEnabled={true}
3029
style={styles.scrollView}
30+
contentContainerStyle={styles.scrollViewContent}
3131
ref={scrollViewRef}
3232
onContentSizeChange={scrollToEnd}
3333
>
@@ -41,19 +41,21 @@ const OSConsole: React.FC<Props> = ({ value }) => {
4141
</Text>
4242
</View>
4343
</ScrollView>
44-
</SafeAreaView>
44+
</View>
4545
);
4646
};
4747

4848
const styles = StyleSheet.create({
4949
scrollView: {
50+
flex: 1,
5051
backgroundColor: '#f8f9fa',
5152
},
53+
scrollViewContent: {
54+
flexGrow: 1,
55+
},
5256
body: {
53-
backgroundColor: 'grey',
57+
backgroundColor: '#f8f9fa',
5458
flex: 1,
55-
flexGrow: 1,
56-
flexDirection: 'row',
5759
},
5860
console: {
5961
flexWrap: 'wrap',
@@ -65,11 +67,13 @@ const styles = StyleSheet.create({
6567
flex: 1,
6668
flexWrap: 'wrap',
6769
fontSize: 10,
70+
color: '#000',
6871
},
6972
textAndroid: {
7073
flex: 1,
7174
flexWrap: 'wrap',
7275
fontSize: 10,
76+
color: '#000',
7377
},
7478
});
7579

examples/RNOneSignalTS/OSDemo.tsx

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import {
66
StyleSheet,
77
Text,
88
TextInput,
9+
TouchableOpacity,
910
View,
1011
} from 'react-native';
1112
import { LogLevel, OneSignal } from 'react-native-onesignal';
1213
import { SafeAreaView } from 'react-native-safe-area-context';
13-
import { renderButtonView } from './Helpers';
1414
import OSButtons from './OSButtons';
1515
import OSConsole from './OSConsole';
1616

@@ -233,14 +233,19 @@ const OSDemo: React.FC = () => {
233233
}, []);
234234

235235
return (
236-
<SafeAreaView style={styles.container}>
236+
<SafeAreaView style={styles.container} edges={['bottom', 'left', 'right']}>
237237
<View style={styles.header}>
238238
<Text style={styles.title}>OneSignal</Text>
239239
<OSConsole value={consoleValue} />
240240
<View style={styles.clearButton}>
241-
{renderButtonView('X', () => {
242-
setConsoleValue('');
243-
})}
241+
<TouchableOpacity
242+
style={styles.clearButtonTouchable}
243+
onPress={() => {
244+
setConsoleValue('');
245+
}}
246+
>
247+
<Text style={styles.clearButtonText}>X</Text>
248+
</TouchableOpacity>
244249
</View>
245250
<TextInput
246251
style={styles.input}
@@ -273,12 +278,30 @@ const styles = StyleSheet.create({
273278
title: {
274279
fontSize: 40,
275280
alignSelf: 'center',
276-
paddingVertical: 10,
281+
paddingTop: 4,
282+
paddingBottom: 10,
277283
},
278284
clearButton: {
279285
position: 'absolute',
280-
right: 0,
286+
right: 10,
281287
top: 70,
288+
width: 44,
289+
height: 44,
290+
alignItems: 'center',
291+
justifyContent: 'center',
292+
},
293+
clearButtonTouchable: {
294+
width: 44,
295+
height: 44,
296+
backgroundColor: '#007bff',
297+
borderRadius: 8,
298+
alignItems: 'center',
299+
justifyContent: 'center',
300+
},
301+
clearButtonText: {
302+
color: 'white',
303+
fontSize: 18,
304+
fontWeight: '600',
282305
},
283306
input: {
284307
marginTop: 10,

0 commit comments

Comments
 (0)