-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
devintegral4
committed
Nov 15, 2019
1 parent
159d712
commit 1eeae4c
Showing
25 changed files
with
201 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,30 @@ | ||
/* eslint-disable*/ | ||
|
||
/** | ||
* Sample React Native App | ||
* https://github.com/facebook/react-native | ||
* | ||
* @format | ||
* @flow | ||
*/ | ||
import "~/utils/shim" | ||
import "~/utils/shim"; | ||
|
||
import React, { PureComponent } from 'react'; | ||
import React from 'react'; | ||
import { Provider } from 'react-redux'; | ||
import { StatusBar } from 'react-native' | ||
import { StatusBar } from 'react-native'; | ||
import { PersistGate } from 'redux-persist/integration/react'; | ||
|
||
import RootNavigator from '~/navigation/RootNavigator'; | ||
import { NavigationService } from '~/navigation/helpers' | ||
import { NavigationService } from '~/navigation/helpers'; | ||
import { store, persistor } from '~/redux/store'; | ||
import DropdownNotification from '~/components/DropdownNotification'; | ||
|
||
// from debug network | ||
// $FlowFixMe | ||
GLOBAL.XMLHttpRequest = GLOBAL.originalXMLHttpRequest || GLOBAL.XMLHttpRequest; | ||
|
||
export default () => { | ||
return ( | ||
<Provider store={store}> | ||
<PersistGate loading={null} persistor={persistor}> | ||
<> | ||
<StatusBar barStyle="light-content" /> | ||
<RootNavigator ref={navigatorRef => NavigationService.setTopLevelNavigator(navigatorRef)} /> | ||
</> | ||
</PersistGate> | ||
</Provider> | ||
); | ||
} | ||
export default () => ( | ||
<Provider store={store}> | ||
<PersistGate loading={null} persistor={persistor}> | ||
<> | ||
<StatusBar barStyle="light-content" /> | ||
<RootNavigator ref={navigatorRef => NavigationService.setTopLevelNavigator(navigatorRef)} /> | ||
<DropdownNotification /> | ||
</> | ||
</PersistGate> | ||
</Provider> | ||
); |
38 changes: 38 additions & 0 deletions
38
FantomWallet/src/components/DropdownNotification/DropdownNotification.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// @flow | ||
import React, { useRef, useEffect } from 'react'; | ||
import { connect } from 'react-redux'; | ||
import DropdownAlert from 'react-native-dropdownalert'; | ||
|
||
import { setDopdownAlert as setDopdownAlertAction } from '~/redux/notification/actions'; | ||
|
||
type Props = { | ||
type: string, | ||
text: string | false, | ||
style: { [string]: string }, | ||
setDopdownAlert: (string, false) => void | ||
} | ||
|
||
const DropdownNotification = ({ type, text, style = {}, setDopdownAlert }: Props) => { | ||
const _dropdown: any = useRef(null); | ||
const close = () => setDopdownAlert('', false); | ||
useEffect(() => { | ||
if (!text) return; | ||
_dropdown.current.alertWithType(type, text, ''); | ||
}, [text]); | ||
return ( | ||
<DropdownAlert | ||
containerStyle={{ backgroundColor: 'rgb(0,168,251)', ...style }} | ||
ref={_dropdown} | ||
onClose={close} | ||
useNativeDriver | ||
/> | ||
); | ||
}; | ||
|
||
export default connect(state => ({ | ||
type: state.notification.type, | ||
text: state.notification.text, | ||
style: state.notification.style, | ||
}), ({ | ||
setDopdownAlert: setDopdownAlertAction, | ||
}))(DropdownNotification); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './DropdownNotification'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// @flow | ||
export const types = { | ||
SET_DROPDOWN_ALERT: 'notification/set_dropdown_alert', | ||
}; | ||
export const setDopdownAlert = ( | ||
type: string, text: string | false, style?: { [string]: string } = {}, | ||
) => ({ | ||
type: types.SET_DROPDOWN_ALERT, | ||
payload: { | ||
type, text, style, | ||
}, | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// @flow | ||
import { types } from './actions'; | ||
|
||
type Notification = { | ||
type: string, | ||
text: string | false, | ||
style?: { [string]: string } | ||
}; | ||
|
||
type actionType = { | ||
type: string, | ||
payload: Notification | ||
}; | ||
|
||
const initialState = { | ||
type: '', | ||
text: false, | ||
style: {}, | ||
}; | ||
|
||
const notificationReducer = (state: Notification = initialState, action: actionType) => { | ||
switch (action.type) { | ||
case types.SET_DROPDOWN_ALERT: | ||
return { | ||
...state, | ||
type: action.payload.type, | ||
text: action.payload.text, | ||
style: action.payload.style, | ||
}; | ||
default: | ||
return state; | ||
} | ||
}; | ||
|
||
export default notificationReducer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.