Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Desktop works with react-navigation v3
- Loading branch information
Showing
17 changed files
with
287 additions
and
130 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
modules/react-native-desktop-gesture-handler/desktop/CMakeLists.txt
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,9 @@ | ||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
|
||
set(REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_TYPE_NAMES ${REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_TYPE_NAMES} | ||
\"GestureHandlerModule\" PARENT_SCOPE) | ||
|
||
set(REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_SRC ${REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_SRC} | ||
${CMAKE_CURRENT_SOURCE_DIR}/gesturehandlermodule.cpp PARENT_SCOPE) | ||
|
||
include(${CMAKE_ROOT}/Modules/ExternalProject.cmake) |
71 changes: 71 additions & 0 deletions
71
modules/react-native-desktop-gesture-handler/desktop/gesturehandlermodule.cpp
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,71 @@ | ||
/** | ||
* Copyright (c) 2017-present, Status Research and Development GmbH. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
*/ | ||
|
||
#include "gesturehandlermodule.h" | ||
#include "bridge.h" | ||
#include "eventdispatcher.h" | ||
|
||
#include <QGuiApplication> | ||
#include <QQuickItem> | ||
#include <QScreen> | ||
|
||
namespace { | ||
struct RegisterQMLMetaType { | ||
RegisterQMLMetaType() { qRegisterMetaType<GestureHandlerModule *>(); } | ||
} registerMetaType; | ||
} // namespace | ||
|
||
|
||
class GestureHandlerModulePrivate { | ||
public: | ||
Bridge* bridge = nullptr; | ||
}; | ||
|
||
GestureHandlerModule::GestureHandlerModule(QObject* parent) : QObject(parent), d_ptr(new GestureHandlerModulePrivate) {} | ||
|
||
GestureHandlerModule::~GestureHandlerModule() {} | ||
|
||
void GestureHandlerModule::setBridge(Bridge* bridge) { | ||
Q_D(GestureHandlerModule); | ||
d->bridge = bridge; | ||
} | ||
|
||
QString GestureHandlerModule::moduleName() { | ||
return "RNGestureHandlerModule"; | ||
} | ||
|
||
QList<ModuleMethod*> GestureHandlerModule::methodsToExport() { | ||
return QList<ModuleMethod*>{}; | ||
} | ||
|
||
QVariantMap GestureHandlerModule::constantsToExport() { | ||
Q_D(GestureHandlerModule); | ||
|
||
QVariantMap directionValues{{"RIGHT", 1}, {"LEFT", 2}, {"UP", 4}, {"DOWN", 8}}; | ||
|
||
// QRect screenGeometry = screen->geometry(); | ||
// QVariantMap screenValues{{"fontScale", 8}, | ||
// {"width", screenGeometry.width()}, | ||
// {"height", screenGeometry.height()}, | ||
// {"scale", screen->devicePixelRatio()}}; | ||
|
||
// QVariantMap values{{"screen", screenValues}, {"window", windowValues}}; | ||
|
||
return QVariantMap{{"Direction", directionValues}}; | ||
} | ||
|
||
void GestureHandlerModule::handleSetJSResponder(int viewTag, void* blockNativeResponder) {} | ||
|
||
void GestureHandlerModule::handleClearJSResponder() {} | ||
|
||
void GestureHandlerModule::createGestureHandler(const QString& handlerName, int handlerTag, void* config) {} | ||
void GestureHandlerModule::attachGestureHandler(int handlerTag, int viewTag) {} | ||
void GestureHandlerModule::updateGestureHandler(int handlerTag, void* config) {} | ||
void GestureHandlerModule::dropGestureHandler(int handlerTag) {} |
47 changes: 47 additions & 0 deletions
47
modules/react-native-desktop-gesture-handler/desktop/gesturehandlermodule.h
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,47 @@ | ||
/** | ||
* Copyright (c) 2017-present, Status Research and Development GmbH. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
*/ | ||
|
||
#ifndef GESTUREHANDLER_H | ||
#define GESTUREHANDLER_H | ||
|
||
#include "moduleinterface.h" | ||
|
||
#include <QVariantMap> | ||
|
||
class GestureHandlerModulePrivate; | ||
class GestureHandlerModule : public QObject, public ModuleInterface { | ||
Q_OBJECT | ||
Q_INTERFACES(ModuleInterface) | ||
|
||
Q_DECLARE_PRIVATE(GestureHandlerModule) | ||
|
||
public: | ||
Q_INVOKABLE GestureHandlerModule(QObject* parent = 0); | ||
~GestureHandlerModule(); | ||
|
||
void setBridge(Bridge* bridge) override; | ||
|
||
QString moduleName() override; | ||
QList<ModuleMethod*> methodsToExport() override; | ||
QVariantMap constantsToExport() override; | ||
|
||
Q_INVOKABLE void handleSetJSResponder(int viewTag, void* blockNativeResponder); | ||
Q_INVOKABLE void handleClearJSResponder(); | ||
Q_INVOKABLE void createGestureHandler(const QString& handlerName, int handlerTag, void* config); | ||
Q_INVOKABLE void attachGestureHandler(int handlerTag, int viewTag); | ||
Q_INVOKABLE void updateGestureHandler(int handlerTag, void* config); | ||
Q_INVOKABLE void dropGestureHandler(int handlerTag); | ||
|
||
|
||
private: | ||
QScopedPointer<GestureHandlerModulePrivate> d_ptr; | ||
}; | ||
|
||
#endif // GESTUREHANDLER_H |
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,5 @@ | ||
'use strict'; | ||
|
||
var RNGestureHandlerModule = require('react-native').NativeModules.RNGestureHandlerModule; | ||
|
||
module.exports = RNGestureHandlerModule; |
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 @@ | ||
{ | ||
"private": true, | ||
"nativePackage": true, | ||
"name": "react-native-desktop-gesture-handler", | ||
"version": "1.0.0", | ||
"description": "Mock for react-native-gesture-handler package", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "" | ||
} |
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