Updated to latest code
This commit is contained in:
30
LICENSE
30
LICENSE
@@ -1,15 +1,15 @@
|
|||||||
The Apache License v2.0
|
The Apache License v2.0
|
||||||
|
|
||||||
Copyright 2020 Incentro Business Acceleration B.V.
|
Copyright 2020 Incentro Business Acceleration B.V.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
|
|||||||
50
README.md
50
README.md
@@ -1,25 +1,25 @@
|
|||||||
## Backhandler
|
## Backhandler
|
||||||
Widget to disregard back events on page when using Mendix Native.
|
Widget to disregard back events on page when using Mendix Native.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
For development:
|
For development:
|
||||||
|
|
||||||
Create customwidgets folder in root of project directory
|
Create customwidgets folder in root of project directory
|
||||||
Git clone this repo into customwidgets folder
|
Git clone this repo into customwidgets folder
|
||||||
Open command prompt in cloned folder
|
Open command prompt in cloned folder
|
||||||
npm i
|
npm i
|
||||||
npm run dev / npm run build
|
npm run dev / npm run build
|
||||||
Widget can now be used inside Mendix.
|
Widget can now be used inside Mendix.
|
||||||
|
|
||||||
For plain usage:
|
For plain usage:
|
||||||
|
|
||||||
Copy MPK file in releases to widgets directory.
|
Copy MPK file in releases to widgets directory.
|
||||||
|
|
||||||
## Demo project
|
## Demo project
|
||||||
Not available yet.
|
Not available yet.
|
||||||
|
|
||||||
## Issues, suggestions and feature requests
|
## Issues, suggestions and feature requests
|
||||||
https://github.com/IncentroBA/backhandler/issues
|
https://github.com/IncentroBA/backhandler/issues
|
||||||
|
|
||||||
## Development and contribution
|
## Development and contribution
|
||||||
N/A
|
N/A
|
||||||
|
|||||||
34
dist/tmp/widgets/Backhandler.xml
vendored
34
dist/tmp/widgets/Backhandler.xml
vendored
@@ -1,17 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<widget id="incentro.backhandler.Backhandler" pluginWidget="true" needsEntityContext="true" offlineCapable="true"
|
<widget id="incentro.backhandler.Backhandler" pluginWidget="true" needsEntityContext="true" offlineCapable="true"
|
||||||
supportedPlatform="Native"
|
supportedPlatform="Native"
|
||||||
xmlns="http://www.mendix.com/widget/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns="http://www.mendix.com/widget/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.mendix.com/widget/1.0/ ../node_modules/mendix/custom_widget.xsd">
|
xsi:schemaLocation="http://www.mendix.com/widget/1.0/ ../node_modules/mendix/custom_widget.xsd">
|
||||||
<name>Backhandler</name>
|
<name>Backhandler</name>
|
||||||
<description>Disregard back events on page</description>
|
<description>Disregard back events on page</description>
|
||||||
<icon/>
|
<icon/>
|
||||||
<properties>
|
<properties>
|
||||||
<propertyGroup caption="Events">
|
<propertyGroup caption="Events">
|
||||||
<property key="onBack" type="action" required="false">
|
<property key="onBack" type="action" required="false">
|
||||||
<caption>On backpress</caption>
|
<caption>On backpress</caption>
|
||||||
<description>Flow to call when hardware backbutton is used.</description>
|
<description>Flow to call when hardware backbutton is used.</description>
|
||||||
</property>
|
</property>
|
||||||
</propertyGroup>
|
</propertyGroup>
|
||||||
</properties>
|
</properties>
|
||||||
</widget>
|
</widget>
|
||||||
|
|||||||
22
dist/tmp/widgets/package.xml
vendored
22
dist/tmp/widgets/package.xml
vendored
@@ -1,11 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<package xmlns="http://www.mendix.com/package/1.0/">
|
<package xmlns="http://www.mendix.com/package/1.0/">
|
||||||
<clientModule name="Backhandler" version="1.0.0" xmlns="http://www.mendix.com/clientModule/1.0/">
|
<clientModule name="Backhandler" version="1.0.0" xmlns="http://www.mendix.com/clientModule/1.0/">
|
||||||
<widgetFiles>
|
<widgetFiles>
|
||||||
<widgetFile path="Backhandler.xml"/>
|
<widgetFile path="Backhandler.xml"/>
|
||||||
</widgetFiles>
|
</widgetFiles>
|
||||||
<files>
|
<files>
|
||||||
<file path="incentro/backhandler"/>
|
<file path="incentro/backhandler"/>
|
||||||
</files>
|
</files>
|
||||||
</clientModule>
|
</clientModule>
|
||||||
</package>
|
</package>
|
||||||
|
|||||||
41094
package-lock.json
generated
41094
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
64
package.json
64
package.json
@@ -1,32 +1,32 @@
|
|||||||
{
|
{
|
||||||
"name": "backhandler",
|
"name": "backhandler",
|
||||||
"widgetName": "Backhandler",
|
"widgetName": "Backhandler",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Disregard back events on page",
|
"description": "Disregard back events on page",
|
||||||
"copyright": "2020 Incentro Business Acceleration B.V.",
|
"copyright": "2020 Incentro Business Acceleration B.V.",
|
||||||
"author": "Bart Onstee",
|
"author": "Bart Onstee",
|
||||||
"config": {
|
"config": {
|
||||||
"projectPath": "../..//"
|
"projectPath": "../..//"
|
||||||
},
|
},
|
||||||
"packagePath": "incentro",
|
"packagePath": "incentro",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "npm run dev",
|
"start": "npm run dev",
|
||||||
"build": "pluggable-widgets-tools build:native",
|
"build": "pluggable-widgets-tools build:native",
|
||||||
"dev": "pluggable-widgets-tools start:native",
|
"dev": "pluggable-widgets-tools start:native",
|
||||||
"lint": "pluggable-widgets-tools lint",
|
"lint": "pluggable-widgets-tools lint",
|
||||||
"lint:fix": "pluggable-widgets-tools lint:fix",
|
"lint:fix": "pluggable-widgets-tools lint:fix",
|
||||||
"prerelease": "npm run lint",
|
"prerelease": "npm run lint",
|
||||||
"release": "pluggable-widgets-tools release:native"
|
"release": "pluggable-widgets-tools release:native"
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/Bart Onstee/backhandler/issues"
|
"url": "https://github.com/Bart Onstee/backhandler/issues"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@mendix/pluggable-widgets-tools": "^8.12.0",
|
"@mendix/pluggable-widgets-tools": "^8.12.0",
|
||||||
"@types/big.js": "^4.0.5",
|
"@types/big.js": "^4.0.5",
|
||||||
"@types/react": "~16.9.0",
|
"@types/react": "~16.9.0",
|
||||||
"@types/react-native": "~0.61.23"
|
"@types/react-native": "~0.61.23"
|
||||||
},
|
},
|
||||||
"dependencies": {}
|
"dependencies": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const base = require("@mendix/pluggable-widgets-tools/configs/prettier.base.json");
|
const base = require("@mendix/pluggable-widgets-tools/configs/prettier.base.json");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
...base
|
...base
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,39 +1,39 @@
|
|||||||
import { Component, ReactNode, createElement } from "react";
|
import { Component, ReactNode, createElement } from "react";
|
||||||
import { TextStyle, ViewStyle, BackHandler, View } from "react-native";
|
import { TextStyle, ViewStyle, BackHandler, View } from "react-native";
|
||||||
|
|
||||||
import { Style } from "@mendix/pluggable-widgets-tools";
|
import { Style } from "@mendix/pluggable-widgets-tools";
|
||||||
|
|
||||||
import { BackhandlerProps } from "../typings/BackhandlerProps";
|
import { BackhandlerProps } from "../typings/BackhandlerProps";
|
||||||
|
|
||||||
export interface CustomStyle extends Style {
|
export interface CustomStyle extends Style {
|
||||||
container: ViewStyle;
|
container: ViewStyle;
|
||||||
label: TextStyle;
|
label: TextStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Backhandler extends Component<BackhandlerProps<CustomStyle>> {
|
export class Backhandler extends Component<BackhandlerProps<CustomStyle>> {
|
||||||
constructor(props: BackhandlerProps<CustomStyle>){
|
constructor(props: BackhandlerProps<CustomStyle>){
|
||||||
super(props)
|
super(props)
|
||||||
this.handleBackButtonClick = this.handleBackButtonClick.bind(this);
|
this.handleBackButtonClick = this.handleBackButtonClick.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//We have to have a render block, or else Mendix Native will crash. Render block is expected.
|
//We have to have a render block, or else Mendix Native will crash. Render block is expected.
|
||||||
render(): ReactNode {
|
render(): ReactNode {
|
||||||
return (
|
return (
|
||||||
<View></View>
|
<View></View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonClick);
|
BackHandler.addEventListener('hardwareBackPress', this.handleBackButtonClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButtonClick);
|
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButtonClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleBackButtonClick() {
|
handleBackButtonClick() {
|
||||||
this.props.onBack?.execute();
|
this.props.onBack?.execute();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<widget id="incentro.backhandler.Backhandler" pluginWidget="true" needsEntityContext="true" offlineCapable="true"
|
<widget id="incentro.backhandler.Backhandler" pluginWidget="true" needsEntityContext="true" offlineCapable="true"
|
||||||
supportedPlatform="Native"
|
supportedPlatform="Native"
|
||||||
xmlns="http://www.mendix.com/widget/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns="http://www.mendix.com/widget/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.mendix.com/widget/1.0/ ../node_modules/mendix/custom_widget.xsd">
|
xsi:schemaLocation="http://www.mendix.com/widget/1.0/ ../node_modules/mendix/custom_widget.xsd">
|
||||||
<name>Backhandler</name>
|
<name>Backhandler</name>
|
||||||
<description>Disregard back events on page</description>
|
<description>Disregard back events on page</description>
|
||||||
<icon/>
|
<icon/>
|
||||||
<properties>
|
<properties>
|
||||||
<propertyGroup caption="Events">
|
<propertyGroup caption="Events">
|
||||||
<property key="onBack" type="action" required="false">
|
<property key="onBack" type="action" required="false">
|
||||||
<caption>On backpress</caption>
|
<caption>On backpress</caption>
|
||||||
<description>Flow to call when hardware backbutton is used.</description>
|
<description>Flow to call when hardware backbutton is used.</description>
|
||||||
</property>
|
</property>
|
||||||
</propertyGroup>
|
</propertyGroup>
|
||||||
</properties>
|
</properties>
|
||||||
</widget>
|
</widget>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<package xmlns="http://www.mendix.com/package/1.0/">
|
<package xmlns="http://www.mendix.com/package/1.0/">
|
||||||
<clientModule name="Backhandler" version="1.0.0" xmlns="http://www.mendix.com/clientModule/1.0/">
|
<clientModule name="Backhandler" version="1.0.0" xmlns="http://www.mendix.com/clientModule/1.0/">
|
||||||
<widgetFiles>
|
<widgetFiles>
|
||||||
<widgetFile path="Backhandler.xml"/>
|
<widgetFile path="Backhandler.xml"/>
|
||||||
</widgetFiles>
|
</widgetFiles>
|
||||||
<files>
|
<files>
|
||||||
<file path="incentro/backhandler"/>
|
<file path="incentro/backhandler"/>
|
||||||
</files>
|
</files>
|
||||||
</clientModule>
|
</clientModule>
|
||||||
</package>
|
</package>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"extends": "./node_modules/@mendix/pluggable-widgets-tools/configs/tsconfig.base.json"
|
"extends": "./node_modules/@mendix/pluggable-widgets-tools/configs/tsconfig.base.json"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user