Skip to content

Commit de1f6f2

Browse files
committed
replace with original example
1 parent 9fa5842 commit de1f6f2

File tree

5 files changed

+954
-2
lines changed

5 files changed

+954
-2
lines changed

examples/RNOneSignalTS/App.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
SafeAreaProvider,
1212
useSafeAreaInsets,
1313
} from 'react-native-safe-area-context';
14+
import OSDemo from './OSDemo';
1415

1516
function App() {
1617
const isDarkMode = useColorScheme() === 'dark';
@@ -32,12 +33,13 @@ function AppContent() {
3233
templateFileName="App.tsx"
3334
safeAreaInsets={safeAreaInsets}
3435
/>
36+
<OSDemo name="OneSignal" />
3537
</View>
3638
);
37-
}
39+
};
3840

3941
const styles = StyleSheet.create({
40-
container: {
42+
body: {
4143
flex: 1,
4244
},
4345
});

examples/RNOneSignalTS/Helpers.tsx

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import * as React from 'react';
2+
import {
3+
View,
4+
StyleSheet,
5+
Platform,
6+
KeyboardAvoidingView,
7+
TextInput,
8+
} from 'react-native';
9+
import {Button} from '@react-native-material/core';
10+
11+
const disabledColor = '#BEBEBE';
12+
13+
export const renderButtonView = (name: string, callback: Function) => {
14+
return (
15+
<View key={name + '_parent'} style={styles.buttonContainer}>
16+
<Button
17+
key={name}
18+
title={name}
19+
onPress={() => {
20+
callback();
21+
}}
22+
/>
23+
</View>
24+
);
25+
};
26+
27+
export const renderFieldView = (
28+
name: string,
29+
value: string,
30+
callback: (text: string) => void,
31+
) => {
32+
return (
33+
<KeyboardAvoidingView
34+
key={name + '_keyboard_avoiding_view'}
35+
style={{
36+
width: 300,
37+
height: 40,
38+
borderWidth: 2,
39+
borderRadius: 5,
40+
marginTop: 8,
41+
}}
42+
>
43+
<TextInput
44+
key={name}
45+
style={styles.textInput}
46+
placeholder={name}
47+
value={value}
48+
multiline={false}
49+
returnKeyType="done"
50+
textAlign="center"
51+
placeholderTextColor="#d1dde3"
52+
editable={true}
53+
autoCapitalize="none"
54+
onChangeText={callback}
55+
/>
56+
</KeyboardAvoidingView>
57+
);
58+
};
59+
60+
const styles = StyleSheet.create({
61+
buttonContainer: {
62+
flexDirection: 'column',
63+
overflow: 'hidden',
64+
borderRadius: 10,
65+
marginVertical: 10,
66+
marginHorizontal: 10,
67+
},
68+
textInput: {
69+
marginHorizontal: 10,
70+
height: 40,
71+
},
72+
});

0 commit comments

Comments
 (0)