App.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. /**
  2. * Copyright (c) UNA, Inc - https://una.io
  3. * MIT License - https://opensource.org/licenses/MIT
  4. */
  5. import React, { Component } from 'react';
  6. import OneSignal from 'react-native-onesignal';
  7. import SplashScreen from 'react-native-splash-screen';
  8. import { WebView } from 'react-native-webview';
  9. import {
  10. Platform,
  11. StyleSheet,
  12. StyleProvider,
  13. Image,
  14. Linking,
  15. BackHandler,
  16. ActivityIndicator,
  17. Dimensions,
  18. StatusBar,
  19. } from 'react-native';
  20. import {
  21. View,
  22. Container, Content,
  23. Header, Title, Left, Body, Right, Item, Input,
  24. Footer, FooterTab, Badge,
  25. Text, Icon, Button,
  26. Drawer,
  27. } from 'native-base';
  28. import { initialMode, useDarkMode, DynamicStyleSheet, DynamicValue, useDynamicStyleSheet, eventEmitter } from 'react-native-dark-mode';
  29. import JitsiMeet, { JitsiMeetView } from 'react-native-jitsi-meet';
  30. import VideoCall from './VideoCall';
  31. import { version } from './package.json';
  32. type Props = {};
  33. const BASE_URL = 'https://una.io/';
  34. const MIX_LIGHT = '12';
  35. const MIX_DARK = '13';
  36. const TEMPLATE = 'protean';
  37. const TITLE = 'UNA.IO';
  38. const ONESIGNALAPPID = '';
  39. export default class App extends Component<Props> {
  40. loading = false;
  41. videoCallAudio = false;
  42. mode = initialMode;
  43. constructor(props) {
  44. super(props);
  45. this.state = {
  46. url: `${BASE_URL}?skin=${TEMPLATE}&mix=${'dark' == this.mode ? MIX_DARK : MIX_LIGHT}`,
  47. status: 'No Page Loaded',
  48. backButtonEnabled: false,
  49. forwardButtonEnabled: false,
  50. loading: this.loading,
  51. data: {},
  52. searchbar: false,
  53. key: 1,
  54. videoCall: 0,
  55. videoCallUri: false,
  56. };
  57. this.onBack.bind(this);
  58. this.onMainMenu.bind(this);
  59. this.onConferenceTerminated = this.onConferenceTerminated.bind(this);
  60. this.onConferenceJoined = this.onConferenceJoined.bind(this);
  61. this.onConferenceWillJoin = this.onConferenceWillJoin.bind(this);
  62. this.onVideoCallStart = this.onVideoCallStart.bind(this);
  63. }
  64. onModeChanged(newMode) {
  65. this.mode = newMode;
  66. this.setState ({
  67. key: this.state.key + 1,
  68. });
  69. }
  70. onConferenceTerminated(e) {
  71. this.endVideoCall();
  72. this.injectJavaScript("bx_mobile_apps_video_terminated(" + JSON.stringify(e.nativeEvent) + ")");
  73. }
  74. onConferenceJoined(e) {
  75. this.injectJavaScript("bx_mobile_apps_video_joined(" + JSON.stringify(e.nativeEvent) + ")");
  76. }
  77. onConferenceWillJoin(e) {
  78. this.injectJavaScript("bx_mobile_apps_video_will_join(" + JSON.stringify(e.nativeEvent) + ")");
  79. }
  80. endVideoCall() {
  81. this.videoCallAudio = false;
  82. this.setState ({
  83. videoCall: 0,
  84. videoCallUri: false,
  85. });
  86. JitsiMeet.endCall();
  87. }
  88. onVideoCallStart(sUri, bAudioOnly = false) {
  89. if (!this.state.videoCall) {
  90. this.videoCallAudio = bAudioOnly;
  91. this.setState ({
  92. videoCall: 1,
  93. videoCallUri: sUri,
  94. });
  95. }
  96. }
  97. onVideoCallToggle() {
  98. if (this.state.videoCall) {
  99. this.endVideoCall();
  100. }
  101. else {
  102. this.onVideoCallStart('testing-egr58t32g2');
  103. }
  104. }
  105. onBack() {
  106. this.endVideoCall();
  107. if (this.state.backButtonEnabled) {
  108. if ('android' === Platform.OS)
  109. this.onWebViewLoadStart(); // show loading screen
  110. this.refs.webView1.goBack();
  111. // this.injectJavaScript("window.history.go(-1)");
  112. return true;
  113. }
  114. return false;
  115. }
  116. onMainMenu() {
  117. this.endVideoCall();
  118. if (this.state.data.loggedin)
  119. this.injectJavaScript("bx_mobile_apps_show_main_menu()");
  120. else
  121. this.drawerOpen();
  122. }
  123. onBackAndMainMenu() {
  124. if (this.state.backButtonEnabled) {
  125. return this.onBack();
  126. }
  127. else {
  128. return this.onMainMenu();
  129. }
  130. }
  131. onProfileMenu() {
  132. this.endVideoCall();
  133. this.injectJavaScript("bx_mobile_apps_show_profile_menu()");
  134. return true;
  135. }
  136. onAddMenu() {
  137. this.endVideoCall();
  138. this.injectJavaScript("bx_mobile_apps_show_add_menu()");
  139. return true;
  140. }
  141. onNotificationsMenu() {
  142. this.endVideoCall();
  143. this.injectJavaScript("bx_mobile_apps_show_notifications_menu()");
  144. return true;
  145. }
  146. onMessengerMenu() {
  147. this.endVideoCall();
  148. this.injectJavaScript("bx_mobile_apps_show_messenger_menu()");
  149. return true;
  150. }
  151. onHomeMenu() {
  152. this.endVideoCall();
  153. if (`${BASE_URL}` == this.state.url || this.state.url.startsWith(`${BASE_URL}?skin=${TEMPLATE}`) || `${BASE_URL}index.php` == this.state.url) {
  154. this.injectJavaScript("bx_mobile_apps_close_sliding_menus()");
  155. } else {
  156. this.setState ({
  157. url: `${BASE_URL}?skin=${TEMPLATE}&mix=${'dark' == this.mode ? MIX_DARK : MIX_LIGHT}`,
  158. searchbar: false,
  159. key: this.state.key + 1,
  160. });
  161. }
  162. return true;
  163. }
  164. onSearch(event) {
  165. this.onSearchCancelMenu();
  166. this.injectJavaScript(`window.location = '${BASE_URL}searchKeyword.php?keyword=${event.nativeEvent.text}';`);
  167. }
  168. onSearchCancelMenu() {
  169. this.setState ({
  170. loading: this.loading,
  171. searchbar: false,
  172. });
  173. return true;
  174. }
  175. onSearchMenu() {
  176. this.endVideoCall();
  177. this.setState ({
  178. loading: this.loading,
  179. searchbar: true,
  180. });
  181. return true;
  182. }
  183. onDrawerLoginMenu() {
  184. this.onHomeMenu();
  185. this.drawerClose();
  186. return true;
  187. }
  188. onDrawerJoinMenu() {
  189. this.injectJavaScript(`window.location = '${BASE_URL}page/create-account';`);
  190. this.drawerClose();
  191. return true;
  192. }
  193. onDrawerForgotMenu() {
  194. this.injectJavaScript(`window.location = '${BASE_URL}page/forgot-password';`);
  195. this.drawerClose();
  196. return true;
  197. }
  198. onWebViewNavigationStateChange(navState) {
  199. if (-1 != navState.url.indexOf('#') && this.state.url == navState.url.substring(0, navState.url.indexOf('#'))) {
  200. this.onWebViewLoadEnd();
  201. return;
  202. }
  203. this.setState ({
  204. url: navState.url,
  205. status: navState.title,
  206. backButtonEnabled: navState.canGoBack,
  207. forwardButtonEnabled: navState.canGoForward,
  208. searchbar: false,
  209. });
  210. }
  211. onWebViewLoadStart (syntheticEvent) {
  212. if (-1 == this.state.url.indexOf(`${BASE_URL}`)) { // loading indicator is supported on original domains only
  213. this.onWebViewLoadEnd(syntheticEvent);
  214. return;
  215. }
  216. this.loading = true;
  217. this.setState ({
  218. loading: this.loading,
  219. searchbar: false,
  220. });
  221. }
  222. onWebViewLoadEnd (syntheticEvent) {
  223. this.loading = false;
  224. this.setState ({
  225. loading: this.loading,
  226. searchbar: false,
  227. });
  228. }
  229. reload() {
  230. this.refs.webView1.reload();
  231. }
  232. postMessage (data) {
  233. // posts a message to web view
  234. this.refs.webView1.postMessage(data);
  235. }
  236. injectJavaScript (script) {
  237. // executes JavaScript immediately in web view
  238. this.refs.webView1.injectJavaScript(script);
  239. }
  240. onWebViewShouldStartLoadWithRequest (event) {
  241. var aExceptionsUrls = [
  242. 'redirect_uri=', 'redirect_uri%', 'redirectUri%', // Facebook/LinkedIn Connect and other Connect apps
  243. 'signin/oauth', 'signin%2Foauth', // Google Connect
  244. '/m/oauth2', // Dolphin/UNA Connect
  245. 'api.twitter.com', // Twitter Connect
  246. ];
  247. var bExceptionUrl = aExceptionsUrls.some(e => {
  248. return -1 !== event.url.indexOf(e);
  249. });
  250. if ('about:blank' === event.url)
  251. return false;
  252. if (0 != event.url.indexOf('http') || (!bExceptionUrl && -1 == event.url.indexOf(`${BASE_URL}`) && ('android' === Platform.OS || ('click' == event.navigationType && 'ios' === Platform.OS)))) {
  253. Linking.canOpenURL(event.url).then(supported => {
  254. if (supported) {
  255. Linking.openURL(event.url);
  256. }
  257. else {
  258. console.log('Don\'t know how to open URI: ' + event.url);
  259. }
  260. return false;
  261. });
  262. return false;
  263. }
  264. if ('android' === Platform.OS)
  265. this.onWebViewLoadStart(); // show loading screen
  266. return true;
  267. }
  268. javascriptToInject () {
  269. return 'glBxNexusApp = ' + JSON.stringify({ver:version});
  270. }
  271. componentDidCatch(error, info) {
  272. SplashScreen.hide();
  273. }
  274. componentWillMount() {
  275. eventEmitter.on('currentModeChanged', this.onModeChanged.bind(this));
  276. }
  277. componentDidMount() {
  278. OneSignal.init(ONESIGNALAPPID, {kOSSettingsKeyAutoPrompt : true});
  279. OneSignal.inFocusDisplaying(0);
  280. OneSignal.addEventListener('received', this.onNotificationReceived);
  281. OneSignal.addEventListener('opened', this.onNotificationOpened.bind(this));
  282. if (Platform.OS === 'android') {
  283. this.backHandler = BackHandler.addEventListener('hardwareBackPress', () => {
  284. this.onBack(); // works best when the goBack is async
  285. return true;
  286. });
  287. }
  288. SplashScreen.hide();
  289. }
  290. componentWillUnmount() {
  291. eventEmitter.removeListener('currentModeChanged', this.onModeChanged);
  292. OneSignal.removeEventListener('received', this.onNotificationReceived);
  293. OneSignal.removeEventListener('opened', this.onNotificationOpened);
  294. if (Platform.OS === 'android') {
  295. this.backHandler.remove();
  296. }
  297. }
  298. onNotificationReceived(notification) {
  299. console.log("Notification received: ", notification);
  300. }
  301. onNotificationOpened(openResult) {
  302. if ('undefined' !== typeof(openResult.notification.payload.additionalData) && 'undefined' !== typeof(openResult.notification.payload.additionalData.url) && !openResult.notification.isAppInFocus) {
  303. this.injectJavaScript(`window.location = '${openResult.notification.payload.additionalData.url}';`);
  304. }
  305. }
  306. onWebViewMessage(event) {
  307. let oMsgData;
  308. try {
  309. oMsgData = JSON.parse(event.nativeEvent.data);
  310. }
  311. catch(err) {
  312. console.warn(err);
  313. return;
  314. }
  315. if ('undefined' !== typeof(oMsgData.loggedin)) {
  316. this.setState ({
  317. loading: this.loading,
  318. data: oMsgData,
  319. searchbar: false,
  320. key: 'undefined' === typeof(this.state.data.loggedin) || this.state.data.loggedin != oMsgData.loggedin ? this.state.key + 1 : this.state.key,
  321. });
  322. }
  323. if ('undefined' !== typeof(oMsgData['push_tags']) && oMsgData['push_tags'] !== false) {
  324. if ('undefined' !== typeof(oMsgData['push_tags']['email']) && oMsgData['push_tags']['email'].length) {
  325. OneSignal.setEmail(oMsgData['push_tags']['email'], oMsgData['push_tags']['email_hash'], (sError) => {
  326. if ('undefined' !== typeof(sError))
  327. console.warn("OneSignal set email error: " + sError);
  328. });
  329. delete oMsgData['push_tags']['email'];
  330. delete oMsgData['push_tags']['email_hash'];
  331. }
  332. OneSignal.sendTags(oMsgData['push_tags']);
  333. }
  334. if ('undefined' !== typeof(oMsgData['stop_loading']) && oMsgData['stop_loading']) {
  335. // this.onWebViewLoadEnd (event);
  336. }
  337. if ('undefined' !== typeof(oMsgData['video_call_start'])) {
  338. this.onVideoCallStart (oMsgData['video_call_start']['uri'], 'undefined' === typeof(oMsgData['video_call_start']['audio']) ? false : oMsgData['video_call_start']['audio']);
  339. }
  340. if ('undefined' !== typeof(oMsgData['video_call_stop']) && oMsgData['video_call_stop']) {
  341. this.endVideoCall ();
  342. }
  343. if ('undefined' !== typeof(oMsgData['goto_home']) && oMsgData['goto_home']) {
  344. this.onHomeMenu ();
  345. }
  346. if ('undefined' !== typeof(oMsgData['reload']) && oMsgData['reload']) {
  347. this.reload ();
  348. }
  349. }
  350. drawerClose () {
  351. this.refs.drawer._root.close()
  352. }
  353. drawerOpen () {
  354. this.refs.drawer._root.open()
  355. }
  356. render() {
  357. var sWebview = (
  358. <WebView
  359. useWebKit={true}
  360. ref="webView1"
  361. key={this.state.key}
  362. geolocationEnabled={true}
  363. builtInZoomControls={false}
  364. decelerationRate="normal"
  365. cacheEnabled={true}
  366. allowsLinkPreview={true}
  367. hideKeyboardAccessoryView={true}
  368. injectedJavaScript={this.javascriptToInject()}
  369. onShouldStartLoadWithRequest={this.onWebViewShouldStartLoadWithRequest.bind(this)}
  370. onNavigationStateChange={this.onWebViewNavigationStateChange.bind(this)}
  371. style={{flex: 1}}
  372. source={{uri: `${BASE_URL}?skin=${TEMPLATE}&mix=${'dark' == this.mode ? MIX_DARK : MIX_LIGHT}`}}
  373. userAgent={"UNAMobileApp/Mobile (" + Platform.OS + ")"}
  374. onMessage={this.onWebViewMessage.bind(this)}
  375. allowFileAccess={true}
  376. onLoad={this.onWebViewLoadEnd.bind(this)}
  377. onLoadStart={this.onWebViewLoadStart.bind(this)}
  378. />
  379. );
  380. return (
  381. <Container>
  382. <Drawer ref="drawer" content={<UnaDrawer onLogin={this.onDrawerLoginMenu.bind(this)} onJoin={this.onDrawerJoinMenu.bind(this)} onForotPassword={this.onDrawerForgotMenu.bind(this)} onClose={this.drawerClose.bind(this)} />} onClose={this.drawerClose.bind(this)}>
  383. <UnaApp
  384. webview={sWebview}
  385. state={this.state}
  386. videoCallAudio={this.videoCallAudio}
  387. onSearch={this.onSearch.bind(this)}
  388. onSearchCancelMenu={this.onSearchCancelMenu.bind(this)}
  389. onMainMenu={this.onMainMenu.bind(this)}
  390. onBackAndMainMenu={this.onBackAndMainMenu.bind(this)}
  391. onHomeMenu={this.onHomeMenu.bind(this)}
  392. onAddMenu={this.onAddMenu.bind(this)}
  393. onSearchMenu={this.onSearchMenu.bind(this)}
  394. onNotificationsMenu={this.onNotificationsMenu.bind(this)}
  395. onMessengerMenu={this.onMessengerMenu.bind(this)}
  396. onProfileMenu={this.onProfileMenu.bind(this)}
  397. onVideoCallToggle={this.onVideoCallToggle.bind(this)}
  398. onConferenceTerminated={this.onConferenceTerminated}
  399. onConferenceJoined={this.onConferenceJoined}
  400. onConferenceWillJoin={this.onConferenceWillJoin} />
  401. </Drawer>
  402. </Container>
  403. );
  404. }
  405. }
  406. function UnaApp(o) {
  407. const styles = useDynamicStyleSheet(dynamicStyles);
  408. const isDarkMode = useDarkMode();
  409. var sBarStyle = 'dark-content';
  410. if (Platform.OS === 'android' || isDarkMode)
  411. sBarStyle = 'light-content';
  412. if (Platform.OS === 'android')
  413. StatusBar.setBackgroundColor('#076fd3');
  414. StatusBar.setBarStyle(sBarStyle, false);
  415. return (<Container>
  416. {o.state.searchbar ? (
  417. <UnaToolbarSearch onSearch={o.onSearch} onSearchCancel={o.onSearchCancelMenu} />
  418. ) : (
  419. <UnaToolbar loading={o.state.loading} loggedin={o.state.data.loggedin} backButtonEnabled={o.state.backButtonEnabled} onMainMenu={o.onMainMenu} onHomeMenu={o.onHomeMenu} onSearchMenu={o.onSearchMenu} onBackAndMainMenu={o.onBackAndMainMenu} />
  420. ) }
  421. {o.state.videoCall && o.state.videoCallUri ? (
  422. <View style={styles.containerVideoCall}><VideoCall onConferenceTerminated={o.onConferenceTerminated} onConferenceJoined={o.onConferenceJoined} onConferenceWillJoin={o.onConferenceWillJoin} conferenceUri={o.state.videoCallUri} audio={o.videoCallAudio} userInfo={o.state.data.user_info} /></View>
  423. ) : (
  424. <View />
  425. )}
  426. {o.webview}
  427. {o.state.data.loggedin && (
  428. <UnaFooter bubblesNum={o.state.data.bubbles_num} bubbles={o.state.data.bubbles} onMainMenu={o.onMainMenu} onNotificationsMenu={o.onNotificationsMenu} onVideoCallToggle={o.onVideoCallToggle} onAddMenu={o.onAddMenu} onMessengerMenu={o.onMessengerMenu} onProfileMenu={o.onProfileMenu} />
  429. )}
  430. </Container>
  431. );
  432. }
  433. function UnaFooter(o) {
  434. const styles = useDynamicStyleSheet(dynamicStyles)
  435. return (
  436. <Footer style={styles.footer}>
  437. {!('decorous' == TEMPLATE && Platform.isPad) &&
  438. (<FooterTab style={styles.footerTab}>
  439. <Button vertical onPress={o.onMainMenu}>
  440. <Icon style={styles.footerIcon} name="bars" type="FontAwesome5" />
  441. </Button>
  442. </FooterTab>)
  443. }
  444. <FooterTab style={styles.footerTab}>
  445. <Button vertical onPress={o.onNotificationsMenu} badge={o.bubbles['notifications-notifications'] > 0 ? true : false}>
  446. {o.bubbles['notifications-notifications'] > 0 &&
  447. (<Badge><Text>{o.bubbles['notifications-notifications']}</Text></Badge>)
  448. }
  449. <Icon style={styles.footerIcon} name="bell" type="FontAwesome5" solid />
  450. </Button>
  451. </FooterTab>
  452. {/*
  453. <FooterTab style={styles.footerTab}>
  454. <Button vertical onPress={o.onVideoCallToggle}>
  455. <Icon style={styles.footerIcon} name="video" type="FontAwesome5" solid />
  456. </Button>
  457. </FooterTab>
  458. */}
  459. <FooterTab style={styles.footerTab}>
  460. <Button vertical onPress={o.onAddMenu}>
  461. <Icon style={styles.footerIcon} name="plus-circle" type="FontAwesome5" solid />
  462. </Button>
  463. </FooterTab>
  464. <FooterTab style={styles.footerTab}>
  465. <Button vertical onPress={o.onMessengerMenu} badge={o.bubbles['notifications-messenger'] > 0 ? true : false}>
  466. {o.bubbles['notifications-messenger'] > 0 &&
  467. (<Badge><Text>{o.bubbles['notifications-messenger']}</Text></Badge>)
  468. }
  469. <Icon style={styles.footerIcon} name="comments" type="FontAwesome5" solid />
  470. </Button>
  471. </FooterTab>
  472. <FooterTab style={styles.footerTab}>
  473. <Button vertical onPress={o.onProfileMenu} badge={o.bubblesNum > 0 ? true : false}>
  474. {o.bubblesNum > 0 &&
  475. (<Badge><Text>{o.bubblesNum}</Text></Badge>)
  476. }
  477. <Icon style={styles.footerIcon} name="user" type="FontAwesome5" solid />
  478. </Button>
  479. </FooterTab>
  480. </Footer>
  481. );
  482. }
  483. function UnaToolbar(o) {
  484. const styles = useDynamicStyleSheet(dynamicStyles)
  485. return (
  486. <Header style={styles.header}>
  487. <Left>
  488. {o.loading ? (
  489. <ActivityIndicator size="small" style={styles.loadingIndicator} />
  490. ):(
  491. o.loggedin ? (
  492. (o.backButtonEnabled || Platform.OS === 'android') &&
  493. (<Button style={Platform.OS === 'android' ? styles.buttonLeftTopAndroid : styles.buttonLeftTopIos} transparent disabled={!o.backButtonEnabled} onPress={o.onBackAndMainMenu}>
  494. <Icon name="ios-arrow-back" />
  495. </Button>)
  496. ) : (
  497. <Button style={Platform.OS === 'android' ? styles.buttonLeftTopAndroid : styles.buttonLeftTopIos} transparent onPress={o.onMainMenu}>
  498. <Icon name='menu' />
  499. </Button>
  500. )
  501. )}
  502. </Left>
  503. <Body>
  504. <Title style={styles.headerTitle} onPress={o.onHomeMenu}>{TITLE}</Title>
  505. </Body>
  506. <Right>
  507. {o.loggedin && (
  508. <Button transparent>
  509. <Icon name='search' onPress={o.onSearchMenu} />
  510. </Button>
  511. )}
  512. </Right>
  513. </Header>
  514. );
  515. }
  516. function UnaToolbarSearch(o) {
  517. const styles = useDynamicStyleSheet(dynamicStyles)
  518. return (
  519. <Header style={styles.header} searchBar rounded>
  520. <Item>
  521. <Icon name="search" />
  522. <Input placeholder="Search" onEndEditing={o.onSearchCancel} onSubmitEditing={o.onSearch} />
  523. </Item>
  524. <Button transparent onPress={o.onSearchCancel}>
  525. <Text>Cancel</Text>
  526. </Button>
  527. </Header>
  528. );
  529. }
  530. function UnaDrawer(o) {
  531. const styles = useDynamicStyleSheet(dynamicStyles)
  532. return (
  533. <Container>
  534. <Content>
  535. <View style={styles.drawerImageContainer}>
  536. <Image style={styles.drawerImage} source={require('./img/logo-loading.png')} />
  537. </View>
  538. <Button style={styles.drawerButton} iconLeft transparent onPress={o.onLogin}>
  539. <Icon style={styles.drawerButtonIcon} name='key' type="FontAwesome5" solid />
  540. <Text style={styles.drawerButtonText}>Login</Text>
  541. </Button>
  542. <Button style={styles.drawerButton} iconLeft transparent onPress={o.onJoin}>
  543. <Icon style={styles.drawerButtonIcon} name='plus-circle' type="FontAwesome5" solid />
  544. <Text style={styles.drawerButtonText}>Join</Text>
  545. </Button>
  546. <Button style={styles.drawerButton} iconLeft transparent onPress={o.onForotPassword}>
  547. <Icon style={styles.drawerButtonIcon} name='lock' type="FontAwesome5" solid />
  548. <Text style={styles.drawerButtonText}>Forgot Password</Text>
  549. </Button>
  550. </Content>
  551. </Container>
  552. );
  553. }
  554. const dynamicStyles = new DynamicStyleSheet({
  555. header: {
  556. backgroundColor: Platform.OS === 'android' ? '#1890ff' : new DynamicValue('#eee', '#333'),
  557. height: 46, paddingTop:0, // tmp fix - https://github.com/GeekyAnts/NativeBase/issues/3095
  558. },
  559. headerTitle: {
  560. color: Platform.OS === 'android' ? '#fff' : new DynamicValue('#333', '#ccc'),
  561. },
  562. footer: {
  563. backgroundColor: Platform.OS === 'android' ? '#1890ff' : new DynamicValue('#eee', '#333'),
  564. },
  565. footerTab: {
  566. backgroundColor: Platform.OS === 'android' ? '#1890ff' : new DynamicValue('#eee', '#333'),
  567. },
  568. footerIcon: {
  569. color: Platform.OS === 'android' ? '#fff' : new DynamicValue('#555', '#ccc'),
  570. },
  571. containerVideoCall: {
  572. backgroundColor: '#000',
  573. flex: 999999999999,
  574. },
  575. loadingIndicator: {
  576. marginLeft: 5,
  577. marginTop: 5,
  578. },
  579. buttonLeftTopAndroid: {
  580. },
  581. buttonLeftTopIos: {
  582. marginLeft: 5,
  583. },
  584. drawerImageContainer: {
  585. height:100,
  586. justifyContent: 'center',
  587. alignItems: 'center',
  588. backgroundColor: '#FFF',
  589. },
  590. drawerImage: {
  591. height:33.5,
  592. width:125,
  593. },
  594. drawerButton: {
  595. justifyContent: 'flex-start',
  596. },
  597. drawerButtonIcon: {
  598. width: 20,
  599. fontSize: 20,
  600. justifyContent: 'center',
  601. textAlign: 'center',
  602. color: '#1890ff',
  603. },
  604. drawerButtonText: {
  605. color: '#1890ff',
  606. }
  607. });