Skip to content

Commit 80ec473

Browse files
committed
Commit react native example code
- add deeplink plan example - fix mmp plan example
1 parent 8f62a2c commit 80ec473

File tree

131 files changed

+15082
-1944
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+15082
-1944
lines changed

README.md

Lines changed: 4 additions & 4 deletions

package-lock.json

Lines changed: 0 additions & 6 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

v4-deeplink-plan-example/App.tsx

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/**
2+
* Sample React Native App
3+
* https://github.com/facebook/react-native
4+
*
5+
* @format
6+
*/
7+
8+
import React, { useEffect, useRef, useState } from 'react';
9+
import {
10+
StatusBar,
11+
SafeAreaView,
12+
Text,
13+
useColorScheme,
14+
View,
15+
} from 'react-native';
16+
17+
import {
18+
Colors,
19+
} from 'react-native/Libraries/NewAppScreen';
20+
21+
import MessageDialog from './source/MessageDialog'
22+
23+
import {
24+
Airbridge
25+
} from 'airbridge-react-native-sdk';
26+
27+
function App(): React.JSX.Element {
28+
29+
useEffect(() => {
30+
prepare()
31+
}, []);
32+
33+
const prepare = async () => {
34+
Airbridge.setOnDeeplinkReceived((result) => {
35+
console.log(`[DeepLink] ${result}`)
36+
37+
setDeeplink(result)
38+
var ref = deeplinkRef.current
39+
if (!!ref && typeof ref === 'object' && typeof (ref as MessageDialog).show === 'function') {
40+
(ref as MessageDialog).show()
41+
}
42+
})
43+
};
44+
45+
const deeplinkRef = useRef(null);
46+
const [deeplink, setDeeplink] = useState('');
47+
48+
const isDarkMode = useColorScheme() === 'dark';
49+
50+
const backgroundStyle = {
51+
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
52+
};
53+
54+
return (
55+
<View style={{margin: 16}}>
56+
<StatusBar
57+
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
58+
backgroundColor={backgroundStyle.backgroundColor}
59+
/>
60+
<View>
61+
<SafeAreaView />
62+
63+
<Text
64+
style={{
65+
color: isDarkMode ? Colors.lighter : Colors.darker,
66+
fontSize: 20,
67+
fontWeight: 900
68+
}}>Airbridge Deeplink plan example</Text>
69+
70+
<MessageDialog
71+
ref={deeplinkRef}
72+
title={'Deeplink'}
73+
message={deeplink} />
74+
</View>
75+
</View>
76+
);
77+
}
78+
79+
export default App;
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)