Skip to content

Commit 5df7329

Browse files
committed
removing use of material ui
1 parent de1f6f2 commit 5df7329

File tree

4 files changed

+87
-49
lines changed

4 files changed

+87
-49
lines changed

examples/RNOneSignalTS/Helpers.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
import * as React from 'react';
21
import {
3-
View,
4-
StyleSheet,
5-
Platform,
2+
Button,
63
KeyboardAvoidingView,
4+
StyleSheet,
75
TextInput,
6+
View,
87
} from 'react-native';
9-
import {Button} from '@react-native-material/core';
108

11-
const disabledColor = '#BEBEBE';
9+
// const disabledColor = '#BEBEBE';
1210

1311
export const renderButtonView = (name: string, callback: Function) => {
1412
return (
1513
<View key={name + '_parent'} style={styles.buttonContainer}>
1614
<Button
15+
color="white"
1716
key={name}
1817
title={name}
1918
onPress={() => {
@@ -59,11 +58,11 @@ export const renderFieldView = (
5958

6059
const styles = StyleSheet.create({
6160
buttonContainer: {
62-
flexDirection: 'column',
63-
overflow: 'hidden',
64-
borderRadius: 10,
61+
backgroundColor: '#007bff',
62+
borderRadius: 8,
6563
marginVertical: 10,
6664
marginHorizontal: 10,
65+
overflow: 'hidden',
6766
},
6867
textInput: {
6968
marginHorizontal: 10,

examples/RNOneSignalTS/OSButtons.tsx

Lines changed: 74 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import {OneSignal} from 'react-native-onesignal';
21
import * as React from 'react';
3-
import {StyleSheet, View, Platform} from 'react-native';
4-
import {renderButtonView} from './Helpers';
5-
import {Text, Divider} from '@react-native-material/core';
2+
import { StyleSheet, Text, View } from 'react-native';
3+
import { OneSignal } from 'react-native-onesignal';
4+
import { renderButtonView } from './Helpers';
5+
// Remove: import {Text, Divider} from '@react-native-material/core';
66

77
export interface Props {
88
loggingFunction: Function;
@@ -11,7 +11,7 @@ export interface Props {
1111

1212
class OSButtons extends React.Component<Props> {
1313
createInAppMessagesFields() {
14-
const {loggingFunction} = this.props;
14+
const { loggingFunction } = this.props;
1515

1616
const getPausedButton = renderButtonView('Get paused', async () => {
1717
const paused = await OneSignal.InAppMessages.getPaused();
@@ -94,7 +94,7 @@ class OSButtons extends React.Component<Props> {
9494
}
9595

9696
createLocationFields() {
97-
const {loggingFunction} = this.props;
97+
const { loggingFunction } = this.props;
9898
const locationShared = renderButtonView('Is Location Shared', async () => {
9999
const isLocationShared = await OneSignal.Location.isShared();
100100
loggingFunction(
@@ -129,7 +129,7 @@ class OSButtons extends React.Component<Props> {
129129
}
130130

131131
createNotificationFields() {
132-
const {loggingFunction} = this.props;
132+
const { loggingFunction } = this.props;
133133

134134
const hasPermissionButton = renderButtonView(
135135
'Has Notification Permission',
@@ -182,17 +182,17 @@ class OSButtons extends React.Component<Props> {
182182
}
183183

184184
createLiveActivitiesFields() {
185-
const {loggingFunction} = this.props;
185+
const { loggingFunction } = this.props;
186186

187187
const startDefaultLiveActivity = renderButtonView(
188188
'Start Default Live Activity',
189189
async () => {
190190
loggingFunction('Starting live activity');
191191
await OneSignal.LiveActivities.startDefault(
192192
this.props.inputFieldValue,
193-
{title: 'Welcome!'},
193+
{ title: 'Welcome!' },
194194
{
195-
message: {en: 'Hello World!'},
195+
message: { en: 'Hello World!' },
196196
intValue: 3,
197197
doubleValue: 3.14,
198198
boolValue: true,
@@ -255,7 +255,7 @@ class OSButtons extends React.Component<Props> {
255255
}
256256

257257
createSessionFields() {
258-
const {loggingFunction} = this.props;
258+
const { loggingFunction } = this.props;
259259

260260
const sendOutcomeButton = renderButtonView('Send Outcome With Name', () => {
261261
loggingFunction('Sending outcome: ', this.props.inputFieldValue);
@@ -295,7 +295,7 @@ class OSButtons extends React.Component<Props> {
295295
}
296296

297297
createUserFields() {
298-
const {loggingFunction} = this.props;
298+
const { loggingFunction } = this.props;
299299

300300
const addEmailButton = renderButtonView('Add Email', () => {
301301
loggingFunction('Attempting to set email: ', this.props.inputFieldValue);
@@ -341,7 +341,7 @@ class OSButtons extends React.Component<Props> {
341341

342342
const addTagsButton = renderButtonView('Add list of tags', () => {
343343
loggingFunction('Adding list of tags');
344-
OneSignal.User.addTags({my_tag1: 'my_value', my_tag2: 'my_value2'});
344+
OneSignal.User.addTags({ my_tag1: 'my_value', my_tag2: 'my_value2' });
345345
});
346346

347347
const removeTagsButton = renderButtonView('Remove list of tags', () => {
@@ -454,7 +454,7 @@ class OSButtons extends React.Component<Props> {
454454
}
455455

456456
pushSubscriptionFields() {
457-
const {loggingFunction} = this.props;
457+
const { loggingFunction } = this.props;
458458

459459
const getPushSubscriptionIdButton = renderButtonView(
460460
'Get Push Subscription Id',
@@ -497,7 +497,7 @@ class OSButtons extends React.Component<Props> {
497497
}
498498

499499
privacyConsentFields() {
500-
const {loggingFunction} = this.props;
500+
const { loggingFunction } = this.props;
501501

502502
const setPrivacyConsentGivenTrueButton = renderButtonView(
503503
'Set Privacy Consent to true',
@@ -542,43 +542,79 @@ class OSButtons extends React.Component<Props> {
542542
render() {
543543
return (
544544
<View>
545-
<Divider style={{marginTop: 10, marginBottom: 10}} />
546-
<Text variant="h5">InAppMessages</Text>
547-
<Divider style={{marginTop: 10, marginBottom: 10}} />
545+
<View
546+
style={{ height: 1, backgroundColor: '#ccc', marginVertical: 10 }}
547+
/>
548+
<Text style={{ fontSize: 18, fontWeight: 'bold' }}>InAppMessages</Text>
549+
<View
550+
style={{ height: 1, backgroundColor: '#ccc', marginVertical: 10 }}
551+
/>
548552
{this.createInAppMessagesFields()}
549553

550-
<Divider style={{marginTop: 10, marginBottom: 10}} />
551-
<Text variant="h5">Location</Text>
552-
<Divider style={{marginTop: 10, marginBottom: 10}} />
554+
<View
555+
style={{ height: 1, backgroundColor: '#ccc', marginVertical: 10 }}
556+
/>
557+
<Text style={{ fontSize: 18, fontWeight: 'bold' }}>Location</Text>
558+
<View
559+
style={{ height: 1, backgroundColor: '#ccc', marginVertical: 10 }}
560+
/>
553561
{this.createLocationFields()}
554562

555-
<Divider style={{marginTop: 10, marginBottom: 10}} />
556-
<Text variant="h5">Notifications</Text>
557-
<Divider style={{marginTop: 10, marginBottom: 10}} />
563+
<View
564+
style={{ height: 1, backgroundColor: '#ccc', marginVertical: 10 }}
565+
/>
566+
<Text style={{ fontSize: 18, fontWeight: 'bold' }}>Notifications</Text>
567+
<View
568+
style={{ height: 1, backgroundColor: '#ccc', marginVertical: 10 }}
569+
/>
558570
{this.createNotificationFields()}
559571

560-
<Text variant="h5">Live Activities</Text>
561-
<Divider style={{marginTop: 10, marginBottom: 10}} />
572+
<Text style={{ fontSize: 18, fontWeight: 'bold' }}>
573+
Live Activities
574+
</Text>
575+
<View
576+
style={{ height: 1, backgroundColor: '#ccc', marginVertical: 10 }}
577+
/>
562578
{this.createLiveActivitiesFields()}
563579

564-
<Divider style={{marginTop: 10, marginBottom: 10}} />
565-
<Text variant="h5">Session</Text>
566-
<Divider style={{marginTop: 10, marginBottom: 10}} />
580+
<View
581+
style={{ height: 1, backgroundColor: '#ccc', marginVertical: 10 }}
582+
/>
583+
<Text style={{ fontSize: 18, fontWeight: 'bold' }}>Session</Text>
584+
<View
585+
style={{ height: 1, backgroundColor: '#ccc', marginVertical: 10 }}
586+
/>
567587
{this.createSessionFields()}
568588

569-
<Divider style={{marginTop: 10, marginBottom: 10}} />
570-
<Text variant="h5">User</Text>
571-
<Divider style={{marginTop: 10, marginBottom: 10}} />
589+
<View
590+
style={{ height: 1, backgroundColor: '#ccc', marginVertical: 10 }}
591+
/>
592+
<Text style={{ fontSize: 18, fontWeight: 'bold' }}>User</Text>
593+
<View
594+
style={{ height: 1, backgroundColor: '#ccc', marginVertical: 10 }}
595+
/>
572596
{this.createUserFields()}
573597

574-
<Divider style={{marginTop: 10, marginBottom: 10}} />
575-
<Text variant="h5">Push Subscription</Text>
576-
<Divider style={{marginTop: 10, marginBottom: 10}} />
598+
<View
599+
style={{ height: 1, backgroundColor: '#ccc', marginVertical: 10 }}
600+
/>
601+
<Text style={{ fontSize: 18, fontWeight: 'bold' }}>
602+
Push Subscription
603+
</Text>
604+
<View
605+
style={{ height: 1, backgroundColor: '#ccc', marginVertical: 10 }}
606+
/>
577607
{this.pushSubscriptionFields()}
578608

579-
<Divider style={{marginTop: 10, marginBottom: 10}} />
580-
<Text variant="h5">Privacy Consent</Text>
581-
<Divider style={{marginTop: 10, marginBottom: 10}} />
609+
<View
610+
style={{ height: 1, backgroundColor: '#ccc', marginVertical: 10 }}
611+
/>
612+
<Text style={{ fontSize: 18, fontWeight: 'bold' }}>
613+
Privacy Consent
614+
</Text>
615+
<View
616+
style={{ height: 1, backgroundColor: '#ccc', marginVertical: 10 }}
617+
/>
582618
{this.privacyConsentFields()}
583619
</View>
584620
);

examples/RNOneSignalTS/OSConsole.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ export interface Props {
2525
export interface State {}
2626

2727
class OSConsole extends React.Component<Props, State> {
28+
private scrollView: ScrollView | null = null;
29+
2830
constructor(props: Props) {
2931
super(props);
3032
}
3133

3234
scrollToEnd = () => {
33-
this.scrollView.scrollToEnd({ animated: true });
35+
this.scrollView?.scrollToEnd({ animated: true });
3436
};
3537

3638
render() {

examples/RNOneSignalTS/OSDemo.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { Text, TextInput } from '@react-native-material/core';
21
import * as React from 'react';
32
import {
43
Alert,
54
SafeAreaView,
65
ScrollView,
76
StyleSheet,
7+
Text,
8+
TextInput,
89
View,
910
} from 'react-native';
1011
import { LogLevel, OneSignal } from 'react-native-onesignal';

0 commit comments

Comments
 (0)