Comments (7)
A higher order function is a function that takes a function as an argument, or returns a function.
In our case all functions like handleMerchantMessage, handleMerchantNotice, handleDeferredDeeplink, handleCallBack should return functions.
export const handleMerchantMessage = () => () => {
pushNotificationBase();
}
export const handleMerchantNotice = () => () => {
pushNotificationBase();
}
export const handleDeferredDeeplink = () => () => {
}
export const handleCallBack = () => () => {
pushNotificationBase();
}
Recompose, redux-thunk packages have similar API. The idea behind this is to merge data from several sources, in this case some parameters are stored in closure.
handleMerchantMessage function receives the result of url parsing, the function returns another function which receives component props as an argument.
export const handleMerchantMessage = ({ scheme, route, query, params }) => ({ dispatch }) => {
}
Also, where did you find this code in the docs? The package does not provide such API. 😅
query: {
"state": "state",
"session_state": "session_state",
"code": "code",
}
from react-native-deep-link.
Oops, my fault on the query part - I misinterpreted something written in the docs.
And thank you, that worked.
from react-native-deep-link.
Also, how would I wrap the function in a router correctly?
Like so?
const handleMerchantMessagePre = () => () => {
pushNotificationBase();
}
const handleMerchantMessage = withRouter(handleMerchantMessagePre);
from react-native-deep-link.
withRouter is a HOC, only React components can be wrapped with HOCs.
So, you should do something like this:
export default compose(
withRouter,
createDeepLinkingHandler(schemes)
)(YourComponent)
withRouter will pass some props to the WrappedComponent. This props will be available in your callback handler:
const handleMerchantMessage = () => ({ location, history, dispatch }) => {
// Now you have access to the history and location here in the code
}
from react-native-deep-link.
Beautiful, thank you!
from react-native-deep-link.
Query parameters are not a part of pathname, you should omit them in route expression. are not a part of pathname, you should omit them in the route expression.
{
name: 'https:',
routes: [
{
expression: 'company.onelink.me/QOVp/d8e6a2e0',
callback: handleDeferredDeeplink
}
]
}
from react-native-deep-link.
I am going to close the issue. Feel free to reopen it in case you have more questions.
from react-native-deep-link.
Related Issues (10)
- Does it work for react-native android perfectly ? HOT 3
- Fav
- A handler for the was not found. HOT 4
- Support for innerRef
- Add instructions how to register a URL sheme in Info.plist file for iOS to README.md.
- Update the table of contents in the README.md
- Apply configuration steps for iOS from README.md to example and NavigationServiceExample projects
- Without redux HOT 2
- How do you deal with dynamic queries? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-deep-link.