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