Skip to content

Commit 4b67d99

Browse files
committed
clean up example config
1 parent 1803fbd commit 4b67d99

File tree

6 files changed

+19
-37
lines changed

6 files changed

+19
-37
lines changed

examples/RNOneSignalTS/.prettierrc.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/RNOneSignalTS/App.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
*/
77

88
import { StatusBar, StyleSheet, useColorScheme, View } from 'react-native';
9-
import {
10-
SafeAreaProvider,
11-
useSafeAreaInsets,
12-
} from 'react-native-safe-area-context';
9+
import { SafeAreaProvider } from 'react-native-safe-area-context';
1310
import OSDemo from './OSDemo';
1411

1512
function App() {
@@ -24,8 +21,6 @@ function App() {
2421
}
2522

2623
function AppContent() {
27-
const safeAreaInsets = useSafeAreaInsets();
28-
2924
return (
3025
<View style={styles.container}>
3126
<OSDemo name="OneSignal" />

examples/RNOneSignalTS/OSButtons.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { StyleSheet, Text, View } from 'react-native';
2+
import { Text, View } from 'react-native';
33
import { OneSignal } from 'react-native-onesignal';
44
import { renderButtonView } from './Helpers';
55
// Remove: import {Text, Divider} from '@react-native-material/core';
@@ -75,7 +75,6 @@ class OSButtons extends React.Component<Props> {
7575
const clearAllTriggersButton = renderButtonView(
7676
'Clear all triggers',
7777
() => {
78-
const triggerValue = this.props.inputFieldValue;
7978
loggingFunction(`Clearing all triggers`);
8079
OneSignal.InAppMessages.clearTriggers();
8180
},
@@ -621,11 +620,4 @@ class OSButtons extends React.Component<Props> {
621620
}
622621
}
623622

624-
const styles = StyleSheet.create({
625-
greeting: {
626-
color: '#999',
627-
fontWeight: 'bold',
628-
},
629-
});
630-
631623
export default OSButtons;

examples/RNOneSignalTS/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
"scripts": {
66
"android": "react-native run-android",
77
"ios": "react-native run-ios",
8-
"start": "react-native start",
9-
"lint": "oxlint src",
10-
"lint:fix": "oxlint src --fix"
8+
"start": "react-native start"
119
},
1210
"dependencies": {
1311
"@react-native/new-app-screen": "0.81.4",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"scripts": {
88
"prepare": "bun run build",
99
"build": "tsc",
10-
"lint": "oxlint src && prettier --check src",
11-
"lint:fix": "oxlint src --fix && prettier --write src"
10+
"lint": "oxlint src examples && prettier --check src examples",
11+
"lint:fix": "oxlint src examples --fix && prettier --write src examples"
1212
},
1313
"dependencies": {
1414
"invariant": "^2.2.2"

src/events/EventManager.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ import {
33
NativeEventEmitter,
44
NativeModule,
55
} from 'react-native';
6+
import OSNotification from '../OSNotification';
67
import NotificationWillDisplayEvent from './NotificationWillDisplayEvent';
78
import {
8-
PERMISSION_CHANGED,
9-
SUBSCRIPTION_CHANGED,
10-
USER_STATE_CHANGED,
11-
NOTIFICATION_WILL_DISPLAY,
12-
NOTIFICATION_CLICKED,
139
IN_APP_MESSAGE_CLICKED,
14-
IN_APP_MESSAGE_WILL_DISPLAY,
15-
IN_APP_MESSAGE_WILL_DISMISS,
1610
IN_APP_MESSAGE_DID_DISMISS,
1711
IN_APP_MESSAGE_DID_DISPLAY,
12+
IN_APP_MESSAGE_WILL_DISMISS,
13+
IN_APP_MESSAGE_WILL_DISPLAY,
14+
NOTIFICATION_CLICKED,
15+
NOTIFICATION_WILL_DISPLAY,
16+
PERMISSION_CHANGED,
17+
SUBSCRIPTION_CHANGED,
18+
USER_STATE_CHANGED,
1819
} from './events';
19-
import OSNotification from '../OSNotification';
2020

2121
const eventList = [
2222
PERMISSION_CHANGED,
@@ -63,9 +63,11 @@ export default class EventManager {
6363
*/
6464
addEventListener<T>(eventName: string, handler: (event: T) => void) {
6565
let handlerArray = this.eventListenerArrayMap.get(eventName);
66-
handlerArray && handlerArray.length > 0
67-
? handlerArray.push(handler)
68-
: this.eventListenerArrayMap.set(eventName, [handler]);
66+
if (handlerArray && handlerArray.length > 0) {
67+
handlerArray.push(handler);
68+
} else {
69+
this.eventListenerArrayMap.set(eventName, [handler]);
70+
}
6971
}
7072

7173
/**
@@ -90,7 +92,7 @@ export default class EventManager {
9092

9193
// returns an event listener with the js to native mapping
9294
generateEventListener(eventName: string): EmitterSubscription {
93-
const addListenerCallback = (payload: Object) => {
95+
const addListenerCallback = (payload: object) => {
9496
let handlerArray = this.eventListenerArrayMap.get(eventName);
9597
if (handlerArray) {
9698
if (eventName === NOTIFICATION_WILL_DISPLAY) {

0 commit comments

Comments
 (0)