Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
lightning-bits
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bitsoko services
lightning-bits
Commits
4a56c997
Unverified
Commit
4a56c997
authored
Apr 29, 2019
by
Tankred Hase
Committed by
GitHub
Apr 29, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1080 from lightninglabs/dev/notification-dropdown
Dev/notification dropdown
parents
2ba21fda
56a355ea
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
14 deletions
+83
-14
package-lock.json
mobile/package-lock.json
+19
-0
package.json
mobile/package.json
+1
-0
rn-cli.config.js
mobile/rn-cli.config.js
+4
-0
notification.js
src/action/notification.js
+12
-0
notification-wrapper.js
src/component/notification-wrapper.js
+45
-13
main-mobile.js
src/view/main-mobile.js
+2
-1
No files found.
mobile/package-lock.json
View file @
4a56c997
...
...
@@ -9186,6 +9186,25 @@
"public-encrypt"
:
"^4.0.0"
}
},
"react-native-dropdownalert"
:
{
"version"
:
"3.10.0"
,
"resolved"
:
"https://registry.npmjs.org/react-native-dropdownalert/-/react-native-dropdownalert-3.10.0.tgz"
,
"integrity"
:
"sha512-cwKiy1dDCbEVm5GTgas7ktmHbE+hYJhAaE++h4U0Tbq1Bl6BV3bC8L3tTY+igFBOKiH1kQUCSF+9YgrdoifFRA=="
,
"requires"
:
{
"prop-types"
:
"15.5.10"
},
"dependencies"
:
{
"prop-types"
:
{
"version"
:
"15.5.10"
,
"resolved"
:
"https://registry.npmjs.org/prop-types/-/prop-types-15.5.10.tgz"
,
"integrity"
:
"sha1-J5ffwxJhguOpXj37suiT3ddFYVQ="
,
"requires"
:
{
"fbjs"
:
"^0.8.9"
,
"loose-envify"
:
"^1.3.1"
}
}
}
},
"react-native-gesture-handler"
:
{
"version"
:
"1.0.14"
,
"resolved"
:
"https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-1.0.14.tgz"
,
...
...
mobile/package.json
View file @
4a56c997
...
...
@@ -26,6 +26,7 @@
"qr-image"
:
"^3.2.0"
,
"react"
:
"16.5.0"
,
"react-native"
:
"https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz"
,
"react-native-dropdownalert"
:
"^3.10.0"
,
"react-navigation"
:
"^3.0.9"
}
}
mobile/rn-cli.config.js
View file @
4a56c997
...
...
@@ -28,6 +28,10 @@ module.exports = {
protobufjs
:
path
.
resolve
(
__dirname
,
'node_modules/protobufjs'
),
sinon
:
path
.
resolve
(
__dirname
,
'node_modules/sinon'
),
'@babel/runtime'
:
path
.
resolve
(
__dirname
,
'node_modules/@babel/runtime'
),
'react-native-dropdownalert'
:
path
.
resolve
(
__dirname
,
'node_modules/react-native-dropdownalert'
),
},
},
projectRoot
:
path
.
resolve
(
__dirname
),
...
...
src/action/notification.js
View file @
4a56c997
...
...
@@ -14,6 +14,14 @@ class NotificationAction {
this
.
_nav
=
nav
;
}
/**
* Set the dropdown component used on mobile.
* @param {Object} dropdown The component reference
*/
setDropdown
(
dropdown
)
{
this
.
_dropdown
=
dropdown
;
}
/**
* The main api used to display notifications thorughout the application. Several
* types of notifications can be displayed including `info` `error` or `success`.
...
...
@@ -43,6 +51,10 @@ class NotificationAction {
if
(
!
wait
)
this
.
_store
.
unseenNtfnCount
+=
1
;
clearTimeout
(
this
.
tdisplay
);
this
.
tdisplay
=
setTimeout
(()
=>
this
.
close
(),
NOTIFICATION_DELAY
);
// render dropdown on mobile
if
(
this
.
_dropdown
)
{
this
.
_dropdown
.
alertWithType
(
'custom'
,
''
,
msg
);
}
}
/**
...
...
src/component/notification-wrapper.js
View file @
4a56c997
...
...
@@ -2,7 +2,11 @@ import React from 'react';
import
{
StyleSheet
,
View
}
from
'react-native'
;
import
{
observer
}
from
'mobx-react'
;
import
PropTypes
from
'prop-types'
;
import
{
NotificationBar
}
from
'./notification'
;
import
DropdownAlert
from
'react-native-dropdownalert'
;
import
{
Alert
}
from
'./notification'
;
import
{
SmallSpinner
}
from
'./spinner'
;
import
{
color
,
font
}
from
'./style'
;
import
{
NOTIFICATION_DELAY
}
from
'../config'
;
//
// Notification Wrapper
...
...
@@ -12,23 +16,51 @@ const styles = StyleSheet.create({
wrapper
:
{
flex
:
1
,
},
dropdown
:
{
backgroundColor
:
color
.
blackDark
,
},
text
:
{
fontFamily
:
'OpenSans Regular'
,
fontSize
:
font
.
sizeXS
,
lineHeight
:
font
.
lineHeightXS
,
color
:
color
.
white
,
},
alert
:
{
alignSelf
:
'center'
,
marginLeft
:
15
,
marginRight
:
2
,
},
spinner
:
{
alignSelf
:
'flex-end'
,
marginRight
:
15
,
marginBottom
:
6
,
},
});
const
NotificationWrapper
=
({
store
,
children
})
=>
{
const
{
lastNotification
,
displayNotification
}
=
store
;
return
(
<
View
style
=
{
styles
.
wrapper
}
>
<
NotificationBar
notification
=
{
lastNotification
}
display
=
{
displayNotification
}
/
>
{
children
}
<
/View
>
);
};
const
NotificationWrapper
=
({
store
,
notify
,
children
})
=>
(
<
View
style
=
{
styles
.
wrapper
}
>
{
children
}
<
DropdownAlert
ref
=
{
ref
=>
notify
.
setDropdown
(
ref
)}
containerStyle
=
{
styles
.
dropdown
}
messageStyle
=
{
styles
.
text
}
renderImage
=
{()
=>
(
<
Alert
type
=
{(
store
.
lastNotification
||
{}).
type
}
style
=
{
styles
.
alert
}
/
>
)}
showCancel
=
{(
store
.
lastNotification
||
{}).
waiting
}
renderCancel
=
{()
=>
<
SmallSpinner
style
=
{
styles
.
spinner
}
/>
}
closeInterval
=
{
NOTIFICATION_DELAY
}
replaceEnabled
=
{
false
}
/
>
<
/View
>
);
NotificationWrapper
.
propTypes
=
{
store
:
PropTypes
.
object
.
isRequired
,
notify
:
PropTypes
.
object
.
isRequired
,
children
:
PropTypes
.
node
,
};
...
...
src/view/main-mobile.js
View file @
4a56c997
...
...
@@ -46,6 +46,7 @@ import TransactionDetailView from './transaction-detail-mobile';
import
{
nav
,
notify
,
wallet
,
payment
,
invoice
,
...
...
@@ -263,7 +264,7 @@ export default class App extends React.Component {
render
()
{
return
(
<
FontLoader
>
<
NotificationWrapper
store
=
{
store
}
>
<
NotificationWrapper
store
=
{
store
}
notify
=
{
notify
}
>
<
AppContainer
ref
=
{
navRef
=>
nav
.
setTopLevelNavigator
(
navRef
)}
/
>
<
/NotificationWrapper
>
<
/FontLoader
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment