@@ -12,9 +12,9 @@ import {
12
12
Image ,
13
13
KeyboardAvoidingView ,
14
14
Platform ,
15
- TouchableOpacity ,
15
+ TouchableOpacity
16
16
} from 'react-native' ;
17
- import Airship , { EventType } from '@ua/react-native-airship' ;
17
+ import Airship , { EventType , AirshipEmbeddedView } from '@ua/react-native-airship' ;
18
18
19
19
import styles from '../Styles' ;
20
20
import NamedUserManagerCell from './Home Elements/NamedUserManagerCell' ;
@@ -46,6 +46,7 @@ export default function HomeScreen() {
46
46
const [ tags , setTags ] = useState < string [ ] > ( [ ] ) ;
47
47
const [ tagText , setTagText ] = useState ( '' ) ;
48
48
const [ notificationsEnabled , setNotificationsEnabled ] = useState ( false ) ;
49
+ const [ isEmbeddedReady , setEmbeddedReady ] = useState ( false )
49
50
50
51
const refreshTags = useCallback ( async ( ) => {
51
52
const fetchedTags = await Airship . channel . getTags ( ) ;
@@ -95,6 +96,8 @@ export default function HomeScreen() {
95
96
console . error ( 'Error getting notification status:' , error ) ;
96
97
} ) ;
97
98
99
+ setEmbeddedReady ( Airship . inApp . isEmbeddedReady ( "test" ) )
100
+
98
101
Airship . push . iOS
99
102
. getAuthorizedNotificationSettings ( )
100
103
. then ( ( id ) => {
@@ -141,6 +144,11 @@ export default function HomeScreen() {
141
144
}
142
145
) ;
143
146
147
+ Airship . inApp . addEmbeddedReadyListener ( "test" , ( isReady ) => {
148
+ console . log ( "Test " + isReady )
149
+ setEmbeddedReady ( isReady )
150
+ } ) ;
151
+
144
152
return ( ) => {
145
153
subscription . remove ( ) ;
146
154
} ;
@@ -153,18 +161,32 @@ export default function HomeScreen() {
153
161
keyboardVerticalOffset = { Platform . OS === 'ios' ? 200 : 0 }
154
162
>
155
163
< View style = { { flex : 1 , flexShrink : 0 , padding : 20 } } >
164
+
165
+
166
+ { isEmbeddedReady ?
167
+ (
168
+ < View style = { { flex : 1 } } >
169
+ < AirshipEmbeddedView
170
+ embeddedId = "test"
171
+ style = { { flex : 1 } }
172
+ />
173
+ </ View >
174
+ )
175
+ : (
156
176
< View
157
177
style = { {
158
178
flex : 1 ,
159
179
justifyContent : 'center' ,
160
180
alignItems : 'center' ,
161
181
} }
162
182
>
163
- < Image
164
- style = { [ styles . backgroundIcon , { paddingBottom : 0 } ] }
165
- source = { require ( './../img/airship-mark.png' ) }
166
- />
167
- </ View >
183
+ < Image
184
+ style = { [ styles . backgroundIcon , { paddingBottom : 0 } ] }
185
+ source = { require ( './../img/airship-mark.png' ) }
186
+ />
187
+ </ View > ) }
188
+
189
+
168
190
169
191
< View style = { { flexDirection : 'column' } } >
170
192
{ channelId ? (
0 commit comments