├── RNTester ├── .gitignore ├── js │ ├── bunny.png │ ├── hawk.png │ ├── slider.png │ ├── flux@3x.png │ ├── relay@3x.png │ ├── imageMask.png │ ├── slider-left.png │ ├── slider@2x.png │ ├── slider-right.png │ ├── uie_thumb_big.png │ ├── Thumbnails │ │ ├── call.png │ │ ├── fist.png │ │ ├── heart.png │ │ ├── like.png │ │ ├── party.png │ │ ├── poke.png │ │ ├── dislike.png │ │ ├── flowers.png │ │ ├── liking.png │ │ ├── victory.png │ │ ├── bandaged.png │ │ └── superlike.png │ ├── slider-left@2x.png │ ├── slider-right@2x.png │ ├── uie_comment_normal@2x.png │ ├── uie_thumb_normal@2x.png │ ├── uie_thumb_selected@2x.png │ ├── uie_comment_highlighted@2x.png │ ├── AnimatedGratuitousApp │ │ └── trees.jpg │ ├── tumblr_mfqekpMktw1rn90umo1_500.gif │ ├── SnapshotViewIOS.android.js │ ├── ToolbarAndroidExample.ios.js │ ├── helloworld.html │ ├── TurboModuleExample.js │ ├── http_test_server.js │ ├── createExamplePage.js │ ├── SetPropertiesExampleApp.js │ ├── messagingtest.html │ ├── RNTesterTitle.js │ ├── Shared │ │ └── RNTesterTypes.js │ ├── CrashExample.js │ ├── RNTesterActions.js │ ├── RNTesterButton.js │ ├── websocket_test_server.js │ ├── TransparentHitTestExample.js │ ├── URIActionMap.js │ ├── DimensionsExample.js │ ├── RNTesterNavigationReducer.js │ └── XHRExampleAbortController.js ├── qml │ ├── run-example.sh.in │ └── RNTester.qml └── CMakeLists.txt ├── docs ├── RunRNTester.md ├── media │ ├── devtools-window.png │ ├── qtcreator-add-example.png │ ├── devtools-inspect-target.png │ ├── qt-creator-cmake-settings.png │ ├── react-native-desktop-new-app.png │ ├── qtcreator-pref-beautifier-general.png │ └── qtcreator-pref-beautifier-clangformat.png ├── AppsUsingRnd.md ├── SupportedNativeModulesList.md ├── InspectJs.md ├── InstallUpdatedReactNativeCLI.md ├── InspectAppWithGammaRay.md └── CreateNewApp.md ├── ReactQt ├── runtime │ ├── src │ │ ├── qmldir │ │ ├── images │ │ │ └── spinner_medium.png │ │ ├── qml │ │ │ ├── ReactRawText.qml │ │ │ ├── ReactView.qml │ │ │ ├── ReactQtWebKitWebView.qml │ │ │ ├── ReactButton.qml │ │ │ ├── ReactPicker.qml │ │ │ ├── ReactSlider.qml │ │ │ ├── ReactActivityIndicator.qml │ │ │ ├── ReactModal.qml │ │ │ ├── ReactNavigator.qml │ │ │ └── ReactWebView.qml │ │ ├── js │ │ │ └── utils.js │ │ ├── jscutilities.h │ │ ├── reactplugin.h │ │ ├── moduleloader.h │ │ ├── valuecoercion.h │ │ ├── componentmanagers │ │ │ ├── scrollviewmodel.h │ │ │ ├── scrollviewmodel.cpp │ │ │ ├── activityindicatormanager.h │ │ │ ├── rawtextmanager.h │ │ │ ├── rawtextmanager.cpp │ │ │ ├── buttonmanager.h │ │ │ ├── imagemanager.h │ │ │ ├── pickermanager.h │ │ │ ├── activityindicatormanager.cpp │ │ │ ├── slidermanager.h │ │ │ ├── switchmanager.h │ │ │ ├── modalmanager.h │ │ │ └── imageloader.h │ │ ├── jscutilities.cpp │ │ ├── reactplugin.cpp │ │ ├── testmodule.cpp │ │ ├── platform.h │ │ ├── redbox.h │ │ ├── eventdispatcher.h │ │ ├── blobprovider.cpp │ │ ├── testmodule.h │ │ ├── deviceinfo.h │ │ ├── moduledata.h │ │ ├── alert.h │ │ ├── react_resources.qrc │ │ ├── blobprovider.h │ │ ├── modulemethod.h │ │ ├── reactnetworkaccessmanager.h │ │ ├── eventdispatcher.cpp │ │ ├── clipboard.h │ │ ├── componentdata.h │ │ ├── reactnetworkaccessmanager.cpp │ │ ├── netinfo.h │ │ ├── appstate.h │ │ ├── mouseeventsinterceptor.h │ │ ├── timing.h │ │ ├── clipboard.cpp │ │ ├── appstate.cpp │ │ └── communication │ │ │ ├── nodejsexecutor.h │ │ │ └── websocketexecutor.h │ └── CMakeLists.txt ├── tests │ ├── test-button-props │ │ ├── resources.qrc │ │ ├── CMakeLists.txt │ │ ├── TestButtonProps.qml │ │ ├── TestButtonProps.js │ │ └── test-button-props.cpp │ ├── test-button-size │ │ ├── resources.qrc │ │ ├── CMakeLists.txt │ │ ├── TestButtonSize.qml │ │ └── TestButtonSize.js │ ├── test-image-props │ │ ├── resources.qrc │ │ ├── CMakeLists.txt │ │ └── TestImageProps.qml │ ├── test-modal-props │ │ ├── resources.qrc │ │ ├── CMakeLists.txt │ │ ├── TestModalProps.qml │ │ ├── TestModalProps.js │ │ └── test-modal-props.cpp │ ├── test-picker-props │ │ ├── resources.qrc │ │ ├── CMakeLists.txt │ │ ├── TestPickerProps.qml │ │ └── TestPickerProps.js │ ├── test-slider-props │ │ ├── resources.qrc │ │ ├── CMakeLists.txt │ │ ├── TestSliderProps.qml │ │ └── TestSliderProps.js │ ├── test-textinput-clear │ │ ├── resources.qrc │ │ ├── CMakeLists.txt │ │ ├── TestTextInputClear.js │ │ └── TestTextInputClear.qml │ ├── test-textinput-props │ │ ├── resources.qrc │ │ ├── CMakeLists.txt │ │ ├── TestTextInputProps.qml │ │ └── TestTextInputProps.js │ ├── test-array-reconciliation │ │ ├── resources.qrc │ │ ├── CMakeLists.txt │ │ ├── TestArrayReconciliation.qml │ │ ├── TestArrayReconciliationDeleteLast.js │ │ ├── TestArrayReconciliationInsertFirst.js │ │ └── TestArrayReconciliationItemMove.js │ ├── test-activityindicator-props │ │ ├── resources.qrc │ │ ├── TestActivityIndicatorProps.js │ │ ├── CMakeLists.txt │ │ └── TestActivityIndicatorProps.qml │ ├── resources.qrc │ ├── common │ │ ├── reactpropertytestcase.h │ │ └── reactpropertytestcase.cpp │ ├── test-netexecutor-socket │ │ └── CMakeLists.txt │ └── test-integration │ │ └── TestModuleTest.qml ├── application │ ├── CMakeLists.txt │ └── src │ │ ├── main.qrc.in │ │ └── main.qml.in └── CMakeLists.txt ├── .circleci └── README.md ├── local-cli ├── index.js ├── generator-desktop │ └── templates │ │ ├── babel.config.js │ │ ├── run-app.bat.in │ │ ├── build.sh │ │ └── build.bat ├── runDesktop │ └── checkDesktop.js ├── generate-desktop.js └── util │ └── isPackagerRunning.js ├── Libraries ├── Components │ ├── StatusBar │ │ ├── StatusBar.desktop-qt.js │ │ └── StatusBarIOS.desktop-qt.js │ ├── Picker │ │ ├── PickerIOS.desktop-qt.js │ │ └── PickerAndroid.desktop-qt.js │ ├── Navigation │ │ └── NavigatorIOS.desktop-qt.js │ ├── DrawerAndroid │ │ └── DrawerLayoutAndroid.desktop-qt.js │ ├── CheckBox │ │ └── CheckBox.desktop-qt.js │ ├── AccessibilityInfo │ │ └── AccessibilityInfo.desktop-qt.js │ ├── SafeAreaView │ │ └── SafeAreaView.desktop-qt.js │ ├── View │ │ └── PlatformViewPropTypes.desktop-qt.js │ ├── ToolbarAndroid │ │ └── ToolbarAndroid.desktop-qt.js │ ├── ViewPager │ │ └── ViewPagerAndroid.desktop-qt.js │ ├── MaskedView │ │ └── MaskedViewIOS.desktop-qt.js │ ├── ProgressBarAndroid │ │ └── ProgressBarAndroid.desktop-qt.js │ ├── AppleTV │ │ └── TVEventHandler.desktop-qt.js │ ├── DatePickerAndroid │ │ └── DatePickerAndroid.desktop-qt.js │ ├── TimePickerAndroid │ │ └── TimePickerAndroid.desktop-qt.js │ ├── ToastAndroid │ │ └── ToastAndroid.desktop-qt.js │ ├── Touchable │ │ └── TouchableNativeFeedback.desktop-qt.js │ ├── TabBarIOS │ │ ├── TabBarIOS.desktop-qt.js │ │ └── TabBarItemIOS.desktop-qt.js │ ├── DatePicker │ │ └── DatePickerIOS.desktop-qt.js │ ├── SegmentedControlIOS │ │ └── SegmentedControlIOS.desktop-qt.js │ ├── ProgressViewIOS │ │ └── ProgressViewIOS.desktop-qt.js │ └── NativeButton.desktop-qt.js ├── react-native-desktop-qt │ └── react-native-desktop-qt-implementation.js ├── RCTTest │ └── SnapshotViewIOS.desktop-qt.js ├── Utilities │ ├── HMRLoadingView.desktop-qt.js │ ├── BackAndroid.desktop-qt.js │ ├── BackHandler.desktop-qt.js │ └── Platform.desktop-qt.js ├── Vibration │ └── VibrationIOS.desktop-qt.js ├── Settings │ └── Settings.desktop-qt.js └── Linking │ └── NativeLinking.desktop-qt.js ├── .github ├── ISSUE_TEMPLATE │ ├── documentation.md │ ├── question.md │ ├── discussion.md │ ├── feature_request.md │ └── bug_report.md ├── ISSUE_TEMPLATE.md ├── CODEOWNERS └── stale.yml ├── Examples ├── run-example.sh.in ├── ActivityIndicator │ ├── qml │ │ ├── run-example.sh.in │ │ └── ActivityIndicator.qml │ ├── CMakeLists.txt │ └── ActivityIndicatorApp.js ├── Alerts │ └── CMakeLists.txt ├── Button │ ├── CMakeLists.txt │ └── ButtonApp.js ├── Fetch │ ├── CMakeLists.txt │ └── FetchApp.js ├── Image │ └── CMakeLists.txt ├── Modal │ └── CMakeLists.txt ├── FlatList │ └── CMakeLists.txt ├── ScrollView │ └── CMakeLists.txt ├── TicTacToe │ └── CMakeLists.txt ├── Transform │ └── CMakeLists.txt ├── TouchableEvents │ └── CMakeLists.txt ├── CMakeLists.txt └── Example.qml.in ├── babel.config.js ├── .gitattributes ├── ReactCommon └── yoga │ ├── Android.mk │ ├── BUCK │ └── yoga │ ├── YGNodePrint.h │ ├── YGConfig.h │ ├── YGConfig.cpp │ ├── YGMacros.h │ ├── YGLayout.h │ ├── YGStyle.h │ └── YGFloatOptional.h ├── react-native.config.js ├── metro.config.js ├── fix-code-formatting.sh ├── .dependabot └── config.yml ├── package.json ├── CMakeLists.txt └── .gitignore /RNTester/.gitignore: -------------------------------------------------------------------------------- 1 | Pods/ 2 | -------------------------------------------------------------------------------- /docs/RunRNTester.md: -------------------------------------------------------------------------------- 1 | ## TBD 2 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/qmldir: -------------------------------------------------------------------------------- 1 | module React 2 | plugin react-native 3 | 4 | -------------------------------------------------------------------------------- /.circleci/README.md: -------------------------------------------------------------------------------- 1 | # Circle CI 2 | 3 | This directory is home to the Circle CI configuration file. 4 | -------------------------------------------------------------------------------- /RNTester/js/bunny.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/bunny.png -------------------------------------------------------------------------------- /RNTester/js/hawk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/hawk.png -------------------------------------------------------------------------------- /RNTester/js/slider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/slider.png -------------------------------------------------------------------------------- /local-cli/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = [ 4 | require('./runDesktop/runDesktop') 5 | ]; 6 | -------------------------------------------------------------------------------- /RNTester/js/flux@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/flux@3x.png -------------------------------------------------------------------------------- /RNTester/js/relay@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/relay@3x.png -------------------------------------------------------------------------------- /RNTester/js/imageMask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/imageMask.png -------------------------------------------------------------------------------- /RNTester/js/slider-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/slider-left.png -------------------------------------------------------------------------------- /RNTester/js/slider@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/slider@2x.png -------------------------------------------------------------------------------- /Libraries/Components/StatusBar/StatusBar.desktop-qt.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('UnimplementedView'); 4 | -------------------------------------------------------------------------------- /RNTester/js/slider-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/slider-right.png -------------------------------------------------------------------------------- /RNTester/js/uie_thumb_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/uie_thumb_big.png -------------------------------------------------------------------------------- /RNTester/js/Thumbnails/call.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/Thumbnails/call.png -------------------------------------------------------------------------------- /RNTester/js/Thumbnails/fist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/Thumbnails/fist.png -------------------------------------------------------------------------------- /RNTester/js/Thumbnails/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/Thumbnails/heart.png -------------------------------------------------------------------------------- /RNTester/js/Thumbnails/like.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/Thumbnails/like.png -------------------------------------------------------------------------------- /RNTester/js/Thumbnails/party.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/Thumbnails/party.png -------------------------------------------------------------------------------- /RNTester/js/Thumbnails/poke.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/Thumbnails/poke.png -------------------------------------------------------------------------------- /RNTester/js/slider-left@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/slider-left@2x.png -------------------------------------------------------------------------------- /RNTester/js/slider-right@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/slider-right@2x.png -------------------------------------------------------------------------------- /docs/media/devtools-window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/docs/media/devtools-window.png -------------------------------------------------------------------------------- /RNTester/js/Thumbnails/dislike.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/Thumbnails/dislike.png -------------------------------------------------------------------------------- /RNTester/js/Thumbnails/flowers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/Thumbnails/flowers.png -------------------------------------------------------------------------------- /RNTester/js/Thumbnails/liking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/Thumbnails/liking.png -------------------------------------------------------------------------------- /RNTester/js/Thumbnails/victory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/Thumbnails/victory.png -------------------------------------------------------------------------------- /RNTester/js/Thumbnails/bandaged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/Thumbnails/bandaged.png -------------------------------------------------------------------------------- /RNTester/js/Thumbnails/superlike.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/Thumbnails/superlike.png -------------------------------------------------------------------------------- /RNTester/js/uie_comment_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/uie_comment_normal@2x.png -------------------------------------------------------------------------------- /RNTester/js/uie_thumb_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/uie_thumb_normal@2x.png -------------------------------------------------------------------------------- /RNTester/js/uie_thumb_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/uie_thumb_selected@2x.png -------------------------------------------------------------------------------- /docs/media/qtcreator-add-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/docs/media/qtcreator-add-example.png -------------------------------------------------------------------------------- /docs/media/devtools-inspect-target.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/docs/media/devtools-inspect-target.png -------------------------------------------------------------------------------- /RNTester/js/uie_comment_highlighted@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/uie_comment_highlighted@2x.png -------------------------------------------------------------------------------- /docs/media/qt-creator-cmake-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/docs/media/qt-creator-cmake-settings.png -------------------------------------------------------------------------------- /RNTester/js/AnimatedGratuitousApp/trees.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/AnimatedGratuitousApp/trees.jpg -------------------------------------------------------------------------------- /docs/media/react-native-desktop-new-app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/docs/media/react-native-desktop-new-app.png -------------------------------------------------------------------------------- /RNTester/js/tumblr_mfqekpMktw1rn90umo1_500.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/RNTester/js/tumblr_mfqekpMktw1rn90umo1_500.gif -------------------------------------------------------------------------------- /ReactQt/runtime/src/images/spinner_medium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/ReactQt/runtime/src/images/spinner_medium.png -------------------------------------------------------------------------------- /ReactQt/tests/test-button-props/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestButtonProps.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /ReactQt/tests/test-button-size/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestButtonSize.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /ReactQt/tests/test-image-props/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestImageProps.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /ReactQt/tests/test-modal-props/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestModalProps.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /ReactQt/tests/test-picker-props/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestPickerProps.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /ReactQt/tests/test-slider-props/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestSliderProps.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/media/qtcreator-pref-beautifier-general.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/docs/media/qtcreator-pref-beautifier-general.png -------------------------------------------------------------------------------- /ReactQt/tests/test-textinput-clear/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestTextInputClear.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /ReactQt/tests/test-textinput-props/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestTextInputProps.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/media/qtcreator-pref-beautifier-clangformat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/status-im/react-native-desktop-qt/HEAD/docs/media/qtcreator-pref-beautifier-clangformat.png -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 📖 Documentation Issue 3 | about: Report issues with the `react-native-desktop` docs 4 | 5 | --- 6 | 7 | ## Description 8 | -------------------------------------------------------------------------------- /Libraries/Components/Picker/PickerIOS.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule PickerIOS 3 | */ 4 | 'use strict'; 5 | 6 | module.exports = require('UnimplementedView'); 7 | 8 | -------------------------------------------------------------------------------- /ReactQt/tests/test-array-reconciliation/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestArrayReconciliation.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /Libraries/Components/Picker/PickerAndroid.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule PickerAndroid 3 | */ 4 | 'use strict'; 5 | 6 | module.exports = require('UnimplementedView'); 7 | 8 | -------------------------------------------------------------------------------- /ReactQt/tests/test-activityindicator-props/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestActivityIndicatorProps.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /Libraries/Components/Navigation/NavigatorIOS.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule NavigatorIOS 3 | */ 4 | 'use strict'; 5 | 6 | module.exports = require('UnimplementedView'); 7 | 8 | -------------------------------------------------------------------------------- /Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule DrawerLayoutAndroid 3 | */ 4 | 'use strict'; 5 | 6 | module.exports = require('UnimplementedView'); 7 | -------------------------------------------------------------------------------- /Examples/run-example.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | (node ${CMAKE_SOURCE_DIR}/js-executor.js) & 4 | qmlscene -I ${CMAKE_BINARY_DIR}/ReactQt/runtime/src/ ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_NAME}.qml 5 | 6 | -------------------------------------------------------------------------------- /RNTester/qml/run-example.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | (node ${CMAKE_SOURCE_DIR}/js-executor.js) & 4 | qmlscene -I ${CMAKE_BINARY_DIR}/ReactQt/runtime/src/ ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_NAME}.qml 5 | 6 | -------------------------------------------------------------------------------- /Examples/ActivityIndicator/qml/run-example.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | (node ${CMAKE_SOURCE_DIR}/js-executor.js) & 4 | qmlscene -I ${CMAKE_BINARY_DIR}/ReactQt/runtime/src/ ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_NAME}.qml 5 | 6 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/qml/ReactRawText.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | 3 | Text { 4 | id: rawTextRoot 5 | 6 | visible: false 7 | property string typeName: "ReactRawText" 8 | property string p_text 9 | } 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 💬 Question 3 | about: If you need help with your `react-native-desktop` app, the right place to go depends on the type of help that you need. 4 | 5 | --- 6 | 7 | ## Question 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/discussion.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🗣 Start a Discussion 3 | about: Propose changes or discuss feature requests for `react-native-desktop`. 4 | --- 5 | 6 | # For Discussion 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Libraries/react-native-desktop-qt/react-native-desktop-qt-implementation.js: -------------------------------------------------------------------------------- 1 | 2 | 'use strict'; 3 | 4 | var ReactDesktop = { 5 | // Components 6 | get NativeButton() { return require('NativeButton'); }, 7 | }; 8 | 9 | module.exports = ReactDesktop; 10 | -------------------------------------------------------------------------------- /Examples/Alerts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(EXAMPLE_NAME Alerts) 3 | 4 | configure_file( 5 | ../run-example.sh.in 6 | ${CMAKE_CURRENT_BINARY_DIR}/run-example.sh 7 | ) 8 | 9 | configure_file( 10 | ../Example.qml.in 11 | ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_NAME}.qml 12 | ) 13 | -------------------------------------------------------------------------------- /Examples/Button/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(EXAMPLE_NAME Button) 3 | 4 | configure_file( 5 | ../run-example.sh.in 6 | ${CMAKE_CURRENT_BINARY_DIR}/run-example.sh 7 | ) 8 | 9 | configure_file( 10 | ../Example.qml.in 11 | ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_NAME}.qml 12 | ) 13 | -------------------------------------------------------------------------------- /Examples/Fetch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(EXAMPLE_NAME Fetch) 3 | 4 | configure_file( 5 | ../run-example.sh.in 6 | ${CMAKE_CURRENT_BINARY_DIR}/run-example.sh 7 | ) 8 | 9 | configure_file( 10 | ../Example.qml.in 11 | ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_NAME}.qml 12 | ) 13 | -------------------------------------------------------------------------------- /Examples/Image/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(EXAMPLE_NAME Image) 3 | 4 | configure_file( 5 | ../run-example.sh.in 6 | ${CMAKE_CURRENT_BINARY_DIR}/run-example.sh 7 | ) 8 | 9 | configure_file( 10 | ../Example.qml.in 11 | ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_NAME}.qml 12 | ) 13 | -------------------------------------------------------------------------------- /Examples/Modal/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(EXAMPLE_NAME Modal) 3 | 4 | configure_file( 5 | ../run-example.sh.in 6 | ${CMAKE_CURRENT_BINARY_DIR}/run-example.sh 7 | ) 8 | 9 | configure_file( 10 | ../Example.qml.in 11 | ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_NAME}.qml 12 | ) 13 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/js/utils.js: -------------------------------------------------------------------------------- 1 | function alignmentQMLValue(jsValue) { 2 | if (jsValue === "center") { 3 | return "AlignHCenter"; 4 | } else if (jsValue === "left"){ 5 | return "AlignLeft"; 6 | } else { 7 | return "AlignRight"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Examples/FlatList/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(EXAMPLE_NAME FlatList) 3 | 4 | configure_file( 5 | ../run-example.sh.in 6 | ${CMAKE_CURRENT_BINARY_DIR}/run-example.sh 7 | ) 8 | 9 | configure_file( 10 | ../Example.qml.in 11 | ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_NAME}.qml 12 | ) 13 | -------------------------------------------------------------------------------- /Examples/ScrollView/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(EXAMPLE_NAME ScrollView) 3 | 4 | configure_file( 5 | ../run-example.sh.in 6 | ${CMAKE_CURRENT_BINARY_DIR}/run-example.sh 7 | ) 8 | 9 | configure_file( 10 | ../Example.qml.in 11 | ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_NAME}.qml 12 | ) 13 | -------------------------------------------------------------------------------- /Examples/TicTacToe/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(EXAMPLE_NAME TicTacToe) 3 | 4 | configure_file( 5 | ../run-example.sh.in 6 | ${CMAKE_CURRENT_BINARY_DIR}/run-example.sh 7 | ) 8 | 9 | configure_file( 10 | ../Example.qml.in 11 | ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_NAME}.qml 12 | ) 13 | -------------------------------------------------------------------------------- /Examples/Transform/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(EXAMPLE_NAME Transform) 3 | 4 | configure_file( 5 | ../run-example.sh.in 6 | ${CMAKE_CURRENT_BINARY_DIR}/run-example.sh 7 | ) 8 | 9 | configure_file( 10 | ../Example.qml.in 11 | ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_NAME}.qml 12 | ) 13 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | var path = require("path"); 2 | const defaultResolvePath = require('babel-plugin-module-resolver').resolvePath; 3 | const generator = require("./babel/babel-config-generator.js"); 4 | 5 | module.exports = generator.create(path.resolve("./node_modules/react-native"), path.resolve(".")); 6 | -------------------------------------------------------------------------------- /Examples/TouchableEvents/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(EXAMPLE_NAME TouchableEvents) 3 | 4 | configure_file( 5 | ../run-example.sh.in 6 | ${CMAKE_CURRENT_BINARY_DIR}/run-example.sh 7 | ) 8 | 9 | configure_file( 10 | ../Example.qml.in 11 | ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_NAME}.qml 12 | ) 13 | -------------------------------------------------------------------------------- /Examples/ActivityIndicator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(EXAMPLE_NAME ActivityIndicator) 3 | 4 | configure_file( 5 | ../run-example.sh.in 6 | ${CMAKE_CURRENT_BINARY_DIR}/run-example.sh 7 | ) 8 | 9 | configure_file( 10 | ../Example.qml.in 11 | ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE_NAME}.qml 12 | ) 13 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Force LF line endings for Bash scripts. On Windows the rest of the source 2 | # files will typically have CR+LF endings (Git default on Windows), but Bash 3 | # scripts need to have LF endings to work (under Cygwin), thus override to force 4 | # that. 5 | gradlew text eol=lf 6 | *.sh text eol=lf 7 | *.patch eol=lf 8 | -------------------------------------------------------------------------------- /RNTester/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(EXAMPLE_NAME RNTester) 3 | 4 | configure_file( 5 | qml/run-example.sh.in 6 | ${CMAKE_CURRENT_BINARY_DIR}/run-example.sh 7 | ) 8 | 9 | add_custom_target( 10 | copy-${EXAMPLE_NAME} ALL 11 | COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/qml/${EXAMPLE_NAME}.qml ${CMAKE_CURRENT_BINARY_DIR} 12 | ) 13 | -------------------------------------------------------------------------------- /ReactQt/application/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (C) 2016, Canonical Ltd. 3 | # All rights reserved. 4 | 5 | # This source code is licensed under the BSD-style license found in the 6 | # LICENSE file in the root directory of this source tree. An additional grant 7 | # of patent rights can be found in the PATENTS file in the same directory. 8 | 9 | add_subdirectory(src) -------------------------------------------------------------------------------- /Examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(TicTacToe) 2 | add_subdirectory(Image) 3 | add_subdirectory(ScrollView) 4 | add_subdirectory(ActivityIndicator) 5 | add_subdirectory(Button) 6 | add_subdirectory(Modal) 7 | add_subdirectory(TouchableEvents) 8 | add_subdirectory(Alerts) 9 | add_subdirectory(Transform) 10 | add_subdirectory(FlatList) 11 | add_subdirectory(Fetch) 12 | -------------------------------------------------------------------------------- /Libraries/Components/CheckBox/CheckBox.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | * @flow 8 | * @format 9 | */ 10 | 'use strict'; 11 | 12 | module.exports = require('UnimplementedView'); 13 | -------------------------------------------------------------------------------- /ReactCommon/yoga/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := yogacore 6 | 7 | LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/yoga/*.cpp) 8 | 9 | LOCAL_C_INCLUDES := $(LOCAL_PATH) 10 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) 11 | 12 | LOCAL_CFLAGS := -fexceptions -frtti -O3 13 | 14 | include $(BUILD_STATIC_LIBRARY) 15 | -------------------------------------------------------------------------------- /ReactQt/runtime/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (C) 2016, Canonical Ltd. 3 | # All rights reserved. 4 | 5 | # This source code is licensed under the BSD-style license found in the 6 | # LICENSE file in the root directory of this source tree. An additional grant 7 | # of patent rights can be found in the PATENTS file in the same directory. 8 | 9 | add_subdirectory(src) 10 | 11 | -------------------------------------------------------------------------------- /react-native.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | commands: [ 3 | require('./local-cli/runDesktop/runDesktop'), 4 | ], 5 | platforms: { 6 | "desktop-qt": { 7 | linkConfig: () => null, 8 | projectConfig: (projectRoot, projectParams) => null, 9 | dependencyConfig: (projectRoot, dependencyParams) => null, 10 | }, 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /RNTester/js/SnapshotViewIOS.android.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | * @format 8 | */ 9 | 10 | 'use strict'; 11 | 12 | module.exports = require('../../Libraries/Components/UnimplementedViews/UnimplementedView'); 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | GitHub Issues in the `status-im/react-native-desktop` repository are used exclusively for tracking bugs in React Native desktop. 2 | 3 | Please take a look at the issue templates at https://github.com/status-im/react-native-desktop/issues/new/choose before submitting a new issue. Following one of the issue templates will ensure maintainers can route your request efficiently. Thanks! 4 | -------------------------------------------------------------------------------- /local-cli/generator-desktop/templates/babel.config.js: -------------------------------------------------------------------------------- 1 | var path = require("path"); 2 | const defaultResolvePath = require('babel-plugin-module-resolver').resolvePath; 3 | const generator = require("./node_modules/react-native-desktop-qt/babel/babel-config-generator.js"); 4 | 5 | module.exports = generator.create(path.resolve("./node_modules/react-native"), path.resolve("./node_modules/react-native-desktop-qt")); 6 | -------------------------------------------------------------------------------- /metro.config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var path = require("path"); 4 | const blacklist = require("metro-config/src/defaults/blacklist"); 5 | const defaultPolyfills = require("react-native/rn-get-polyfills"); 6 | 7 | var config = { 8 | resolver: { 9 | hasteImplModulePath: require.resolve('./jest/hasteImpl'), 10 | platforms: ["desktop-qt"], 11 | }, 12 | }; 13 | 14 | module.exports = config; 15 | -------------------------------------------------------------------------------- /Examples/Example.qml.in: -------------------------------------------------------------------------------- 1 | 2 | import QtQuick 2.7 3 | import React 0.1 as React 4 | 5 | Rectangle { 6 | id: root 7 | width: 640; height: 800; 8 | 9 | React.RootView { 10 | anchors.fill: parent 11 | 12 | moduleName: "${EXAMPLE_NAME}App" 13 | codeLocation: "http://localhost:8081/Examples/${EXAMPLE_NAME}/${EXAMPLE_NAME}App.bundle?platform=desktop-qt&dev=true" 14 | externalModules: [] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Examples/ActivityIndicator/qml/ActivityIndicator.qml: -------------------------------------------------------------------------------- 1 | 2 | import QtQuick 2.4 3 | import React 0.1 as React 4 | 5 | Rectangle { 6 | id: root 7 | width: 640; height: 480; 8 | 9 | React.RootView { 10 | anchors.fill: parent 11 | 12 | moduleName: "ActivityIndicatorApp" 13 | codeLocation: "http://localhost:8081/Examples/ActivityIndicator/ActivityIndicatorApp.bundle?platform=desktop&dev=true" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /RNTester/js/ToolbarAndroidExample.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | * @format 8 | * @flow strict-local 9 | */ 10 | 11 | 'use strict'; 12 | 13 | const {View} = require('react-native'); 14 | 15 | // Not applicable to iOS. 16 | module.exports = View; 17 | -------------------------------------------------------------------------------- /fix-code-formatting.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SOURCE_FILES=`find ./ReactQt/ -name \*.cpp -type f -or -name \*.h -type f` 4 | for SOURCE_FILE in $SOURCE_FILES 5 | do 6 | export FORMATTING_ISSUE_COUNT=`clang-format -output-replacements-xml $SOURCE_FILE | grep offset | wc -l` 7 | if [ "$FORMATTING_ISSUE_COUNT" -gt "0" ]; then 8 | clang-format -i $SOURCE_FILE 9 | echo "Formatting issues fixed for: $SOURCE_FILE" 10 | fi 11 | done 12 | -------------------------------------------------------------------------------- /Libraries/Components/AccessibilityInfo/AccessibilityInfo.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | * 8 | * @format 9 | * @flow 10 | */ 11 | 12 | 'use strict'; 13 | 14 | const AccessibilityInfo = { 15 | }; 16 | 17 | module.exports = AccessibilityInfo; 18 | -------------------------------------------------------------------------------- /.dependabot/config.yml: -------------------------------------------------------------------------------- 1 | # https://dependabot.com/docs/config-file/ 2 | 3 | version: 1 4 | update_configs: 5 | - package_manager: "java:gradle" 6 | directory: "/" 7 | update_schedule: "weekly" 8 | default_reviewers: 9 | - "vkjr" 10 | allowed_updates: 11 | - match: 12 | update_type: "security" 13 | - package_manager: "javascript" 14 | directory: "/" 15 | update_schedule: "weekly" 16 | default_reviewers: 17 | - "vkjr" 18 | -------------------------------------------------------------------------------- /docs/AppsUsingRnd.md: -------------------------------------------------------------------------------- 1 | :warning::warning::warning: 2 | #### React Native Desktop project support stopped.. 3 | 4 | --- 5 | ## Apps using react-native-Desktop 6 | 7 | If you want your app to be listed here, please make changes in this document and create PR. 8 | 9 | ### Status 10 | A free (libre) open source, mobile OS for Ethereum 11 | 12 | **site:** https://status.im 13 | 14 | **github:** https://github.com/status-im/status-react 15 | 16 | **download:** https://status.im/nightly 17 | -------------------------------------------------------------------------------- /local-cli/generator-desktop/templates/run-app.bat.in: -------------------------------------------------------------------------------- 1 | @rem Copyright (c) 2017-present, Status Research and Development GmbH. 2 | @rem All rights reserved. 3 | @rem 4 | @rem This source code is licensed under the BSD-style license found in the 5 | @rem LICENSE file in the root directory of this source tree. An additional grant 6 | @rem of patent rights can be found in the PATENTS file in the same directory. 7 | 8 | 9 | @rem Run app locally 10 | @CMAKE_BINARY_DIR@/bin/@APP_NAME@ 11 | 12 | -------------------------------------------------------------------------------- /Libraries/Components/StatusBar/StatusBarIOS.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule StatusBarIOS 10 | * @flow 11 | */ 12 | 'use strict'; 13 | 14 | module.exports = null; 15 | -------------------------------------------------------------------------------- /Libraries/RCTTest/SnapshotViewIOS.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule SnapshotViewIOS 10 | */ 11 | 'use strict'; 12 | 13 | module.exports = require('UnimplementedView'); 14 | -------------------------------------------------------------------------------- /Libraries/Components/SafeAreaView/SafeAreaView.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule SafeAreaView 10 | * @flow 11 | */ 12 | 'use strict'; 13 | 14 | module.exports = require('View'); 15 | -------------------------------------------------------------------------------- /Libraries/Components/View/PlatformViewPropTypes.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule PlatformViewPropTypes 10 | * @flow 11 | */ 12 | 13 | module.export = {}; 14 | -------------------------------------------------------------------------------- /ReactQt/tests/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestModuleTest.qml 4 | TestButtonProps.qml 5 | TestSliderProps.qml 6 | TestButtonSize.qml 7 | TestModalProps.qml 8 | TestTextInputProps.qml 9 | TestPickerProps.qml 10 | TestTextInputClear.qml 11 | TestArrayReconciliation.qml 12 | 13 | 14 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | Libraries/Animated/* @janicduplessis 2 | Libraries/NativeAnimation/* @janicduplessis 3 | Libraries/Image/* @shergin 4 | Libraries/Text/* @shergin 5 | React/Base/* @shergin 6 | React/Views/* @shergin 7 | React/Modules/* @shergin 8 | React/CxxBridge/* @mhorowitz 9 | ReactAndroid/src/main/java/com/facebook/react/animated/* @janicduplessis 10 | **/*.md @hramos 11 | package.json @hramos 12 | local-cli/core/* @grabbou @kureev 13 | local-cli/link/* @grabbou @kureev 14 | local-cli/unlink/* @grabbou @kureev 15 | -------------------------------------------------------------------------------- /Libraries/Components/ToolbarAndroid/ToolbarAndroid.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule ToolbarAndroid 10 | */ 11 | 'use strict'; 12 | 13 | module.exports = require('UnimplementedView'); 14 | -------------------------------------------------------------------------------- /Libraries/Components/ViewPager/ViewPagerAndroid.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule ViewPagerAndroid 10 | */ 11 | 'use strict'; 12 | 13 | module.exports = require('UnimplementedView'); 14 | -------------------------------------------------------------------------------- /Libraries/Components/MaskedView/MaskedViewIOS.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule MaskedViewIOS 10 | * @flow 11 | */ 12 | 'use strict'; 13 | 14 | module.exports = require('UnimplementedView'); 15 | -------------------------------------------------------------------------------- /Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule ProgressBarAndroid 10 | */ 11 | 'use strict'; 12 | 13 | module.exports = require('UnimplementedView'); 14 | -------------------------------------------------------------------------------- /ReactCommon/yoga/BUCK: -------------------------------------------------------------------------------- 1 | load("//tools/build_defs/oss:rn_defs.bzl", "cxx_library") 2 | 3 | cxx_library( 4 | name = "yoga", 5 | srcs = glob(["yoga/*.cpp"]), 6 | header_namespace = "", 7 | exported_headers = glob(["yoga/*.h"]), 8 | compiler_flags = [ 9 | "-fno-omit-frame-pointer", 10 | "-fexceptions", 11 | "-Wall", 12 | "-Werror", 13 | "-std=c++1y", 14 | "-O3", 15 | ], 16 | force_static = True, 17 | visibility = ["PUBLIC"], 18 | deps = [ 19 | ], 20 | ) 21 | -------------------------------------------------------------------------------- /ReactQt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (C) 2016, Canonical Ltd. 3 | # All rights reserved. 4 | 5 | # This source code is licensed under the BSD-style license found in the 6 | # LICENSE file in the root directory of this source tree. An additional grant 7 | # of patent rights can be found in the PATENTS file in the same directory. 8 | 9 | include_directories(runtime/src) 10 | set (APP_NAME "ReactNativeApp") 11 | set (JS_APP_NAME "ReactNativeApp") 12 | add_subdirectory(application) 13 | add_subdirectory(runtime) 14 | add_subdirectory(tests) 15 | -------------------------------------------------------------------------------- /ReactCommon/yoga/yoga/YGNodePrint.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | #pragma once 8 | #include 9 | 10 | #include "Yoga.h" 11 | 12 | namespace facebook { 13 | namespace yoga { 14 | 15 | void YGNodeToString( 16 | std::string* str, 17 | YGNodeRef node, 18 | YGPrintOptions options, 19 | uint32_t level); 20 | 21 | } // namespace yoga 22 | } // namespace facebook 23 | -------------------------------------------------------------------------------- /Examples/ActivityIndicator/ActivityIndicatorApp.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | ActivityIndicator, 5 | } from 'react-native'; 6 | 7 | export default class ActivityIndicatorReactNative extends Component { 8 | render() { 9 | return ( 10 | 14 | ); 15 | } 16 | } 17 | 18 | AppRegistry.registerComponent('ActivityIndicatorApp', () => ActivityIndicatorReactNative) 19 | -------------------------------------------------------------------------------- /ReactQt/application/src/main.qrc.in: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | main.qml 14 | ${JS_BUNDLE_RESOURCE} 15 | ${FONTS_RESOURCE} 16 | ${IMAGES_RESOURCE} 17 | ${ICON_PNG_RESOURCE} 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/SupportedNativeModulesList.md: -------------------------------------------------------------------------------- 1 | :warning::warning::warning: 2 | #### React Native Desktop project support stopped.. 3 | 4 | --- 5 | ### Overview 6 | 7 | react-native 3rd party native components extended with `Desktop` platform support: 8 | 9 | - react-native-i18n https://github.com/status-im/react-native-i18n.git#version_0.0.8_desktop 10 | - react-native-config https://github.com/status-im/react-native-config.git 11 | - react-native-fs https://github.com/status-im/react-native-fs.git 12 | - react-native-sound-level https://github.com/punarinta/react-native-sound-level 13 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/qml/ReactView.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import React 0.1 as React 3 | 4 | React.Item { 5 | id: viewRoot 6 | 7 | property var p_transformMatrix; 8 | property var viewManager: null 9 | property string p_nativeID 10 | property int p_zIndex: 0 11 | property string p_pointerEvents: "auto" 12 | property var flexbox: React.Flexbox {control: viewRoot; viewManager: viewRoot.viewManager} 13 | 14 | objectName: p_nativeID 15 | 16 | onP_transformMatrixChanged: viewManager.manageTransformMatrix(p_transformMatrix, viewRoot) 17 | 18 | z: p_zIndex 19 | } 20 | -------------------------------------------------------------------------------- /ReactQt/tests/test-activityindicator-props/TestActivityIndicatorProps.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | ActivityIndicator, 5 | } from 'react-native'; 6 | 7 | export default class ActivityIndicatorReactNative extends Component { 8 | render() { 9 | return ( 10 | 14 | ); 15 | } 16 | } 17 | 18 | AppRegistry.registerComponent('TestActivityIndicatorProps', () => ActivityIndicatorReactNative); 19 | -------------------------------------------------------------------------------- /ReactQt/tests/common/reactpropertytestcase.h: -------------------------------------------------------------------------------- 1 | #ifndef REACTPROPERTYTTESTCASE_H 2 | #define REACTPROPERTYTTESTCASE_H 3 | 4 | #include "reacttestcase.h" 5 | #include 6 | 7 | class ReactPropertyTestCase : public ReactTestCase { 8 | Q_OBJECT 9 | public: 10 | explicit ReactPropertyTestCase(QObject* parent = nullptr); 11 | 12 | private slots: 13 | 14 | void testProperties(); 15 | 16 | protected: 17 | virtual QVariantMap propValues() const = 0; 18 | virtual QQuickItem* control() const = 0; 19 | QVariant valueOfProperty(const QString& propertyName); 20 | }; 21 | 22 | #endif // REACTPROPERTYTTESTCASE_H 23 | -------------------------------------------------------------------------------- /ReactQt/tests/test-netexecutor-socket/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (c) 2017-present, Status Research and Development GmbH. 3 | # All rights reserved. 4 | 5 | # This source code is licensed under the BSD-style license found in the 6 | # LICENSE file in the root directory of this source tree. An additional grant 7 | # of patent rights can be found in the PATENTS file in the same directory. 8 | 9 | set(TEST_NAME test-netexecutor-socket) 10 | 11 | 12 | add_executable(${TEST_NAME} ${TEST_NAME}.cpp ${REACT_TEST_SOURCES}) 13 | add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) 14 | target_link_libraries(${TEST_NAME} ${REACT_TESTCASE_LIBRARIES}) 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /Libraries/Utilities/HMRLoadingView.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule HMRLoadingView 10 | * @flow 11 | */ 12 | 13 | 'use strict'; 14 | 15 | class HMRLoadingView { 16 | static showMessage(message: string) { 17 | } 18 | 19 | static hide() { 20 | } 21 | } 22 | 23 | module.exports = HMRLoadingView; 24 | -------------------------------------------------------------------------------- /RNTester/js/helloworld.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello Bundled World 5 | 6 | 7 | 21 | 22 | 23 |

Hello Bundled World

24 | 25 | 26 | -------------------------------------------------------------------------------- /ReactCommon/yoga/yoga/YGConfig.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #pragma once 9 | #include "Yoga-internal.h" 10 | #include "Yoga.h" 11 | 12 | struct YGConfig { 13 | std::array experimentalFeatures; 14 | bool useWebDefaults; 15 | bool useLegacyStretchBehaviour; 16 | bool shouldDiffLayoutWithoutLegacyStretchBehaviour; 17 | float pointScaleFactor; 18 | YGLogger logger; 19 | YGCloneNodeFunc cloneNodeCallback; 20 | void* context; 21 | 22 | YGConfig(YGLogger logger); 23 | }; 24 | -------------------------------------------------------------------------------- /Libraries/Components/AppleTV/TVEventHandler.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule TVEventHandler 10 | * @flow 11 | */ 12 | 'use strict'; 13 | 14 | function TVEventHandler() {} 15 | 16 | TVEventHandler.prototype.enable = function(component: ?any, callback: Function) {}; 17 | 18 | TVEventHandler.prototype.disable = function() {}; 19 | 20 | module.exports = TVEventHandler; 21 | -------------------------------------------------------------------------------- /local-cli/runDesktop/checkDesktop.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (C) 2016, Canonical Ltd. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | * Author: Justin McPherson 11 | * 12 | */ 13 | 14 | 'use strict'; 15 | 16 | const path = require('path'); 17 | const fs = require('fs'); 18 | 19 | function checkDesktop(args) { 20 | return fs.existsSync(path.join(args.root, 'desktop/CMakeLists.txt')); 21 | } 22 | 23 | module.exports = checkDesktop; 24 | -------------------------------------------------------------------------------- /ReactQt/tests/common/reactpropertytestcase.cpp: -------------------------------------------------------------------------------- 1 | #include "reacttestcase.h" 2 | 3 | #include "reactpropertytestcase.h" 4 | #include "rootview.h" 5 | #include 6 | #include 7 | 8 | ReactPropertyTestCase::ReactPropertyTestCase(QObject* parent) : ReactTestCase(parent) {} 9 | 10 | void ReactPropertyTestCase::testProperties() { 11 | for (const QString& propertyName : propValues().keys()) { 12 | auto propertyValue = propValues()[propertyName]; 13 | QCOMPARE(valueOfProperty(propertyName), propertyValue); 14 | } 15 | } 16 | 17 | QVariant ReactPropertyTestCase::valueOfProperty(const QString& propertyName) { 18 | return valueOfControlProperty(control(), propertyName); 19 | } 20 | -------------------------------------------------------------------------------- /Libraries/Vibration/VibrationIOS.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * Stub of VibrationIOS for Android. 10 | * 11 | * @providesModule VibrationIOS 12 | */ 13 | 'use strict'; 14 | 15 | var warning = require('fbjs/lib/warning'); 16 | 17 | var VibrationIOS = { 18 | vibrate: function() { 19 | warning('VibrationIOS is not supported on this platform!'); 20 | } 21 | }; 22 | 23 | module.exports = VibrationIOS; 24 | -------------------------------------------------------------------------------- /ReactQt/tests/test-button-props/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (c) 2017-present, Status Research and Development GmbH. 3 | # All rights reserved. 4 | 5 | # This source code is licensed under the BSD-style license found in the 6 | # LICENSE file in the root directory of this source tree. An additional grant 7 | # of patent rights can be found in the PATENTS file in the same directory. 8 | 9 | set(TEST_NAME test-button-props) 10 | 11 | set(REACT_TESTCASE_JS 12 | TestButtonProps.js 13 | ) 14 | 15 | 16 | add_executable(${TEST_NAME} ${TEST_NAME}.cpp resources.qrc ${REACT_TEST_SOURCES} ${REACT_TESTCASE_JS}) 17 | add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) 18 | target_link_libraries(${TEST_NAME} ${REACT_TESTCASE_LIBRARIES}) 19 | -------------------------------------------------------------------------------- /ReactQt/tests/test-button-size/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (c) 2017-present, Status Research and Development GmbH. 3 | # All rights reserved. 4 | 5 | # This source code is licensed under the BSD-style license found in the 6 | # LICENSE file in the root directory of this source tree. An additional grant 7 | # of patent rights can be found in the PATENTS file in the same directory. 8 | 9 | set(TEST_NAME test-button-size) 10 | 11 | set(REACT_TESTCASE_JS 12 | TestButtonSize.js 13 | ) 14 | 15 | 16 | add_executable(${TEST_NAME} ${TEST_NAME}.cpp resources.qrc ${REACT_TEST_SOURCES} ${REACT_TESTCASE_JS}) 17 | add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) 18 | target_link_libraries(${TEST_NAME} ${REACT_TESTCASE_LIBRARIES}) 19 | -------------------------------------------------------------------------------- /ReactQt/tests/test-image-props/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (c) 2017-present, Status Research and Development GmbH. 3 | # All rights reserved. 4 | 5 | # This source code is licensed under the BSD-style license found in the 6 | # LICENSE file in the root directory of this source tree. An additional grant 7 | # of patent rights can be found in the PATENTS file in the same directory. 8 | 9 | set(TEST_NAME test-image-props) 10 | 11 | set(REACT_TESTCASE_JS 12 | TestImageProps.js 13 | ) 14 | 15 | 16 | add_executable(${TEST_NAME} ${TEST_NAME}.cpp resources.qrc ${REACT_TEST_SOURCES} ${REACT_TESTCASE_JS}) 17 | add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) 18 | target_link_libraries(${TEST_NAME} ${REACT_TESTCASE_LIBRARIES}) 19 | -------------------------------------------------------------------------------- /ReactQt/tests/test-modal-props/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (c) 2017-present, Status Research and Development GmbH. 3 | # All rights reserved. 4 | 5 | # This source code is licensed under the BSD-style license found in the 6 | # LICENSE file in the root directory of this source tree. An additional grant 7 | # of patent rights can be found in the PATENTS file in the same directory. 8 | 9 | set(TEST_NAME test-modal-props) 10 | 11 | set(REACT_TESTCASE_JS 12 | TestModalProps.js 13 | ) 14 | 15 | 16 | add_executable(${TEST_NAME} ${TEST_NAME}.cpp resources.qrc ${REACT_TEST_SOURCES} ${REACT_TESTCASE_JS}) 17 | add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) 18 | target_link_libraries(${TEST_NAME} ${REACT_TESTCASE_LIBRARIES}) 19 | -------------------------------------------------------------------------------- /ReactQt/tests/test-picker-props/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (c) 2017-present, Status Research and Development GmbH. 3 | # All rights reserved. 4 | 5 | # This source code is licensed under the BSD-style license found in the 6 | # LICENSE file in the root directory of this source tree. An additional grant 7 | # of patent rights can be found in the PATENTS file in the same directory. 8 | 9 | set(TEST_NAME test-picker-props) 10 | 11 | set(REACT_TESTCASE_JS 12 | TestPickerProps.js 13 | ) 14 | 15 | 16 | add_executable(${TEST_NAME} ${TEST_NAME}.cpp resources.qrc ${REACT_TEST_SOURCES} ${REACT_TESTCASE_JS}) 17 | add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) 18 | target_link_libraries(${TEST_NAME} ${REACT_TESTCASE_LIBRARIES}) 19 | -------------------------------------------------------------------------------- /ReactQt/tests/test-slider-props/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (c) 2017-present, Status Research and Development GmbH. 3 | # All rights reserved. 4 | 5 | # This source code is licensed under the BSD-style license found in the 6 | # LICENSE file in the root directory of this source tree. An additional grant 7 | # of patent rights can be found in the PATENTS file in the same directory. 8 | 9 | set(TEST_NAME test-slider-props) 10 | 11 | set(REACT_TESTCASE_JS 12 | TestSliderProps.js 13 | ) 14 | 15 | 16 | add_executable(${TEST_NAME} ${TEST_NAME}.cpp resources.qrc ${REACT_TEST_SOURCES} ${REACT_TESTCASE_JS}) 17 | add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) 18 | target_link_libraries(${TEST_NAME} ${REACT_TESTCASE_LIBRARIES}) 19 | -------------------------------------------------------------------------------- /ReactCommon/yoga/yoga/YGConfig.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #include "YGConfig.h" 9 | 10 | const std::array 11 | kYGDefaultExperimentalFeatures = {{false}}; 12 | 13 | YGConfig::YGConfig(YGLogger logger) 14 | : experimentalFeatures(kYGDefaultExperimentalFeatures), 15 | useWebDefaults(false), 16 | useLegacyStretchBehaviour(false), 17 | shouldDiffLayoutWithoutLegacyStretchBehaviour(false), 18 | pointScaleFactor(1.0f), logger(logger), cloneNodeCallback(nullptr), 19 | context(nullptr) {} 20 | -------------------------------------------------------------------------------- /ReactQt/tests/test-textinput-clear/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (c) 2017-present, Status Research and Development GmbH. 3 | # All rights reserved. 4 | 5 | # This source code is licensed under the BSD-style license found in the 6 | # LICENSE file in the root directory of this source tree. An additional grant 7 | # of patent rights can be found in the PATENTS file in the same directory. 8 | 9 | set(TEST_NAME test-textinput-clear) 10 | 11 | set(REACT_TESTCASE_JS 12 | TestTextInputClear.js 13 | ) 14 | 15 | 16 | add_executable(${TEST_NAME} ${TEST_NAME}.cpp resources.qrc ${REACT_TEST_SOURCES} ${REACT_TESTCASE_JS}) 17 | add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) 18 | target_link_libraries(${TEST_NAME} ${REACT_TESTCASE_LIBRARIES}) 19 | -------------------------------------------------------------------------------- /ReactQt/tests/test-textinput-props/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (c) 2017-present, Status Research and Development GmbH. 3 | # All rights reserved. 4 | 5 | # This source code is licensed under the BSD-style license found in the 6 | # LICENSE file in the root directory of this source tree. An additional grant 7 | # of patent rights can be found in the PATENTS file in the same directory. 8 | 9 | set(TEST_NAME test-textinput-props) 10 | 11 | set(REACT_TESTCASE_JS 12 | TestTextInputProps.js 13 | ) 14 | 15 | 16 | add_executable(${TEST_NAME} ${TEST_NAME}.cpp resources.qrc ${REACT_TEST_SOURCES} ${REACT_TESTCASE_JS}) 17 | add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) 18 | target_link_libraries(${TEST_NAME} ${REACT_TESTCASE_LIBRARIES}) 19 | -------------------------------------------------------------------------------- /RNTester/js/TurboModuleExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | * @format 8 | * @flow 9 | */ 10 | 11 | 'use strict'; 12 | 13 | const React = require('react'); 14 | const SampleTurboModuleExample = require('./SampleTurboModuleExample'); 15 | 16 | exports.displayName = (undefined: ?string); 17 | exports.title = 'TurboModule'; 18 | exports.description = 'Usage of TurboModule'; 19 | exports.examples = [ 20 | { 21 | title: 'SampleTurboModule', 22 | render: function(): React.Element { 23 | return ; 24 | }, 25 | }, 26 | ]; 27 | -------------------------------------------------------------------------------- /Libraries/Components/DatePickerAndroid/DatePickerAndroid.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule DatePickerAndroid 10 | * @flow 11 | */ 12 | 'use strict'; 13 | 14 | const DatePickerAndroid = { 15 | async open(options: Object): Promise { 16 | return Promise.reject({ 17 | message: 'DatePickerAndroid is not supported on this platform.' 18 | }); 19 | }, 20 | }; 21 | 22 | module.exports = DatePickerAndroid; 23 | -------------------------------------------------------------------------------- /Libraries/Components/TimePickerAndroid/TimePickerAndroid.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule TimePickerAndroid 10 | * @flow 11 | */ 12 | 'use strict'; 13 | 14 | const TimePickerAndroid = { 15 | async open(options: Object): Promise { 16 | return Promise.reject({ 17 | message: 'TimePickerAndroid is not supported on this platform.' 18 | }); 19 | }, 20 | }; 21 | 22 | module.exports = TimePickerAndroid; 23 | -------------------------------------------------------------------------------- /ReactQt/tests/test-activityindicator-props/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (c) 2017-present, Status Research and Development GmbH. 3 | # All rights reserved. 4 | 5 | # This source code is licensed under the BSD-style license found in the 6 | # LICENSE file in the root directory of this source tree. An additional grant 7 | # of patent rights can be found in the PATENTS file in the same directory. 8 | 9 | set(TEST_NAME test-activityindicator-props) 10 | 11 | set(REACT_TESTCASE_JS 12 | TestActivityIndicatorProps.js 13 | ) 14 | 15 | 16 | add_executable(${TEST_NAME} ${TEST_NAME}.cpp resources.qrc ${REACT_TEST_SOURCES} ${REACT_TESTCASE_JS}) 17 | add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) 18 | target_link_libraries(${TEST_NAME} ${REACT_TESTCASE_LIBRARIES}) 19 | -------------------------------------------------------------------------------- /Libraries/Components/ToastAndroid/ToastAndroid.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule ToastAndroid 10 | */ 11 | 'use strict'; 12 | 13 | var warning = require('fbjs/lib/warning'); 14 | 15 | var ToastAndroid = { 16 | 17 | show: function ( 18 | message: string, 19 | duration: number 20 | ): void { 21 | warning(false, 'Cannot use ToastAndroid on Desktop.'); 22 | }, 23 | 24 | }; 25 | 26 | module.exports = ToastAndroid; 27 | -------------------------------------------------------------------------------- /RNTester/qml/RNTester.qml: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | import QtQuick 2.4 12 | import React 0.1 as React 13 | 14 | Rectangle { 15 | id: root 16 | width: 450; height: 800; 17 | 18 | React.RootView { 19 | objectName: "rootView" 20 | anchors.fill: parent 21 | 22 | moduleName: "RNTesterApp" 23 | codeLocation: "http://localhost:8081/RNTester/js/RNTesterApp.desktop-qt.bundle?platform=desktop-qt&dev=true" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /local-cli/generate-desktop.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const fs = require('fs'); 4 | const path = require('path'); 5 | const copyProjectTemplateAndReplace = require('./generator-desktop').copyProjectTemplateAndReplace; 6 | 7 | /** 8 | * Simple utility for running the Windows generator. 9 | * 10 | * @param {String} projectDir root project directory (i.e. contains index.js) 11 | * @param {String} name name of the root JS module for this app 12 | */ 13 | function generateDesktop (projectDir, name) { 14 | 15 | if (!fs.existsSync(projectDir)) { 16 | fs.mkdirSync(projectDir); 17 | } 18 | copyProjectTemplateAndReplace( 19 | path.join(__dirname, 'generator-desktop', 'templates'), 20 | projectDir, 21 | name 22 | ); 23 | } 24 | 25 | module.exports = generateDesktop; 26 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/jscutilities.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (c) 2017-present, Status Research and Development GmbH. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | */ 11 | 12 | #ifndef JSCUTILITIES 13 | #define JSCUTILITIES 14 | 15 | #include 16 | 17 | #include 18 | 19 | class QQuickItem; 20 | class QQmlEngine; 21 | 22 | namespace utilities { 23 | 24 | folly::dynamic qvariantToDynamic(const QVariant& value); 25 | QVariant dynamicToQVariant(const folly::dynamic& value); 26 | 27 | } // namespace utilities 28 | 29 | #endif // JSCUTILITIES 30 | -------------------------------------------------------------------------------- /ReactQt/tests/test-textinput-clear/TestTextInputClear.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | View, 5 | TextInput 6 | } from 'react-native'; 7 | 8 | import {NativeButton} from 'react-native-desktop-qt'; 9 | 10 | export default class TestTextInputClear extends Component { 11 | 12 | render() { 13 | return ( 14 | 15 | { this.textInput = input }} style={{height: 50, width: 200}}/> 16 | {this.textInput.clear()}}> 17 | 18 | ) 19 | } 20 | } 21 | 22 | 23 | AppRegistry.registerComponent('TestTextInputClear', () => TestTextInputClear) 24 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/reactplugin.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (C) 2016, Canonical Ltd. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | * Author: Justin McPherson 11 | * 12 | */ 13 | 14 | #ifndef REACTPLUGIN_H 15 | #define REACTPLUGIN_H 16 | #include 17 | 18 | class QJSEngine; 19 | 20 | class ReactPlugin : public QQmlExtensionPlugin { 21 | Q_OBJECT 22 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") 23 | 24 | public: 25 | void registerTypes(const char* uri); 26 | }; 27 | 28 | #endif // REACTPLUGIN_H 29 | -------------------------------------------------------------------------------- /Libraries/Components/Touchable/TouchableNativeFeedback.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule TouchableNativeFeedback 10 | */ 11 | 12 | 'use strict'; 13 | 14 | var React = require('React'); 15 | var View = require('View'); 16 | var createReactClass = require('create-react-class'); 17 | 18 | var TouchableNativeFeedback = createReactClass({ 19 | render: function() { 20 | return ( 21 | 22 | ); 23 | }, 24 | }); 25 | 26 | module.exports = TouchableNativeFeedback; 27 | -------------------------------------------------------------------------------- /docs/InspectJs.md: -------------------------------------------------------------------------------- 1 | :warning::warning::warning: 2 | #### React Native Desktop project support stopped.. 3 | 4 | --- 5 | ## Inspecting JS code 6 | 7 | ### Inspecting code 8 | 9 | 1) Run js server with `--inspect` switch: 10 | ```sh 11 | node --inspect js-executor.js 12 | ``` 13 | 14 | 2) Run your `react-native-desktop` application 15 | 16 | 3) Open `chrome://inspect` page in a Chrome browser 17 | ![](media/devtools-inspect-target.png) 18 | 19 | 4) Click on `inspect` link near `js-executor.js` Target 20 | 21 | 5) Chrome devtools will open where you can see console output of your application and debug it. 22 | 23 | ![](media/devtools-window.png) 24 | 25 | ### Inspecting UI 26 | 27 | Read how to investigate UI structure [with `react-devtools`](https://github.com/facebook/react-devtools/blob/master/packages/react-devtools/README.md) 28 | -------------------------------------------------------------------------------- /ReactQt/tests/test-button-size/TestButtonSize.qml: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | import QtQuick 2.4 12 | import React 0.1 as React 13 | 14 | Rectangle { 15 | id: root 16 | width: 640; height: 480; 17 | 18 | React.RootView { 19 | objectName: "rootView" 20 | anchors.fill: parent 21 | 22 | moduleName: "TestButtonSize" 23 | codeLocation: "http://localhost:8081/ReactQt/tests/test-button-size/TestButtonSize.bundle?platform=desktop-qt&dev=true" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ReactQt/tests/test-image-props/TestImageProps.qml: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | import QtQuick 2.4 12 | import React 0.1 as React 13 | 14 | Rectangle { 15 | id: root 16 | width: 640; height: 480; 17 | 18 | React.RootView { 19 | objectName: "rootView" 20 | anchors.fill: parent 21 | 22 | moduleName: "TestImageProps" 23 | codeLocation: "http://localhost:8081/ReactQt/tests/test-image-props/TestImageProps.bundle?platform=desktop-qt&dev=true" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ReactQt/tests/test-modal-props/TestModalProps.qml: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | import QtQuick 2.4 12 | import React 0.1 as React 13 | 14 | Rectangle { 15 | id: root 16 | width: 640; height: 480; 17 | 18 | React.RootView { 19 | objectName: "rootView" 20 | anchors.fill: parent 21 | 22 | moduleName: "TestModalProps" 23 | codeLocation: "http://localhost:8081/ReactQt/tests/test-modal-props/TestModalProps.bundle?platform=desktop-qt&dev=true" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ReactQt/tests/test-button-props/TestButtonProps.qml: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | import QtQuick 2.4 12 | import React 0.1 as React 13 | 14 | Rectangle { 15 | id: root 16 | width: 640; height: 480; 17 | 18 | React.RootView { 19 | objectName: "rootView" 20 | anchors.fill: parent 21 | 22 | moduleName: "TestButtonProps" 23 | codeLocation: "http://localhost:8081/ReactQt/tests/test-button-props/TestButtonProps.bundle?platform=desktop-qt&dev=true" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ReactQt/tests/test-picker-props/TestPickerProps.qml: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | import QtQuick 2.4 12 | import React 0.1 as React 13 | 14 | Rectangle { 15 | id: root 16 | width: 640; height: 480; 17 | 18 | React.RootView { 19 | objectName: "rootView" 20 | anchors.fill: parent 21 | 22 | moduleName: "TestPickerProps" 23 | codeLocation: "http://localhost:8081/ReactQt/tests/test-picker-props/TestPickerProps.bundle?platform=desktop-qt&dev=true" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ReactQt/tests/test-slider-props/TestSliderProps.qml: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | import QtQuick 2.4 12 | import React 0.1 as React 13 | 14 | Rectangle { 15 | id: root 16 | width: 640; height: 480; 17 | 18 | React.RootView { 19 | objectName: "rootView" 20 | anchors.fill: parent 21 | 22 | moduleName: "TestSliderProps" 23 | codeLocation: "http://localhost:8081/ReactQt/tests/test-slider-props/TestSliderProps.bundle?platform=desktop-qt&dev=true" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Libraries/Utilities/BackAndroid.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * iOS stub for BackAndroid.android.js 10 | * 11 | * @providesModule BackAndroid 12 | */ 13 | 14 | 'use strict'; 15 | 16 | var warning = require('fbjs/lib/warning'); 17 | 18 | function platformWarn() { 19 | warning(false, 'BackAndroid is not supported on this platform.'); 20 | } 21 | 22 | var BackAndroid = { 23 | exitApp: platformWarn, 24 | addEventListener: platformWarn, 25 | removeEventListener: platformWarn, 26 | }; 27 | 28 | module.exports = BackAndroid; 29 | -------------------------------------------------------------------------------- /ReactQt/tests/test-integration/TestModuleTest.qml: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | import QtQuick 2.4 12 | import React 0.1 as React 13 | 14 | Rectangle { 15 | id: root 16 | width: 640; height: 480; 17 | color: "red" 18 | 19 | React.RootView { 20 | objectName: "rootView" 21 | anchors.fill: parent 22 | 23 | moduleName: "TestModuleTest" 24 | codeLocation: "http://localhost:8081/IntegrationTests/TestModuleTest.bundle?platform=desktop-qt&dev=true" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /RNTester/js/http_test_server.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | /** 3 | * Copyright (c) Facebook, Inc. and its affiliates. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | * 8 | * @flow 9 | * @format 10 | */ 11 | 'use strict'; 12 | 13 | /* eslint-env node */ 14 | 15 | console.log(`\ 16 | Test server for WebSocketExample 17 | 18 | This will set a cookie named "wstest" on the response of any incoming request. 19 | `); 20 | 21 | const connect = require('connect'); 22 | const http = require('http'); 23 | 24 | const app = connect(); 25 | 26 | app.use(function(req, res) { 27 | console.log('received request'); 28 | res.setHeader('Set-Cookie', ['wstest=OK; Path=/']); 29 | res.end('Cookie has been set!\n'); 30 | }); 31 | 32 | http.createServer(app).listen(5556); 33 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/moduleloader.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (C) 2016, Canonical Ltd. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | * Author: Justin McPherson 11 | * 12 | */ 13 | 14 | #ifndef MODULELOADER_H 15 | #define MODULELOADER_H 16 | 17 | #include 18 | 19 | class ModuleLoader { 20 | public: 21 | virtual ~ModuleLoader() {} 22 | 23 | virtual QObjectList availableModules() = 0; 24 | }; 25 | 26 | #define ModuleLoader_IID "com.canonical.ReactNative.ModuleLoader" 27 | 28 | Q_DECLARE_INTERFACE(ModuleLoader, ModuleLoader_IID); 29 | 30 | #endif // MODULELOADER_H 31 | -------------------------------------------------------------------------------- /ReactQt/tests/test-array-reconciliation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (c) 2017-present, Status Research and Development GmbH. 3 | # All rights reserved. 4 | 5 | # This source code is licensed under the BSD-style license found in the 6 | # LICENSE file in the root directory of this source tree. An additional grant 7 | # of patent rights can be found in the PATENTS file in the same directory. 8 | 9 | set(TEST_NAME test-array-reconciliation) 10 | 11 | set(REACT_TESTCASE_JS 12 | TestArrayReconciliationDeleteLast.js 13 | TestArrayReconciliationInsertFirst.js 14 | TestArrayReconciliationItemMove.js 15 | 16 | ) 17 | 18 | 19 | add_executable(${TEST_NAME} ${TEST_NAME}.cpp resources.qrc ${REACT_TEST_SOURCES} ${REACT_TESTCASE_JS}) 20 | add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) 21 | target_link_libraries(${TEST_NAME} ${REACT_TESTCASE_LIBRARIES}) 22 | -------------------------------------------------------------------------------- /ReactQt/tests/test-textinput-clear/TestTextInputClear.qml: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | import QtQuick 2.4 12 | import React 0.1 as React 13 | 14 | Rectangle { 15 | id: root 16 | width: 640; height: 480; 17 | 18 | React.RootView { 19 | objectName: "rootView" 20 | anchors.fill: parent 21 | 22 | moduleName: "TestTextInputClear" 23 | codeLocation: "http://localhost:8081/ReactQt/tests/test-textinput-clear/TestTextInputClear.bundle?platform=desktop-qt&dev=true" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ReactQt/tests/test-textinput-props/TestTextInputProps.qml: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | import QtQuick 2.4 12 | import React 0.1 as React 13 | 14 | Rectangle { 15 | id: root 16 | width: 640; height: 480; 17 | 18 | React.RootView { 19 | objectName: "rootView" 20 | anchors.fill: parent 21 | 22 | moduleName: "TestTextInputProps" 23 | codeLocation: "http://localhost:8081/ReactQt/tests/test-textinput-props/TestTextInputProps.bundle?platform=desktop-qt&dev=true" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/valuecoercion.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (C) 2016, Canonical Ltd. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | * Author: Justin McPherson 11 | * 12 | */ 13 | 14 | #ifndef REACTVALUECOERCION_H 15 | #define REACTVALUECOERCION_H 16 | 17 | #include 18 | 19 | #include 20 | 21 | typedef std::function coerce_function; 22 | typedef QMap coerce_map; 23 | 24 | QVariant reactCoerceValue(const QVariant& data, int parameterType, const coerce_map* userCoercions = nullptr); 25 | 26 | #endif // REACTVALUECOERCION_H 27 | -------------------------------------------------------------------------------- /docs/InstallUpdatedReactNativeCLI.md: -------------------------------------------------------------------------------- 1 | :warning::warning::warning: 2 | #### React Native Desktop project support stopped.. 3 | 4 | --- 5 | ## Overview 6 | 7 | Original `react-native-cli` is extended with CLI commands to generate, build and run react-native projects for `desktop` platform. To be able to create react-native apps for `desktop` platform you should either specify `--version` in the original CLI when creating a react-native app, `react-native init DesktopApp --version status-im/react-native-desktop`, or install the extended version of the CLI by following the next steps and then running `react-native init DesktopApp`. 8 | 9 | 1. `git clone https://github.com/status-im/react-native-desktop.git` 10 | 2. `cd react-native-desktop/react-native-cli` 11 | 3. `npm update` 12 | 4. `npm uninstall -g react-native-cli` (remove original package if installed) 13 | 5. `npm install -g` 14 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/componentmanagers/scrollviewmodel.h: -------------------------------------------------------------------------------- 1 | #ifndef SCROLLVIEWMODEL_H 2 | #define SCROLLVIEWMODEL_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class ScrollViewModel : public QAbstractListModel { 9 | Q_OBJECT 10 | 11 | public slots: 12 | int count() const; 13 | 14 | public: 15 | ScrollViewModel(QQmlEngine* engine, QObject* parent = nullptr); 16 | 17 | int rowCount(const QModelIndex& parent = QModelIndex()) const; 18 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; 19 | void insert(QQuickItem* item, int position); 20 | QVariant takeAt(int position); 21 | 22 | private: 23 | QVariantList m_model; 24 | QQmlEngine* m_engine = nullptr; 25 | }; 26 | 27 | using ScrollViewModelPtr = QSharedPointer; 28 | 29 | #endif // SCROLLVIEWMODEL_H 30 | -------------------------------------------------------------------------------- /ReactQt/tests/test-textinput-props/TestTextInputProps.js: -------------------------------------------------------------------------------- 1 | 2 | import React, { Component } from 'react'; 3 | import { 4 | AppRegistry, 5 | TextInput 6 | } from 'react-native'; 7 | 8 | 9 | export default class TextInputReactNative extends Component { 10 | render() { 11 | return ( 12 | console.log("TextInput.onChange()")} 19 | onSelectionChange={(event) => console.log("TextInput.oSelectionChange()")} 20 | style={[{textAlign: 'left'}, {color: 'green'}]} 21 | > 22 | 23 | ); 24 | } 25 | } 26 | 27 | AppRegistry.registerComponent('TestTextInputProps', () => TextInputReactNative) 28 | -------------------------------------------------------------------------------- /Libraries/Utilities/BackHandler.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | * On Apple TV, this implements back navigation using the TV remote's menu button. 8 | * On iOS, this just implements a stub. 9 | * 10 | * @providesModule BackHandler 11 | */ 12 | 13 | 'use strict'; 14 | 15 | const Platform = require('Platform'); 16 | 17 | type BackPressEventName = $Enum<{ 18 | backPress: string, 19 | }>; 20 | 21 | function emptyFunction() {} 22 | 23 | let BackHandler; 24 | 25 | BackHandler = { 26 | exitApp: emptyFunction, 27 | addEventListener() { 28 | return { 29 | remove: emptyFunction, 30 | }; 31 | }, 32 | removeEventListener: emptyFunction, 33 | }; 34 | 35 | module.exports = BackHandler; 36 | -------------------------------------------------------------------------------- /RNTester/js/createExamplePage.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | * @format 8 | * @flow 9 | */ 10 | 11 | 'use strict'; 12 | 13 | const React = require('react'); 14 | 15 | const RNTesterExampleContainer = require('./RNTesterExampleContainer'); 16 | import type {RNTesterExample} from './Shared/RNTesterTypes'; 17 | 18 | const createExamplePage = function( 19 | title: ?string, 20 | exampleModule: RNTesterExample, 21 | ): React.ComponentType { 22 | class ExamplePage extends React.Component<{}> { 23 | render() { 24 | return ; 25 | } 26 | } 27 | 28 | return ExamplePage; 29 | }; 30 | 31 | module.exports = createExamplePage; 32 | -------------------------------------------------------------------------------- /RNTester/js/SetPropertiesExampleApp.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | * @format 8 | * @flow strict-local 9 | */ 10 | 11 | 'use strict'; 12 | 13 | const React = require('react'); 14 | const {Text, View} = require('react-native'); 15 | 16 | class SetPropertiesExampleApp extends React.Component<$FlowFixMeProps> { 17 | render() { 18 | const wrapperStyle = { 19 | backgroundColor: this.props.color, 20 | flex: 1, 21 | alignItems: 'center', 22 | justifyContent: 'center', 23 | }; 24 | 25 | return ( 26 | 27 | Embedded React Native view 28 | 29 | ); 30 | } 31 | } 32 | 33 | module.exports = SetPropertiesExampleApp; 34 | -------------------------------------------------------------------------------- /ReactQt/tests/test-activityindicator-props/TestActivityIndicatorProps.qml: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | import QtQuick 2.4 12 | import React 0.1 as React 13 | 14 | Rectangle { 15 | id: root 16 | width: 640; height: 480; 17 | 18 | React.RootView { 19 | objectName: "rootView" 20 | anchors.fill: parent 21 | 22 | moduleName: "TestActivityIndicatorProps" 23 | codeLocation: "http://localhost:8081/ReactQt/tests/test-activityindicator-props/TestActivityIndicatorProps.bundle?platform=desktop-qt&dev=true" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ReactQt/tests/test-slider-props/TestSliderProps.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | Text, 6 | View, 7 | Slider 8 | } from 'react-native'; 9 | 10 | export default class SliderReactNative extends Component { 11 | render() { 12 | return ( 13 | console.log('Slider.onValueChange()')} 22 | onSlidingComplete={() => console.log('Slider.onSlidingComplete()')} 23 | thumbTintColor={'green'} 24 | testID={'testSlider'} 25 | /> 26 | ); 27 | } 28 | } 29 | 30 | AppRegistry.registerComponent('TestSliderProps', () => SliderReactNative); 31 | -------------------------------------------------------------------------------- /ReactQt/tests/test-array-reconciliation/TestArrayReconciliation.qml: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | import QtQuick 2.4 12 | import React 0.1 as React 13 | 14 | Rectangle { 15 | id: root 16 | width: 640; height: 480; 17 | 18 | React.RootView { 19 | objectName: "rootView" 20 | anchors.fill: parent 21 | 22 | moduleName: "TestArrayReconciliationInsertFirst" 23 | codeLocation: "http://localhost:8081/ReactQt/tests/test-array-reconciliation/TestArrayReconciliationInsertFirst.bundle?platform=desktop-qt&dev=true" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/qml/ReactQtWebKitWebView.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.9 2 | import QtQuick.Controls 2.2 3 | 4 | import QtWebKit 3.0 5 | import React 0.1 as React 6 | 7 | WebView { 8 | id: webViewRoot 9 | property var p_source: '' 10 | property var webViewManager: null 11 | property var flexbox: React.Flexbox {control: webViewRoot} 12 | 13 | onWebViewManagerChanged: { 14 | if (!webViewManager) { 15 | return; 16 | } 17 | webViewManager.s_reload.connect(webViewRoot.reload); 18 | webViewManager.s_goBack.connect(webViewRoot.goBack); 19 | webViewManager.s_goForward.connect(webViewRoot.goForward); 20 | } 21 | 22 | onP_sourceChanged: { 23 | webViewRoot.url = (p_source && p_source.uri) ? p_source.uri : ""; 24 | if(p_source && p_source.html) { 25 | webViewRoot.loadHtml(p_source.html) 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /ReactQt/tests/test-picker-props/TestPickerProps.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | Picker 5 | } from 'react-native'; 6 | 7 | const StyleSheet = require('StyleSheet'); 8 | const Item = Picker.Item; 9 | 10 | export default class PickerReactNative extends Component { 11 | render() { 12 | return ( 13 | console.log("Picker.onValueChange()")} 18 | > 19 | 20 | 21 | 22 | ); 23 | } 24 | } 25 | 26 | var styles = StyleSheet.create({ 27 | picker: { 28 | width: 100, 29 | height: 200 30 | }, 31 | }); 32 | 33 | AppRegistry.registerComponent('TestPickerProps', () => PickerReactNative) 34 | 35 | 36 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-desktop-qt", 3 | "version": "0.60.6", 4 | "description": "React native for desktop", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1", 7 | "start": "react-native start" 8 | }, 9 | "main": "Libraries/react-native-desktop-qt/react-native-desktop-qt-implementation.js", 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/status-im/react-native-desktop-qt.git" 13 | }, 14 | "author": "Volodymyr Kozieiev", 15 | "license": "MIT", 16 | "bugs": { 17 | "url": "https://github.com/vkjr/react-native-desktop-qt/issues" 18 | }, 19 | "homepage": "https://github.com/vkjr/react-native-desktop-qt#readme", 20 | "dependencies": { 21 | "optimist": "^0.6.1", 22 | "babel-plugin-module-resolver": "^4.0.0" 23 | }, 24 | "devDependencies": { 25 | "react": "16.8.6", 26 | "react-native": "0.60.6" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Libraries/Components/TabBarIOS/TabBarIOS.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule TabBarIOS 10 | */ 11 | 12 | 'use strict'; 13 | 14 | var React = require('React'); 15 | var View = require('View'); 16 | var StyleSheet = require('StyleSheet'); 17 | 18 | var DummyTabBarIOS = React.createClass({ 19 | render: function() { 20 | return ( 21 | 22 | {this.props.children} 23 | 24 | ); 25 | } 26 | }); 27 | 28 | var styles = StyleSheet.create({ 29 | tabGroup: { 30 | flex: 1, 31 | } 32 | }); 33 | 34 | module.exports = DummyTabBarIOS; 35 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/jscutilities.cpp: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (c) 2017-present, Status Research and Development GmbH. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | */ 11 | 12 | #include "jscutilities.h" 13 | 14 | #include 15 | 16 | namespace utilities { 17 | 18 | folly::dynamic qvariantToDynamic(const QVariant& value) { 19 | QJsonDocument doc = QJsonDocument::fromVariant(value); 20 | return folly::parseJson(doc.toJson(QJsonDocument::Compact).toStdString()); 21 | } 22 | 23 | QVariant dynamicToQVariant(const folly::dynamic& value) { 24 | std::string jsonStr = folly::toJson(value); 25 | return QJsonDocument::fromJson(jsonStr.c_str()).toVariant(); 26 | } 27 | 28 | } // namespace utilities 29 | -------------------------------------------------------------------------------- /ReactQt/application/src/main.qml.in: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (C) 2016, Canonical Ltd. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | */ 10 | 11 | import QtQuick 2.4 12 | import React 0.1 as React 13 | 14 | Rectangle { 15 | id: root 16 | width: 384 17 | height: 640 18 | 19 | React.RootView { 20 | anchors.fill: parent 21 | liveReload: ReactNativeProperties.liveReload 22 | 23 | moduleName: "${JS_APP_NAME}" 24 | codeLocation: ReactNativeProperties.codeLocation 25 | pluginsPath: ReactNativeProperties.pluginsPath 26 | serverConnectionType: ReactNativeProperties.executor 27 | jsExecutor: ReactNativeProperties.jsExecutor 28 | externalModules: [${EXTERNAL_MODULES}] 29 | properties: ReactNativeProperties.initialProps 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/reactplugin.cpp: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (C) 2016, Canonical Ltd. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | * Author: Justin McPherson 11 | * 12 | */ 13 | 14 | #include "reactplugin.h" 15 | #include "utilities.h" 16 | 17 | #include 18 | 19 | void ReactPlugin::registerTypes(const char* uri) { 20 | utilities::registerReactTypes(); 21 | #ifdef QT_DEBUG 22 | QLoggingCategory::setFilterRules("UIManager=false\n" 23 | "Flexbox=false\n" 24 | "WebSocketModule=false\n" 25 | "Networking=false\n" 26 | "ViewManager=false\n"); 27 | #endif 28 | } 29 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/testmodule.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #include "testmodule.h" 12 | #include "bridge.h" 13 | #include "eventdispatcher.h" 14 | 15 | #include 16 | 17 | class TestModulePrivate { 18 | public: 19 | Bridge* bridge = nullptr; 20 | }; 21 | 22 | TestModule::TestModule(QObject* parent) : QObject(parent), d_ptr(new TestModulePrivate) {} 23 | 24 | TestModule::~TestModule() {} 25 | 26 | void TestModule::setBridge(Bridge* bridge) { 27 | Q_D(TestModule); 28 | d->bridge = bridge; 29 | } 30 | 31 | QString TestModule::moduleName() { 32 | return "TestModule"; 33 | } 34 | 35 | void TestModule::markTestCompleted() { 36 | emit testCompleted(); 37 | } 38 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/platform.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #ifndef PLATFORM_H 12 | #define PLATFORM_H 13 | 14 | #include "moduleinterface.h" 15 | 16 | #include 17 | 18 | class PlatformPrivate; 19 | class Platform : public QObject, public ModuleInterface { 20 | Q_OBJECT 21 | Q_INTERFACES(ModuleInterface) 22 | 23 | Q_DECLARE_PRIVATE(Platform) 24 | 25 | public: 26 | Platform(QObject* parent = 0); 27 | ~Platform(); 28 | 29 | void setBridge(Bridge* bridge) override; 30 | 31 | QString moduleName() override; 32 | QVariantMap constantsToExport() override; 33 | 34 | private: 35 | QScopedPointer d_ptr; 36 | }; 37 | 38 | #endif // PLATFORM_H 39 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/redbox.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (c) 2017-present, Status Research and Development GmbH. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | */ 11 | 12 | #ifndef REDBOX_H 13 | #define REDBOX_H 14 | 15 | #include 16 | 17 | class Bridge; 18 | 19 | class RedboxPrivate; 20 | class Redbox : public QObject { 21 | Q_DECLARE_PRIVATE(Redbox) 22 | 23 | public: 24 | Redbox(Bridge* bridge); 25 | ~Redbox(); 26 | 27 | void showErrorMessage(const QString& message, const QList& stack = QList()); 28 | void updateErrorMessage(const QString& message, const QList& stack = QList()); 29 | 30 | QString errorMessage() const; 31 | 32 | private: 33 | QScopedPointer d_ptr; 34 | }; 35 | 36 | #endif // REDBOX_H 37 | -------------------------------------------------------------------------------- /Libraries/Settings/Settings.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule Settings 10 | * @flow 11 | */ 12 | 'use strict'; 13 | 14 | var Settings = { 15 | get(key: string): mixed { 16 | console.warn('Settings is not yet supported on Desktop'); 17 | return null; 18 | }, 19 | 20 | set(settings: Object) { 21 | console.warn('Settings is not yet supported on Desktop'); 22 | }, 23 | 24 | watchKeys(keys: string | Array, callback: Function): number { 25 | console.warn('Settings is not yet supported on Desktop'); 26 | return -1; 27 | }, 28 | 29 | clearWatch(watchId: number) { 30 | console.warn('Settings is not yet supported on Desktop'); 31 | }, 32 | }; 33 | 34 | module.exports = Settings; 35 | -------------------------------------------------------------------------------- /RNTester/js/messagingtest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Messaging Test 5 | 6 | 7 | 8 | 9 |

Messages received from React Native: 0

10 |

(No messages)

11 | 14 | 15 | 28 | 29 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/qml/ReactButton.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.9 2 | import QtQuick.Controls 2.2 3 | import QtGraphicalEffects 1.0 4 | import React 0.1 as React 5 | 6 | Button { 7 | id: buttonRoot 8 | 9 | property string p_accessibilityLabel 10 | property string p_title 11 | property string p_color: "#e0e0e0" 12 | property bool p_disabled: false 13 | property bool p_onPress: false 14 | property string p_testID 15 | property var buttonManager: null 16 | property var flexbox: React.Flexbox { 17 | control: buttonRoot 18 | p_minWidth: buttonRoot.implicitWidth 19 | p_minHeight: buttonRoot.implicitHeight 20 | } 21 | 22 | text: p_title 23 | objectName: p_testID 24 | enabled: !p_disabled 25 | 26 | background: Rectangle { 27 | color: buttonRoot.down ? Qt.darker(buttonRoot.p_color, 1.2) : buttonRoot.p_color 28 | visible: !buttonRoot.flat || buttonRoot.down || buttonRoot.checked || buttonRoot.highlighted 29 | } 30 | onPressed: buttonManager.sendPressedNotificationToJs(buttonRoot) 31 | } 32 | -------------------------------------------------------------------------------- /RNTester/js/RNTesterTitle.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | * @format 8 | * @flow strict-local 9 | */ 10 | 11 | 'use strict'; 12 | 13 | const React = require('react'); 14 | const {StyleSheet, Text, View} = require('react-native'); 15 | 16 | class RNTesterTitle extends React.Component<$FlowFixMeProps> { 17 | render() { 18 | return ( 19 | 20 | {this.props.title} 21 | 22 | ); 23 | } 24 | } 25 | 26 | const styles = StyleSheet.create({ 27 | container: { 28 | borderRadius: 4, 29 | borderWidth: 0.5, 30 | borderColor: '#d6d7da', 31 | margin: 10, 32 | marginBottom: 0, 33 | height: 45, 34 | padding: 10, 35 | backgroundColor: 'white', 36 | }, 37 | text: { 38 | fontSize: 19, 39 | fontWeight: '500', 40 | }, 41 | }); 42 | 43 | module.exports = RNTesterTitle; 44 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/eventdispatcher.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (C) 2016, Canonical Ltd. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | * Author: Justin McPherson 11 | * 12 | */ 13 | 14 | #ifndef EVENTDISPATCHER_H 15 | #define EVENTDISPATCHER_H 16 | 17 | #include 18 | 19 | class Bridge; 20 | 21 | class EventDispatcherPrivate; 22 | class EventDispatcher : public QObject { 23 | Q_OBJECT 24 | Q_DECLARE_PRIVATE(EventDispatcher); 25 | 26 | public: 27 | EventDispatcher(Bridge* bridge); 28 | ~EventDispatcher(); 29 | 30 | void sendDeviceEvent(const QString& name, const QVariantList& args); 31 | void sendDeviceEvent(const QString& name, const QVariantMap& args); 32 | 33 | private: 34 | QScopedPointer d_ptr; 35 | }; 36 | 37 | #endif // EVENTDISPATCHER_H 38 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/blobprovider.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #include "blobprovider.h" 12 | #include "bridge.h" 13 | 14 | class BlobProviderPrivate { 15 | public: 16 | Bridge* bridge = nullptr; 17 | }; 18 | 19 | BlobProvider::BlobProvider(QObject* parent) : QObject(parent), d_ptr(new BlobProviderPrivate) {} 20 | 21 | BlobProvider::~BlobProvider() {} 22 | 23 | void BlobProvider::setBridge(Bridge* bridge) { 24 | Q_D(BlobProvider); 25 | d->bridge = bridge; 26 | } 27 | 28 | QString BlobProvider::moduleName() { 29 | return "RCTBlobModule"; 30 | } 31 | 32 | void BlobProvider::enableBlobSupport(qlonglong socketId) {} 33 | 34 | void BlobProvider::disableBlobSupport(qlonglong socketId) {} 35 | 36 | void BlobProvider::addNetworkingHandler() {} 37 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/testmodule.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #ifndef TESTMODULE_H 12 | #define TESTMODULE_H 13 | 14 | #include "moduleinterface.h" 15 | 16 | #include 17 | 18 | class TestModulePrivate; 19 | class TestModule : public QObject, public ModuleInterface { 20 | Q_OBJECT 21 | Q_INTERFACES(ModuleInterface) 22 | 23 | Q_DECLARE_PRIVATE(TestModule) 24 | 25 | public: 26 | TestModule(QObject* parent = 0); 27 | ~TestModule(); 28 | 29 | void setBridge(Bridge* bridge) override; 30 | 31 | QString moduleName() override; 32 | 33 | Q_INVOKABLE void markTestCompleted(); 34 | 35 | signals: 36 | void testCompleted(); 37 | 38 | private: 39 | QScopedPointer d_ptr; 40 | }; 41 | 42 | #endif // TESTMODULE_H 43 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/deviceinfo.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #ifndef DEVICEINFO_H 12 | #define DEVICEINFO_H 13 | 14 | #include "moduleinterface.h" 15 | 16 | #include 17 | 18 | class DeviceInfoPrivate; 19 | class DeviceInfo : public QObject, public ModuleInterface { 20 | Q_OBJECT 21 | Q_INTERFACES(ModuleInterface) 22 | 23 | Q_DECLARE_PRIVATE(DeviceInfo) 24 | 25 | public: 26 | DeviceInfo(QObject* parent = 0); 27 | ~DeviceInfo(); 28 | 29 | void setBridge(Bridge* bridge) override; 30 | 31 | QString moduleName() override; 32 | QList methodsToExport() override; 33 | QVariantMap constantsToExport() override; 34 | 35 | private: 36 | QScopedPointer d_ptr; 37 | }; 38 | 39 | #endif // DEVICEINFO_H 40 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/componentmanagers/scrollviewmodel.cpp: -------------------------------------------------------------------------------- 1 | #include "scrollviewmodel.h" 2 | #include 3 | 4 | ScrollViewModel::ScrollViewModel(QQmlEngine* engine, QObject* parent) : QAbstractListModel(parent) { 5 | m_engine = engine; 6 | } 7 | 8 | int ScrollViewModel::rowCount(const QModelIndex& parent) const { 9 | return count(); 10 | } 11 | 12 | int ScrollViewModel::count() const { 13 | return m_model.size(); 14 | } 15 | 16 | QVariant ScrollViewModel::data(const QModelIndex& index, int role) const { 17 | Q_UNUSED(role) 18 | if (!hasIndex(index.row(), index.column(), index.parent())) 19 | return {}; 20 | 21 | return m_model[index.row()]; 22 | } 23 | 24 | void ScrollViewModel::insert(QQuickItem* item, int position) { 25 | beginInsertRows(QModelIndex(), position, position); 26 | m_model.insert(position, QVariant::fromValue(item)); 27 | endInsertRows(); 28 | } 29 | 30 | QVariant ScrollViewModel::takeAt(int position) { 31 | beginRemoveRows(QModelIndex(), position, position); 32 | QVariant result = m_model.takeAt(position); 33 | endRemoveRows(); 34 | return result; 35 | } 36 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/moduledata.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (C) 2016, Canonical Ltd. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | * Author: Justin McPherson 11 | * 12 | */ 13 | 14 | #ifndef MODULEDATA_H 15 | #define MODULEDATA_H 16 | 17 | #include 18 | 19 | class QObject; 20 | class ModuleMethod; 21 | class ViewManager; 22 | 23 | class ModuleDataPrivate; 24 | class ModuleData : public QObject { 25 | Q_DECLARE_PRIVATE(ModuleData) 26 | Q_OBJECT 27 | 28 | public: 29 | ModuleData(QObject* moduleImpl, int id); 30 | ~ModuleData(); 31 | 32 | int id() const; 33 | QString name() const; 34 | 35 | QVariant info() const; 36 | 37 | ModuleMethod* method(int id) const; 38 | 39 | ViewManager* viewManager() const; 40 | 41 | private: 42 | QScopedPointer d_ptr; 43 | }; 44 | 45 | #endif // MODULEDATA_H 46 | -------------------------------------------------------------------------------- /ReactQt/tests/test-button-size/TestButtonSize.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | View 6 | } from 'react-native'; 7 | import {NativeButton} from 'react-native-desktop-qt'; 8 | 9 | const onButtonPress = () => { 10 | }; 11 | 12 | export default class TestButtonSize extends Component { 13 | 14 | render() { 15 | return ( 16 | 17 | 18 | 21 | 22 | 23 | 24 | ) 25 | } 26 | } 27 | 28 | const styles = StyleSheet.create ({ 29 | container: { 30 | alignItems: 'center', 31 | backgroundColor: '#00ff00', 32 | }, 33 | modal: { 34 | flex: 1, 35 | alignItems: 'center', 36 | backgroundColor: '#ff0000', 37 | } 38 | }) 39 | 40 | AppRegistry.registerComponent('TestButtonSize', () => TestButtonSize) 41 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/alert.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (c) 2017-present, Status Research and Development GmbH. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | */ 11 | 12 | #ifndef ALERT_H 13 | #define ALERT_H 14 | 15 | #include "moduleinterface.h" 16 | 17 | class AlertPrivate; 18 | class Alert : public QObject, public ModuleInterface { 19 | Q_OBJECT 20 | Q_INTERFACES(ModuleInterface) 21 | Q_DECLARE_PRIVATE(Alert) 22 | 23 | Q_INVOKABLE void alert(const QVariantMap& config, double callback); 24 | 25 | public slots: 26 | void sendButtonClickToJs(double callback, const QString& buttonName); 27 | void sendDismissedToJs(double callback); 28 | 29 | public: 30 | Alert(QObject* parent = 0); 31 | virtual ~Alert(); 32 | 33 | void setBridge(Bridge* bridge) override; 34 | 35 | QString moduleName() override; 36 | 37 | private: 38 | QScopedPointer d_ptr; 39 | }; 40 | 41 | #endif // ALERT_H 42 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/qml/ReactPicker.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.9 2 | import QtQuick.Controls 2.2 3 | import React 0.1 as React 4 | 5 | Tumbler { 6 | id: tumbler 7 | property var pickerManager: null 8 | property variant flexbox: React.Flexbox {control: tumbler} 9 | property variant p_items: [] 10 | property int p_selected: 0 11 | property bool p_onValueChange: false 12 | property string p_testID 13 | 14 | model: p_items 15 | currentIndex: p_selected 16 | 17 | background: Rectangle { 18 | color: "lightgrey" 19 | border.color: "grey" 20 | } 21 | delegate: 22 | Text { 23 | id: label 24 | text: modelData.label 25 | color: modelData.color ? modelData.color : "black" 26 | font: tumbler.font 27 | opacity: (1.0 - Math.abs(Tumbler.displacement) / (visibleItemCount / 2)) * (tumbler.enabled ? 1 : 0.6) 28 | horizontalAlignment: Text.AlignHCenter 29 | verticalAlignment: Text.AlignVCenter 30 | } 31 | onCurrentIndexChanged: { 32 | if (pickerManager) { 33 | pickerManager.sendValueChangeToJs(tumbler, currentIndex); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🐛 Bug Report 3 | about: Report a reproducible bug or regression in `react-native-desktop` 4 | --- 5 | 6 | 7 | - [ ] Review the documentation: https://facebook.github.io/react-native https://github.com/status-im/react-native-desktop/tree/master/docs 8 | - [ ] Search for existing issues: https://github.com/facebook/react-native/issues https://github.com/status-im/react-native-desktop/issues 9 | - [ ] Use the latest React Native release: https://github.com/facebook/react-native/releases https://github.com/status-im/react-native-desktop/releases 10 | 11 | ## Environment 12 | Run `react-native info` in your terminal and paste its contents here. 13 | 14 | ## Description 15 | Describe your issue in detail. Include screenshots if needed. If this is a regression, let us know. 16 | 17 | ## Reproducible Demo 18 | Let us know how to reproduce the issue. Include a code sample, share a project, or share an app that reproduces the issue using https://snack.expo.io/. Please follow the guidelines for providing a MCVE: https://stackoverflow.com/help/mcve 19 | -------------------------------------------------------------------------------- /ReactCommon/yoga/yoga/YGMacros.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #pragma once 9 | 10 | #ifdef __cplusplus 11 | #define YG_EXTERN_C_BEGIN extern "C" { 12 | #define YG_EXTERN_C_END } 13 | #else 14 | #define YG_EXTERN_C_BEGIN 15 | #define YG_EXTERN_C_END 16 | #endif 17 | 18 | #ifdef _WINDLL 19 | #define WIN_EXPORT __declspec(dllexport) 20 | #else 21 | #define WIN_EXPORT 22 | #endif 23 | 24 | #ifdef WINARMDLL 25 | #define WIN_STRUCT(type) type * 26 | #define WIN_STRUCT_REF(value) &value 27 | #else 28 | #define WIN_STRUCT(type) type 29 | #define WIN_STRUCT_REF(value) value 30 | #endif 31 | 32 | #ifdef NS_ENUM 33 | // Cannot use NSInteger as NSInteger has a different size than int (which is the default type of a 34 | // enum). 35 | // Therefor when linking the Yoga C library into obj-c the header is a missmatch for the Yoga ABI. 36 | #define YG_ENUM_BEGIN(name) NS_ENUM(int, name) 37 | #define YG_ENUM_END(name) 38 | #else 39 | #define YG_ENUM_BEGIN(name) enum name 40 | #define YG_ENUM_END(name) name 41 | #endif 42 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/react_resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | qml/DevMenu.qml 4 | qml/ReactImage.qml 5 | qml/ReactView.qml 6 | qml/ReactNavigator.qml 7 | qml/ReactScrollView.qml 8 | qml/ReactScrollListView.qml 9 | qml/ReactRedboxItem.qml 10 | qml/ReactRawText.qml 11 | qml/ReactText.qml 12 | qml/ReactActivityIndicator.qml 13 | images/spinner_medium.png 14 | qml/ReactButton.qml 15 | qml/ReactSlider.qml 16 | qml/ReactTextInput.qml 17 | js/utils.js 18 | qml/ReactModal.qml 19 | qml/ReactPicker.qml 20 | qml/ReactTextInputArea.qml 21 | qml/ReactTextInputField.qml 22 | qml/ReactWebView.qml 23 | qml/ReactQtWebKitWebView.qml 24 | qml/ReactAlert.qml 25 | qml/ReactSwitch.qml 26 | 27 | 28 | -------------------------------------------------------------------------------- /Examples/Fetch/FetchApp.js: -------------------------------------------------------------------------------- 1 | 2 | import React, { Component } from 'react'; 3 | import { 4 | AppRegistry, 5 | View, 6 | Text, 7 | TextInput 8 | } from 'react-native'; 9 | 10 | import { 11 | NativeButton 12 | } from 'react-native-desktop-qt'; 13 | 14 | export default class FetchReactNative extends Component { 15 | state = {response: "...", url: "https://api.github.com/gists"}; 16 | 17 | _fetchData = () => { 18 | fetch(this.state.url) 19 | .then((response) => this.setState({response: JSON.stringify(response)})) 20 | .catch((error) => { 21 | this.setState({response: error}) 22 | }); 23 | 24 | } 25 | render() { 26 | return ( 27 | 28 | this.setState({url: text})}/> 32 | 36 | Response: 37 | 38 | 39 | ); 40 | } 41 | } 42 | 43 | AppRegistry.registerComponent('FetchApp', () => FetchReactNative) 44 | -------------------------------------------------------------------------------- /ReactQt/tests/test-modal-props/TestModalProps.js: -------------------------------------------------------------------------------- 1 | 2 | import React, { Component } from 'react'; 3 | import { 4 | AppRegistry, 5 | StyleSheet, 6 | Text, 7 | View, 8 | Modal, 9 | Button 10 | } from 'react-native'; 11 | 12 | const onButtonPress = () => { 13 | }; 14 | 15 | export default class ModalReactNative extends Component { 16 | 17 | render() { 18 | return ( 19 | {console.log("onShow()")}} 21 | visible = {true}> 22 | 23 | Modal is open! 24 | 47 | ); 48 | } 49 | } 50 | 51 | AppRegistry.registerComponent('ButtonApp', () => ButtonReactNative) 52 | -------------------------------------------------------------------------------- /Libraries/Utilities/Platform.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2016, Canonical Ltd. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule Platform 10 | * @flow 11 | */ 12 | 13 | 'use strict'; 14 | 15 | const NativeModules = require('NativeModules'); 16 | 17 | var Platform = { 18 | OS: 'desktop-qt', 19 | get isMacOs() { 20 | const constants = NativeModules.PlatformConstants; 21 | return constants ? constants.osName === 'macos' : false; 22 | }, 23 | get isWindows() { 24 | const constants = NativeModules.PlatformConstants; 25 | return constants ? constants.osName === 'windows' : false; 26 | }, 27 | get isLinux() { 28 | const constants = NativeModules.PlatformConstants; 29 | return constants ? constants.osName === 'linux' : false; 30 | }, 31 | get isUnix() { 32 | const constants = NativeModules.PlatformConstants; 33 | return constants ? constants.osName === 'unix' : false; 34 | }, 35 | select: (obj: Object) => 'desktop-qt' in obj ? obj.desktop : obj.default, 36 | }; 37 | 38 | module.exports = Platform; 39 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/netinfo.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (C) 2016, Canonical Ltd. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | * Author: Justin McPherson 11 | * 12 | */ 13 | 14 | #ifndef NETINFO_H 15 | #define NETINFO_H 16 | 17 | #include "moduleinterface.h" 18 | 19 | class NetInfoPrivate; 20 | class NetInfo : public QObject, public ModuleInterface { 21 | Q_OBJECT 22 | Q_INTERFACES(ModuleInterface) 23 | 24 | Q_INVOKABLE REACT_PROMISE void getCurrentConnectivity(const ModuleInterface::ListArgumentBlock& resolve, 25 | const ModuleInterface::ListArgumentBlock& reject); 26 | 27 | Q_INVOKABLE void setConnectionCheckUrl(const QString& url); 28 | 29 | Q_DECLARE_PRIVATE(NetInfo) 30 | 31 | public: 32 | NetInfo(QObject* parent = 0); 33 | ~NetInfo(); 34 | 35 | void setBridge(Bridge* bridge) override; 36 | 37 | QString moduleName() override; 38 | 39 | private: 40 | QScopedPointer d_ptr; 41 | }; 42 | 43 | #endif // NETINFO_H 44 | -------------------------------------------------------------------------------- /RNTester/js/RNTesterButton.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | * @format 8 | * @flow 9 | */ 10 | 11 | 'use strict'; 12 | 13 | const React = require('react'); 14 | const {StyleSheet, Text, TouchableHighlight} = require('react-native'); 15 | 16 | import type {PressEvent} from '../../Libraries/Types/CoreEventTypes'; 17 | 18 | type Props = $ReadOnly<{| 19 | children?: React.Node, 20 | onPress?: ?(event: PressEvent) => mixed, 21 | |}>; 22 | 23 | class RNTesterButton extends React.Component { 24 | render() { 25 | return ( 26 | 30 | {this.props.children} 31 | 32 | ); 33 | } 34 | } 35 | 36 | const styles = StyleSheet.create({ 37 | button: { 38 | borderColor: '#696969', 39 | borderRadius: 8, 40 | borderWidth: 1, 41 | padding: 10, 42 | margin: 5, 43 | alignItems: 'center', 44 | justifyContent: 'center', 45 | backgroundColor: '#d3d3d3', 46 | }, 47 | }); 48 | 49 | module.exports = RNTesterButton; 50 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/appstate.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (C) 2016, Canonical Ltd. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | * Author: Justin McPherson 11 | * 12 | */ 13 | 14 | #ifndef APPSTATE_H 15 | #define APPSTATE_H 16 | 17 | #include 18 | #include 19 | 20 | #include "moduleinterface.h" 21 | 22 | class AppState : public QObject, public ModuleInterface { 23 | Q_OBJECT 24 | // Q_PLUGIN_METADATA(IID ReactModuleInterface_IID) 25 | Q_INTERFACES(ModuleInterface) 26 | 27 | Q_INVOKABLE void getCurrentAppState(const ModuleInterface::ListArgumentBlock& success, 28 | const ModuleInterface::MapArgumentBlock& error); 29 | 30 | public: 31 | AppState(QObject* parent = 0); 32 | ~AppState(); 33 | 34 | void setBridge(Bridge* bridge) override; 35 | 36 | // TODO: this doesnt seem right 37 | ViewManager* viewManager() override; 38 | 39 | QString moduleName() override; 40 | 41 | private: 42 | Bridge* m_bridge; 43 | }; 44 | 45 | #endif // APPSTATE_H 46 | -------------------------------------------------------------------------------- /local-cli/generator-desktop/templates/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (C) 2016, Canonical Ltd. 4 | # All rights reserved. 5 | 6 | # This source code is licensed under the BSD-style license found in the 7 | # LICENSE file in the root directory of this source tree. An additional grant 8 | # of patent rights can be found in the PATENTS file in the same directory. 9 | 10 | # XXX: Don't move this script 11 | cd $(dirname $0) 12 | 13 | while (( "$#" )); do 14 | if [[ $1 == "-e" ]]; then 15 | shift 16 | ExternalModulesPaths="$1" 17 | fi 18 | if [[ $1 == "-j" ]]; then 19 | shift 20 | JsBundlePath="$1" 21 | fi 22 | if [[ $1 == "-f" ]]; then 23 | shift 24 | desktopFonts="$1" 25 | fi 26 | if [[ $1 == "-i" ]]; then 27 | shift 28 | desktopImages="$1" 29 | fi 30 | shift 31 | done 32 | 33 | echo "build.sh external modules paths: "$ExternalModulesPaths 34 | echo "build.sh JS bundle path: "$JsBundlePath 35 | echo "build.sh desktop fonts: "$desktopFonts 36 | echo "build.sh desktop images: "$desktopImages 37 | 38 | # Workaround 39 | rm -rf CMakeFiles CMakeCache.txt cmake_install.cmake Makefile 40 | 41 | # Build project 42 | cmake -DCMAKE_BUILD_TYPE=Debug -DEXTERNAL_MODULES_DIR="$ExternalModulesPaths" -DJS_BUNDLE_PATH="$JsBundlePath" -DDESKTOP_FONTS="$desktopFonts" -DDESKTOP_IMAGES="$desktopImages" . && make 43 | -------------------------------------------------------------------------------- /local-cli/generator-desktop/templates/build.bat: -------------------------------------------------------------------------------- 1 | @rem Copyright (c) 2017-present, Status Research and Development GmbH. 2 | @rem All rights reserved. 3 | @rem 4 | @rem This source code is licensed under the BSD-style license found in the 5 | @rem LICENSE file in the root directory of this source tree. An additional grant 6 | @rem of patent rights can be found in the PATENTS file in the same directory. 7 | 8 | @echo off 9 | setlocal EnableDelayedExpansion 10 | 11 | set "option=" 12 | for %%a in (%*) do ( 13 | if not defined option ( 14 | set arg=%%a 15 | if "!arg:~0,1!" equ "-" set "option=!arg!" 16 | ) else ( 17 | set "option!option!=%%a" 18 | set "option=" 19 | ) 20 | ) 21 | 22 | SET option 23 | @echo on 24 | 25 | echo "build.bat external modules paths: "%option-e% 26 | echo "build.bat JS bundle path: "%option-j% 27 | echo "build.bat desktop fonts: "%option-f% 28 | echo "build.bat desktop images: "%option-i% 29 | echo "build.bat cmake generator: "%option-g% 30 | 31 | @rem Workaround 32 | @rem rm -rf CMakeFiles CMakeCache.txt cmake_install.cmake Makefile 33 | 34 | @rem Build project 35 | echo %CD% 36 | cmake -DCMAKE_BUILD_TYPE=Debug -G %option-g% -DEXTERNAL_MODULES_DIR=%option-e% -DJS_BUNDLE_PATH=%option-j% -DDESKTOP_FONTS=%option-f% -DDESKTOP_IMAGES=%option-i% . && cmake --build . 37 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/qml/ReactModal.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.9 2 | import QtQuick.Controls 2.2 3 | import QtGraphicalEffects 1.0 4 | import React 0.1 as React 5 | 6 | Item { 7 | 8 | id: modalRoot 9 | objectName: "modalRoot" 10 | 11 | property string p_animationType 12 | property bool p_onShow: false 13 | property bool p_transparent: false 14 | property var contentItem: popup.contentItem 15 | property var modalManager: null 16 | 17 | property var flexbox: React.Flexbox { 18 | control: popup.contentItem 19 | p_minWidth: popup.width 20 | p_minHeight: popup.height 21 | } 22 | 23 | Popup { 24 | id: popup 25 | width: ApplicationWindow.overlay ? ApplicationWindow.overlay.width : 0 26 | height: ApplicationWindow.overlay ? ApplicationWindow.overlay.height : 0 27 | visible: true 28 | modal: true 29 | margins: 0 30 | 31 | background: Item {} 32 | 33 | contentItem: React.MouseEventsInterceptor { 34 | Rectangle { 35 | objectName: "ReactModal.contentItem" 36 | color: modalRoot.p_transparent ? "transparent" : "white" 37 | } 38 | } 39 | 40 | closePolicy: Popup.NoAutoClose 41 | onOpened: modalManager.sendOnShowNotificationToJs(modalRoot) 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/componentmanagers/rawtextmanager.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (C) 2016, Canonical Ltd. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | * Author: Justin McPherson 11 | * 12 | */ 13 | 14 | #ifndef RAWTEXTMANAGER_H 15 | #define RAWTEXTMANAGER_H 16 | 17 | #include 18 | 19 | #include "viewmanager.h" 20 | 21 | class QQuickItem; 22 | class PropertyHandler; 23 | // #define QT_STATICPLUGIN 24 | 25 | class RawTextManager : public ViewManager { 26 | Q_OBJECT 27 | // Q_PLUGIN_METADATA(IID ReactModuleInterface_IID) 28 | Q_INTERFACES(ModuleInterface) 29 | 30 | public: 31 | RawTextManager(QObject* parent = 0); 32 | ~RawTextManager(); 33 | 34 | // TODO: this doesnt seem right 35 | ViewManager* viewManager() override; 36 | 37 | QString moduleName() override; 38 | 39 | bool shouldLayout() const override; 40 | 41 | protected: 42 | virtual void configureView(QQuickItem* view) const override; 43 | virtual QString qmlComponentFile(const QVariantMap& properties) const override; 44 | }; 45 | 46 | #endif // RAWTEXTMANAGER_H 47 | -------------------------------------------------------------------------------- /ReactQt/tests/test-array-reconciliation/TestArrayReconciliationDeleteLast.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | Alert, 5 | Text, 6 | TouchableHighlight, 7 | View, 8 | TextInput, 9 | Button 10 | } from 'react-native'; 11 | 12 | 13 | 14 | class ItemList extends Component { 15 | constructor(props) { 16 | super(props); 17 | this.state = {longList: true}; 18 | this.onPress = this.onPress.bind(this); 19 | } 20 | 21 | onPress() { 22 | this.setState({longList: !this.state.longList}); 23 | } 24 | 25 | onButtonPress() { 26 | this.setState({longList: !this.state.longList}); 27 | } 28 | 29 | render() { 30 | let items = this.state.longList ? ["FirstButton", "SecondButton", "ThirdButton"] : ["1stButton", "2ndButton"]; 31 | return ( 32 | 33 | ; 36 | })} 37 | 38 | ) 39 | } 40 | } 41 | 42 | class TestArrayReconciliationDeleteLast extends Component { 43 | render() { 44 | return ( 45 | 46 | ); 47 | } 48 | } 49 | 50 | AppRegistry.registerComponent('TestArrayReconciliationDeleteLast', () => TestArrayReconciliationDeleteLast); 51 | -------------------------------------------------------------------------------- /ReactQt/tests/test-array-reconciliation/TestArrayReconciliationInsertFirst.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | Alert, 5 | Text, 6 | TouchableHighlight, 7 | View, 8 | TextInput, 9 | Button 10 | } from 'react-native'; 11 | 12 | 13 | 14 | class ItemList extends Component { 15 | constructor(props) { 16 | super(props); 17 | this.state = {longList: true}; 18 | this.onPress = this.onPress.bind(this); 19 | } 20 | 21 | onPress() { 22 | this.setState({longList: !this.state.longList}); 23 | } 24 | 25 | onButtonPress() { 26 | this.setState({longList: !this.state.longList}); 27 | } 28 | 29 | render() { 30 | let items = this.state.longList ? ["FirstButton", "SecondButton", "ThirdButton"] : ["SecondButton", "ThirdButton"]; 31 | return ( 32 | 33 | ; 36 | })} 37 |
38 | ) 39 | } 40 | } 41 | 42 | class TestArrayReconciliationInsertFirst extends Component { 43 | render() { 44 | return ( 45 | 46 | ); 47 | } 48 | } 49 | 50 | AppRegistry.registerComponent('TestArrayReconciliationInsertFirst', () => TestArrayReconciliationInsertFirst); 51 | -------------------------------------------------------------------------------- /RNTester/js/websocket_test_server.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | /** 3 | * Copyright (c) Facebook, Inc. and its affiliates. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | * 8 | * @flow 9 | * @format 10 | */ 11 | 'use strict'; 12 | 13 | /* eslint-env node */ 14 | 15 | const WebSocket = require('ws'); 16 | 17 | const fs = require('fs'); 18 | const path = require('path'); 19 | 20 | console.log(`\ 21 | Test server for WebSocketExample 22 | 23 | This will send each incoming message right back to the other side. 24 | Restart with the '--binary' command line flag to have it respond with an 25 | ArrayBuffer instead of a string. 26 | `); 27 | 28 | const respondWithBinary = process.argv.indexOf('--binary') !== -1; 29 | const server = new WebSocket.Server({port: 5555}); 30 | server.on('connection', ws => { 31 | ws.on('message', message => { 32 | console.log('Received message:', message); 33 | if (respondWithBinary) { 34 | message = Buffer.from(message); 35 | } 36 | if (message === 'getImage') { 37 | message = fs.readFileSync(path.resolve(__dirname, 'flux@3x.png')); 38 | } 39 | console.log('Replying with:', message); 40 | ws.send(message); 41 | }); 42 | 43 | console.log('Incoming connection!'); 44 | ws.send('Why hello there!'); 45 | }); 46 | -------------------------------------------------------------------------------- /ReactCommon/yoga/yoga/YGLayout.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the LICENSE 5 | * file in the root directory of this source tree. 6 | * 7 | */ 8 | #pragma once 9 | #include "YGFloatOptional.h" 10 | #include "Yoga-internal.h" 11 | 12 | struct YGLayout { 13 | std::array position; 14 | std::array dimensions; 15 | std::array margin; 16 | std::array border; 17 | std::array padding; 18 | YGDirection direction; 19 | 20 | uint32_t computedFlexBasisGeneration; 21 | YGFloatOptional computedFlexBasis; 22 | bool hadOverflow; 23 | 24 | // Instead of recomputing the entire layout every single time, we 25 | // cache some information to break early when nothing changed 26 | uint32_t generationCount; 27 | YGDirection lastOwnerDirection; 28 | 29 | uint32_t nextCachedMeasurementsIndex; 30 | std::array 31 | cachedMeasurements; 32 | std::array measuredDimensions; 33 | 34 | YGCachedMeasurement cachedLayout; 35 | bool didUseLegacyFlag; 36 | bool doesLegacyStretchFlagAffectsLayout; 37 | 38 | YGLayout(); 39 | 40 | bool operator==(YGLayout layout) const; 41 | bool operator!=(YGLayout layout) const { 42 | return !(*this == layout); 43 | } 44 | }; 45 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/componentmanagers/rawtextmanager.cpp: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (C) 2016, Canonical Ltd. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | * Author: Justin McPherson 11 | * 12 | */ 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include "bridge.h" 20 | #include "propertyhandler.h" 21 | #include "rawtextmanager.h" 22 | 23 | RawTextManager::RawTextManager(QObject* parent) : ViewManager(parent) {} 24 | 25 | RawTextManager::~RawTextManager() {} 26 | 27 | // TODO: this doesnt seem right 28 | ViewManager* RawTextManager::viewManager() { 29 | return this; 30 | } 31 | 32 | QString RawTextManager::moduleName() { 33 | return "RCTRawTextManager"; 34 | } 35 | 36 | bool RawTextManager::shouldLayout() const { 37 | return false; 38 | } 39 | 40 | void RawTextManager::configureView(QQuickItem* view) const { 41 | ViewManager::configureView(view); 42 | view->setEnabled(false); 43 | } 44 | 45 | QString RawTextManager::qmlComponentFile(const QVariantMap& properties) const { 46 | return "qrc:/qml/ReactRawText.qml"; 47 | } 48 | -------------------------------------------------------------------------------- /Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.desktop-qt.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (c) 2015-present, Facebook, Inc. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | * @providesModule SegmentedControlIOS 11 | */ 12 | 13 | 'use strict'; 14 | 15 | var React = require('React'); 16 | var StyleSheet = require('StyleSheet'); 17 | var Text = require('Text'); 18 | var View = require('View'); 19 | 20 | var DummySegmentedControlIOS = React.createClass({ 21 | render: function() { 22 | return ( 23 | 24 | 25 | SegmentedControlIOS is not supported on this platform! 26 | 27 | 28 | ); 29 | }, 30 | }); 31 | 32 | var styles = StyleSheet.create({ 33 | dummy: { 34 | width: 120, 35 | height: 50, 36 | backgroundColor: '#ffbcbc', 37 | borderWidth: 1, 38 | borderColor: 'red', 39 | alignItems: 'center', 40 | justifyContent: 'center', 41 | }, 42 | text: { 43 | color: '#333333', 44 | margin: 5, 45 | fontSize: 10, 46 | } 47 | }); 48 | 49 | module.exports = DummySegmentedControlIOS; 50 | -------------------------------------------------------------------------------- /ReactQt/tests/test-modal-props/test-modal-props.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-present, Status Research and Development GmbH. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #include "reactpropertytestcase.h" 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | class TestModalProps : public ReactPropertyTestCase { 18 | Q_OBJECT 19 | 20 | private slots: 21 | 22 | virtual void initTestCase() override; 23 | 24 | protected: 25 | virtual QQuickItem* control() const override; 26 | virtual QVariantMap propValues() const override; 27 | }; 28 | 29 | QQuickItem* TestModalProps::control() const { 30 | return topJSComponent(); 31 | } 32 | 33 | void TestModalProps::initTestCase() { 34 | ReactPropertyTestCase::initTestCase(); 35 | loadQML(QUrl("qrc:/TestModalProps.qml")); 36 | waitAndVerifyJsAppStarted(); 37 | ReactPropertyTestCase::init(); 38 | } 39 | 40 | QVariantMap TestModalProps::propValues() const { 41 | return {{"p_animationType", "slide"}, {"p_onShow", true}, {"p_transparent", false}}; 42 | } 43 | 44 | QTEST_MAIN(TestModalProps) 45 | #include "test-modal-props.moc" 46 | -------------------------------------------------------------------------------- /docs/InspectAppWithGammaRay.md: -------------------------------------------------------------------------------- 1 | :warning::warning::warning: 2 | #### React Native Desktop project support stopped.. 3 | 4 | --- 5 | There is a tool for inspecting Qt apps - [GammaRay from KDAB](https://github.com/KDAB/GammaRay) 6 | It can be very convenient to investigate `QQuickItem`s hierarchy in the app. 7 | 8 | ## Building 9 | 10 | Steps to build it (inside cloned src folder): 11 | ``` 12 | mkdir build 13 | cd build 14 | cmake -DCMAKE_PREFIX_PATH=PATH_TO_YOUR_QT_FOLDER/5.12.2/gcc_64/lib/cmake .. 15 | make 16 | make install 17 | ``` 18 | 19 | After build `gammaray` binary can be found in `GAMMARAY_PATH/build/bin` 20 | 21 | 22 | ## Usage 23 | 1. Start `gammaray` 24 | 2. Open `Attach` tab in `gammaray` UI 25 | 3. Set `Access mode` combo box to `Out-of-process, local debugging only` 26 | 4. Start your `react-native-desktop` application 27 | 5. Wait until it is listed in processes on gammaray `Attach` screen 28 | 6. Press `Attach` button 29 | 7. Wait until `gammaray` attached 30 | 8. Select `Quick scenes`tab and inspect QQuickItems hierarchy in your app 31 | 32 | ## Troubleshooting 33 | ### For Ubuntu 34 | If you get a error on attaching `gammaray` to app, here is what can be done: 35 | 36 | 1) edit `/etc/sysctl.d/10-ptrace.conf` and change the line: 37 | `kernel.yama.ptrace_scope = 1` 38 | To 39 | `kernel.yama.ptrace_scope = 0` 40 | 41 | 2) To apply changes call `sudo service procps restart` 42 | -------------------------------------------------------------------------------- /ReactCommon/yoga/yoga/YGStyle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the LICENSE 5 | * file in the root directory of this source tree. 6 | * 7 | */ 8 | #pragma once 9 | #include "YGFloatOptional.h" 10 | #include "Yoga-internal.h" 11 | #include "Yoga.h" 12 | 13 | struct YGStyle { 14 | YGDirection direction; 15 | YGFlexDirection flexDirection; 16 | YGJustify justifyContent; 17 | YGAlign alignContent; 18 | YGAlign alignItems; 19 | YGAlign alignSelf; 20 | YGPositionType positionType; 21 | YGWrap flexWrap; 22 | YGOverflow overflow; 23 | YGDisplay display; 24 | YGFloatOptional flex; 25 | YGFloatOptional flexGrow; 26 | YGFloatOptional flexShrink; 27 | YGValue flexBasis; 28 | std::array margin; 29 | std::array position; 30 | std::array padding; 31 | std::array border; 32 | std::array dimensions; 33 | std::array minDimensions; 34 | std::array maxDimensions; 35 | // Yoga specific properties, not compatible with flexbox specification 36 | YGFloatOptional aspectRatio; 37 | 38 | YGStyle(); 39 | bool operator==(const YGStyle& style); 40 | 41 | bool operator!=(YGStyle style) { 42 | return !(*this == style); 43 | } 44 | ~YGStyle() = default; 45 | }; 46 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/componentmanagers/buttonmanager.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (c) 2017-present, Status Research and Development GmbH. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | */ 11 | 12 | #ifndef BUTTONMANAGER_H 13 | #define BUTTONMANAGER_H 14 | 15 | #include "viewmanager.h" 16 | 17 | class ButtonManagerPrivate; 18 | class ButtonManager : public ViewManager { 19 | Q_OBJECT 20 | Q_INTERFACES(ModuleInterface) 21 | Q_DECLARE_PRIVATE(ButtonManager) 22 | 23 | public: 24 | ButtonManager(QObject* parent = 0); 25 | virtual ~ButtonManager(); 26 | 27 | virtual ViewManager* viewManager() override; 28 | virtual QString moduleName() override; 29 | virtual QStringList customDirectEventTypes() override; 30 | virtual QStringList customBubblingEventTypes() override; 31 | 32 | public slots: 33 | void sendPressedNotificationToJs(QQuickItem* button); 34 | 35 | private: 36 | virtual QString qmlComponentFile(const QVariantMap& properties) const override; 37 | virtual void configureView(QQuickItem* button) const override; 38 | 39 | private: 40 | QScopedPointer d_ptr; 41 | }; 42 | 43 | #endif // BUTTONMANAGER_H 44 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/qml/ReactNavigator.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.4 2 | import QtQuick.Controls 2.2 3 | 4 | 5 | Item { 6 | id: navigatorRoot 7 | 8 | property bool p_onBackButtonPress: false 9 | property int numberPages: 0 10 | 11 | signal backTriggered(); 12 | 13 | Component { 14 | id: pageBackAction 15 | // TODO: Action object will appear in Qt Quick Controls 2.3 16 | // starting from Qt 5.10 release https://doc-snapshots.qt.io/qt5-dev/qml-qtquick-controls2-action.html 17 | /*Action { 18 | iconName: navigatorRoot.numberPages > 1 ? "back" : "" 19 | }*/ 20 | Button { 21 | text: navigatorRoot.numberPages > 1 ? "back" : "" 22 | } 23 | } 24 | 25 | StackView { 26 | id: pageStack 27 | anchors.fill: parent 28 | } 29 | 30 | function push(item) { 31 | item.head.backAction = pageBackAction.createObject(item); 32 | // TODO: Revert back along with Action support 33 | //item.head.backAction.onTriggered.connect(backTriggered); 34 | item.head.backAction.onClicked.connect(backTriggered); 35 | pageStack.push(item); 36 | navigatorRoot.numberPages += 1; 37 | } 38 | 39 | function pop() { 40 | pageStack.pop(); 41 | navigatorRoot.numberPages -= 1; 42 | } 43 | 44 | function clear() { 45 | pageStack.clear(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ReactQt/tests/test-array-reconciliation/TestArrayReconciliationItemMove.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { 3 | AppRegistry, 4 | Alert, 5 | Text, 6 | TouchableHighlight, 7 | View, 8 | TextInput, 9 | Button 10 | } from 'react-native'; 11 | 12 | 13 | 14 | class ItemList extends Component { 15 | constructor(props) { 16 | super(props); 17 | this.state = {longList: true, 18 | itemsList: ["FirstButton", "SecondButton", "ThirdButton", "FourthButton"] }; 19 | this.onPress = this.onPress.bind(this); 20 | } 21 | 22 | onPress() { 23 | let removedItems = this.state.itemsList.splice(0, 1); 24 | this.state.itemsList.push(removedItems[0]); 25 | this.setState({longList: !this.state.longList, 26 | itemsList: this.state.itemsList}); 27 | } 28 | 29 | render() { 30 | return ( 31 | 32 | ; 35 | })} 36 | 37 | ) 38 | } 39 | } 40 | 41 | class TestArrayReconciliationItemMove extends Component { 42 | render() { 43 | return ( 44 | 45 | ); 46 | } 47 | } 48 | 49 | AppRegistry.registerComponent('TestArrayReconciliationItemMove', () => TestArrayReconciliationItemMove); 50 | -------------------------------------------------------------------------------- /Libraries/Components/ProgressViewIOS/ProgressViewIOS.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | * @providesModule ProgressViewIOS 10 | */ 11 | 12 | 'use strict'; 13 | 14 | var React = require('React'); 15 | var StyleSheet = require('StyleSheet'); 16 | var Text = require('Text'); 17 | var View = require('View'); 18 | var createReactClass = require('create-react-class'); 19 | 20 | var DummyProgressViewIOS = createReactClass({ 21 | render: function() { 22 | return ( 23 | 24 | 25 | ProgressViewIOS is not supported on this platform! 26 | 27 | 28 | ); 29 | }, 30 | }); 31 | 32 | var styles = StyleSheet.create({ 33 | dummy: { 34 | width: 120, 35 | height: 20, 36 | backgroundColor: '#ffbcbc', 37 | borderWidth: 1, 38 | borderColor: 'red', 39 | alignItems: 'center', 40 | justifyContent: 'center', 41 | }, 42 | text: { 43 | color: '#333333', 44 | margin: 5, 45 | fontSize: 10, 46 | } 47 | }); 48 | 49 | module.exports = DummyProgressViewIOS; 50 | -------------------------------------------------------------------------------- /RNTester/js/TransparentHitTestExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | * @format 8 | * @flow 9 | */ 10 | 11 | 'use strict'; 12 | 13 | const React = require('react'); 14 | const {Text, View, TouchableOpacity, Alert} = require('react-native'); 15 | 16 | class TransparentHitTestExample extends React.Component<{}> { 17 | render() { 18 | return ( 19 | 20 | Alert.alert('Alert', 'Hi!')}> 21 | HELLO! 22 | 23 | 24 | 35 | 36 | ); 37 | } 38 | } 39 | 40 | exports.title = ''; 41 | exports.displayName = 'TransparentHitTestExample'; 42 | exports.description = 'Transparent view receiving touch events'; 43 | exports.examples = [ 44 | { 45 | title: 'TransparentHitTestExample', 46 | render(): React.Element { 47 | return ; 48 | }, 49 | }, 50 | ]; 51 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/componentmanagers/imagemanager.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (C) 2016, Canonical Ltd. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | * Author: Justin McPherson 11 | * 12 | */ 13 | 14 | #ifndef IMAGEMANAGER_H 15 | #define IMAGEMANAGER_H 16 | 17 | #include "viewmanager.h" 18 | 19 | class PropertyHandler; 20 | class ImageManagerPrivate; 21 | class ImageManager : public ViewManager { 22 | Q_OBJECT 23 | Q_INTERFACES(ModuleInterface) 24 | Q_DECLARE_PRIVATE(ImageManager) 25 | 26 | public: 27 | ImageManager(QObject* parent = 0); 28 | virtual ~ImageManager(); 29 | 30 | virtual ViewManager* viewManager() override; 31 | virtual QString moduleName() override; 32 | 33 | virtual QStringList customDirectEventTypes() override; 34 | 35 | public slots: 36 | void manageSource(const QVariantList& sourceProp, QQuickItem* image); 37 | 38 | private: 39 | virtual void configureView(QQuickItem* view) const override; 40 | virtual QString qmlComponentFile(const QVariantMap& properties) const override; 41 | 42 | private: 43 | QScopedPointer d_ptr; 44 | }; 45 | 46 | #endif // IMAGEMANAGER_H 47 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/componentmanagers/pickermanager.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (c) 2017-present, Status Research and Development GmbH. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | */ 11 | 12 | #ifndef PICKERMANAGER_H 13 | #define PICKERMANAGER_H 14 | 15 | #include "viewmanager.h" 16 | 17 | class PropertyHandler; 18 | class PickerManagerPrivate; 19 | class PickerManager : public ViewManager { 20 | Q_OBJECT 21 | Q_INTERFACES(ModuleInterface) 22 | Q_DECLARE_PRIVATE(PickerManager) 23 | 24 | public: 25 | PickerManager(QObject* parent = 0); 26 | virtual ~PickerManager(); 27 | 28 | virtual ViewManager* viewManager() override; 29 | virtual QString moduleName() override; 30 | 31 | virtual QStringList customDirectEventTypes() override; 32 | virtual bool shouldLayout() const override; 33 | 34 | public slots: 35 | void sendValueChangeToJs(QQuickItem* picker, int index); 36 | 37 | private: 38 | virtual QString qmlComponentFile(const QVariantMap& properties) const override; 39 | virtual void configureView(QQuickItem* view) const override; 40 | 41 | private: 42 | QScopedPointer d_ptr; 43 | }; 44 | 45 | #endif // PICKERMANAGER_H 46 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/mouseeventsinterceptor.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (c) 2017-present, Status Research and Development GmbH. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | */ 11 | 12 | #ifndef MOUSEEVENTSINTERCEPTOR_H 13 | #define MOUSEEVENTSINTERCEPTOR_H 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include "reactitem.h" 20 | 21 | class Bridge; 22 | 23 | class MouseEventsInterceptorPrivate; 24 | class MouseEventsInterceptor : public QQuickItem { 25 | Q_OBJECT 26 | 27 | Q_DECLARE_PRIVATE(MouseEventsInterceptor) 28 | 29 | public: 30 | MouseEventsInterceptor(QQuickItem* parent = 0); 31 | ~MouseEventsInterceptor(); 32 | 33 | void setBridge(Bridge* bridge); 34 | 35 | private: 36 | void mousePressEvent(QMouseEvent* event) override; 37 | void mouseMoveEvent(QMouseEvent* event) override; 38 | void mouseReleaseEvent(QMouseEvent* event) override; 39 | bool childMouseEventFilter(QQuickItem* item, QEvent* event) override; 40 | void sendMouseEvent(QMouseEvent* event, const QString& eventType, QQuickItem* receiver); 41 | 42 | QScopedPointer d_ptr; 43 | }; 44 | 45 | #endif // MOUSEEVENTSINTERCEPTOR_H 46 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/componentmanagers/activityindicatormanager.cpp: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (c) 2017-present, Status Research and Development GmbH. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | */ 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | #include "attachedproperties.h" 21 | #include "bridge.h" 22 | #include "componentmanagers/activityindicatormanager.h" 23 | #include "propertyhandler.h" 24 | #include "utilities.h" 25 | 26 | class ActivityIndicatorManagerPrivate {}; 27 | 28 | ActivityIndicatorManager::ActivityIndicatorManager(QObject* parent) 29 | : ViewManager(parent), d_ptr(new ActivityIndicatorManagerPrivate) {} 30 | 31 | ActivityIndicatorManager::~ActivityIndicatorManager() {} 32 | 33 | ViewManager* ActivityIndicatorManager::viewManager() { 34 | return this; 35 | } 36 | 37 | QString ActivityIndicatorManager::moduleName() { 38 | return "RCTActivityIndicatorViewManager"; 39 | } 40 | 41 | QString ActivityIndicatorManager::qmlComponentFile(const QVariantMap& properties) const { 42 | return "qrc:/qml/ReactActivityIndicator.qml"; 43 | } 44 | 45 | #include "activityindicatormanager.moc" 46 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/timing.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (C) 2016, Canonical Ltd. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | * Author: Justin McPherson 11 | * 12 | */ 13 | 14 | #ifndef TIMING_H 15 | #define TIMING_H 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "moduleinterface.h" 24 | 25 | class Bridge; 26 | 27 | class Timing : public QObject, public ModuleInterface { 28 | Q_OBJECT 29 | // Q_PLUGIN_METADATA(IID ReactModuleInterface_IID) 30 | Q_INTERFACES(ModuleInterface) 31 | 32 | Q_INVOKABLE void createTimer(int callbackId, int duration, const QDateTime& jsSchedulingTime, bool repeats); 33 | Q_INVOKABLE void deleteTimer(int timerId); 34 | 35 | public: 36 | Timing(QObject* parent = 0); 37 | ~Timing(); 38 | 39 | void setBridge(Bridge* bridge) override; 40 | 41 | // TODO: this doesnt seem right 42 | ViewManager* viewManager() override; 43 | 44 | QString moduleName() override; 45 | 46 | private: 47 | void callTimer(const int timerId); 48 | 49 | private: 50 | QPointer m_bridge; 51 | QMap m_activeTimers; 52 | }; 53 | 54 | #endif // TIMING_H 55 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/componentmanagers/slidermanager.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (c) 2017-present, Status Research and Development GmbH. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | */ 11 | 12 | #ifndef SLIDERMANAGER_H 13 | #define SLIDERMANAGER_H 14 | 15 | #include "viewmanager.h" 16 | 17 | class SliderManagerPrivate; 18 | class SliderManager : public ViewManager { 19 | Q_OBJECT 20 | Q_INTERFACES(ModuleInterface) 21 | Q_DECLARE_PRIVATE(SliderManager) 22 | 23 | public: 24 | SliderManager(QObject* parent = 0); 25 | virtual ~SliderManager(); 26 | 27 | virtual ViewManager* viewManager() override; 28 | virtual QString moduleName() override; 29 | virtual QStringList customDirectEventTypes() override; 30 | 31 | public slots: 32 | void sendSliderValueChangedToJs(QQuickItem* slider); 33 | void sendSlidingCompleteToJs(QQuickItem* slider); 34 | 35 | private: 36 | virtual QString qmlComponentFile(const QVariantMap& properties) const override; 37 | virtual void configureView(QQuickItem* view) const override; 38 | 39 | void notifyJsAboutSliderEvent(QQuickItem* slider, const QString& eventName) const; 40 | 41 | private: 42 | QScopedPointer d_ptr; 43 | }; 44 | 45 | #endif // SLIDERMANAGER_H 46 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/componentmanagers/switchmanager.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (c) 2017-present, Status Research and Development GmbH. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | */ 11 | 12 | #ifndef SWITCHMANAGER_H 13 | #define SWITCHMANAGER_H 14 | 15 | #include "viewmanager.h" 16 | 17 | class PropertyHandler; 18 | class SwitchManagerPrivate; 19 | class SwitchManager : public ViewManager { 20 | Q_OBJECT 21 | Q_INTERFACES(ModuleInterface) 22 | Q_DECLARE_PRIVATE(SwitchManager) 23 | 24 | public: 25 | SwitchManager(QObject* parent = 0); 26 | virtual ~SwitchManager(); 27 | 28 | virtual ViewManager* viewManager() override; 29 | virtual QString moduleName() override; 30 | 31 | virtual QStringList customDirectEventTypes() override; 32 | virtual bool shouldLayout() const override; 33 | 34 | public slots: 35 | void sendValueChangeToJs(QQuickItem* picker, bool value); 36 | 37 | private: 38 | virtual QString qmlComponentFile(const QVariantMap& properties) const override; 39 | virtual void configureView(QQuickItem* view) const override; 40 | void updateMeasureFunction(QQuickItem* view) const; 41 | 42 | private: 43 | QScopedPointer d_ptr; 44 | }; 45 | 46 | #endif // SWITCHMANAGER_H 47 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/componentmanagers/modalmanager.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (C) 2016, Canonical Ltd. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | * Author: Justin McPherson 11 | * 12 | */ 13 | 14 | #ifndef MODALMANAGER_H 15 | #define MODALMANAGER_H 16 | 17 | #include "viewmanager.h" 18 | 19 | class PropertyHandler; 20 | class ModalManagerPrivate; 21 | class ModalManager : public ViewManager { 22 | Q_OBJECT 23 | Q_INTERFACES(ModuleInterface) 24 | Q_DECLARE_PRIVATE(ModalManager) 25 | 26 | public: 27 | ModalManager(QObject* parent = 0); 28 | virtual ~ModalManager(); 29 | 30 | virtual ViewManager* viewManager() override; 31 | virtual QString moduleName() override; 32 | void addChildItem(QQuickItem* modalView, QQuickItem* child, int position) const override; 33 | virtual QStringList customDirectEventTypes() override; 34 | 35 | public slots: 36 | void sendOnShowNotificationToJs(QQuickItem* modal); 37 | 38 | private: 39 | virtual QString qmlComponentFile(const QVariantMap& properties) const override; 40 | virtual void configureView(QQuickItem* modal) const override; 41 | 42 | private: 43 | QScopedPointer d_ptr; 44 | }; 45 | 46 | #endif // MODALMANAGER_H 47 | -------------------------------------------------------------------------------- /Libraries/Components/NativeButton.desktop-qt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | * 8 | * @format 9 | * @flow 10 | */ 11 | 'use strict'; 12 | 13 | const ColorPropType = require('DeprecatedColorPropType'); 14 | const NativeMethodsMixin = require('NativeMethodsMixin'); 15 | const Platform = require('Platform'); 16 | const React = require('React'); 17 | const PropTypes = require('prop-types'); 18 | const View = require('View'); 19 | const ViewPropTypes = require('ViewPropTypes'); 20 | 21 | const createReactClass = require('create-react-class'); 22 | const requireNativeComponent = require('requireNativeComponent'); 23 | 24 | /** 25 | * Displays a native button 26 | */ 27 | const NativeButton = createReactClass({ 28 | displayName: 'Button', 29 | mixins: [NativeMethodsMixin], 30 | 31 | propTypes: { 32 | title: PropTypes.string.isRequired, 33 | accessibilityLabel: PropTypes.string, 34 | color: ColorPropType, 35 | disabled: PropTypes.bool, 36 | onPress: PropTypes.func.isRequired, 37 | testID: PropTypes.string, 38 | }, 39 | 40 | 41 | render() { 42 | return ( 43 | 46 | ); 47 | } 48 | }); 49 | 50 | var RCTButton = requireNativeComponent('RCTButtonView', NativeButton); 51 | 52 | module.exports = NativeButton; 53 | -------------------------------------------------------------------------------- /docs/CreateNewApp.md: -------------------------------------------------------------------------------- 1 | :warning::warning::warning: 2 | #### React Native Desktop project support stopped.. 3 | 4 | --- 5 | ## Overview 6 | 7 | #### Create react native project 8 | ```sh 9 | npx react-native init DesktopSampleApp --version 0.60.6 10 | ``` 11 | 12 | #### Add desktop support by invoking `react-native-desktop-qt-init` package 13 | ```sh 14 | cd DesktopSampleApp 15 | npx https://github.com/status-im/react-native-desktop-qt-init.git 16 | ``` 17 | This command will add `react-native-desktop-qt` package to your project and generate `desktop` folder with desktop project files. 18 | Unless you have local chagnes, answer 'y' when shell prompts you to replace `babel.config.js` 19 | 20 | 21 | #### Run the project 22 | If you're using macOS, run these commands in 2 different shells (from `DesktopSampleApp` dir): 23 | ```sh 24 | npm start #starts bundler 25 | ``` 26 | ```sh 27 | node node_modules/react-native-desktop-qt/js-executor.js #starts js server 28 | ``` 29 | 30 | Afterwards, in a 3rd shell execute: 31 | ```sh 32 | npx react-native run-desktop 33 | ``` 34 | Compilation of desktop project will start. Then it will run: 35 | 36 | ![](./media/react-native-desktop-new-app.png) 37 | 38 | **Note:** On non-macOS systems, `npm start` and `node js-executor.js` will be executed automatically by the above command(`react-native run-desktop`) 39 | 40 | 41 | **If you want to know why you had to start bundler and js server** - check the doc on [how react-native-desktop works internally](./HowRNDesktopAppWorks.md) 42 | -------------------------------------------------------------------------------- /ReactCommon/yoga/yoga/YGFloatOptional.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the LICENSE 5 | * file in the root directory of this source tree. 6 | * 7 | */ 8 | #pragma once 9 | 10 | struct YGFloatOptional { 11 | private: 12 | float value_; 13 | bool isUndefined_; 14 | 15 | public: 16 | explicit YGFloatOptional(float value); 17 | explicit YGFloatOptional() : value_(0), isUndefined_(true) {} 18 | 19 | // Program will terminate if the value of an undefined is accessed. Please 20 | // make sure to check if the optional is defined before calling this function. 21 | // To check if float optional is defined, use `isUndefined()`. 22 | float getValue() const; 23 | 24 | // Sets the value of float optional, and thus isUndefined is assigned false. 25 | void setValue(float val) { 26 | value_ = val; 27 | isUndefined_ = false; 28 | } 29 | 30 | bool isUndefined() const { 31 | return isUndefined_; 32 | } 33 | 34 | YGFloatOptional operator+(const YGFloatOptional& op); 35 | bool operator>(const YGFloatOptional& op) const; 36 | bool operator<(const YGFloatOptional& op) const; 37 | bool operator>=(const YGFloatOptional& op) const; 38 | bool operator<=(const YGFloatOptional& op) const; 39 | bool operator==(const YGFloatOptional& op) const; 40 | bool operator!=(const YGFloatOptional& op) const; 41 | 42 | bool operator==(float val) const; 43 | bool operator!=(float val) const; 44 | }; 45 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/clipboard.cpp: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (c) 2017-present, Status Research and Development GmbH. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | */ 11 | 12 | #include 13 | 14 | #include "bridge.h" 15 | #include "clipboard.h" 16 | #include "eventdispatcher.h" 17 | #include 18 | #include 19 | 20 | class ClipboardPrivate { 21 | public: 22 | Bridge* bridge = nullptr; 23 | }; 24 | 25 | void Clipboard::getString(const ModuleInterface::ListArgumentBlock& resolve, 26 | const ModuleInterface::ListArgumentBlock& reject) { 27 | Q_UNUSED(reject); 28 | Q_D(Clipboard); 29 | QString clipboardContent = QGuiApplication::clipboard()->text(); 30 | resolve(d->bridge, QVariantList{clipboardContent}); 31 | } 32 | 33 | void Clipboard::setString(const QString& clipboardContent) { 34 | Q_D(Clipboard); 35 | QGuiApplication::clipboard()->setText(clipboardContent); 36 | } 37 | 38 | Clipboard::Clipboard(QObject* parent) : QObject(parent), d_ptr(new ClipboardPrivate) {} 39 | 40 | Clipboard::~Clipboard() {} 41 | 42 | void Clipboard::setBridge(Bridge* bridge) { 43 | Q_D(Clipboard); 44 | d->bridge = bridge; 45 | } 46 | 47 | QString Clipboard::moduleName() { 48 | return "RCTClipboard"; 49 | } 50 | -------------------------------------------------------------------------------- /RNTester/js/URIActionMap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | * @format 8 | * @flow 9 | */ 10 | 11 | 'use strict'; 12 | 13 | const ReactNative = require('react-native'); 14 | const RNTesterActions = require('./RNTesterActions'); 15 | // $FlowFixMe : This is a platform-forked component, and flow seems to only run on iOS? 16 | const RNTesterList = require('./RNTesterList'); 17 | 18 | const {Alert} = ReactNative; 19 | 20 | import type {RNTesterAction} from './RNTesterActions'; 21 | 22 | function PathActionMap(path: string): ?RNTesterAction { 23 | // Warning! Hacky parsing for example code. Use a library for this! 24 | const exampleParts = path.split('/example/'); 25 | const exampleKey = exampleParts[1]; 26 | if (exampleKey) { 27 | if (!RNTesterList.Modules[exampleKey]) { 28 | Alert.alert(`${exampleKey} example could not be found!`); 29 | return null; 30 | } 31 | return RNTesterActions.ExampleAction(exampleKey); 32 | } 33 | return null; 34 | } 35 | 36 | function URIActionMap(uri: ?string): ?RNTesterAction { 37 | if (!uri) { 38 | return null; 39 | } 40 | // Warning! Hacky parsing for example code. Use a library for this! 41 | const parts = uri.split('rntester:/'); 42 | if (!parts[1]) { 43 | return null; 44 | } 45 | const path = parts[1]; 46 | return PathActionMap(path); 47 | } 48 | 49 | module.exports = URIActionMap; 50 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (C) 2016, Canonical Ltd. 3 | # All rights reserved. 4 | 5 | # This source code is licensed under the BSD-style license found in the 6 | # LICENSE file in the root directory of this source tree. An additional grant 7 | # of patent rights can be found in the PATENTS file in the same directory. 8 | 9 | cmake_minimum_required(VERSION 3.2.2) 10 | 11 | project(react-native-desktop) 12 | 13 | set(PROJECT_NAME "react-native-desktop") 14 | set(PROJECT_VERSION "0.0.1") 15 | 16 | option(JAVASCRIPTCORE_ENABLED 17 | "Build with JavaScriptCore enabled" 18 | OFF) 19 | 20 | if(JAVASCRIPTCORE_ENABLED) 21 | set(CMAKE_CXX_STANDARD 14) 22 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 23 | set(CMAKE_CXX_EXTENSIONS OFF) 24 | endif() 25 | 26 | if(WIN32) 27 | set(REACT_BUILD_STATIC_LIB 1) 28 | set(USE_QTWEBKIT 1) 29 | endif() 30 | 31 | include_directories(./React/Layout) 32 | enable_testing() 33 | 34 | message(STATUS "External modules dirs: ${EXTERNAL_MODULES_DIR}") 35 | 36 | foreach(module_directory ${EXTERNAL_MODULES_DIR}) 37 | message(STATUS "Add external module subdirectory: ${module_directory}") 38 | add_subdirectory(${module_directory}) 39 | endforeach(module_directory) 40 | 41 | add_subdirectory(ReactQt) 42 | add_subdirectory(Examples) 43 | add_subdirectory(RNTester) 44 | 45 | add_custom_target( 46 | "watch" 47 | COMMAND node -e \"require('fs').watch('${CMAKE_SOURCE_DIR}/ReactQt',function(e,f){require('child_process').spawn('make',{stdio:'inherit'})})\" 48 | DEPENDS react-native 49 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 50 | ) 51 | -------------------------------------------------------------------------------- /RNTester/js/DimensionsExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | * @format 8 | * @flow 9 | */ 10 | 11 | 'use strict'; 12 | 13 | const React = require('react'); 14 | const {Dimensions, Text, View} = require('react-native'); 15 | 16 | class DimensionsSubscription extends React.Component< 17 | {dim: string}, 18 | {dims: Object}, 19 | > { 20 | state = { 21 | dims: Dimensions.get(this.props.dim), 22 | }; 23 | 24 | componentDidMount() { 25 | Dimensions.addEventListener('change', this._handleDimensionsChange); 26 | } 27 | 28 | componentWillUnmount() { 29 | Dimensions.removeEventListener('change', this._handleDimensionsChange); 30 | } 31 | 32 | _handleDimensionsChange = dimensions => { 33 | this.setState({ 34 | dims: dimensions[this.props.dim], 35 | }); 36 | }; 37 | 38 | render() { 39 | return ( 40 | 41 | {JSON.stringify(this.state.dims)} 42 | 43 | ); 44 | } 45 | } 46 | 47 | exports.title = 'Dimensions'; 48 | exports.description = 'Dimensions of the viewport'; 49 | exports.examples = [ 50 | { 51 | title: 'window', 52 | render(): React.Element { 53 | return ; 54 | }, 55 | }, 56 | { 57 | title: 'screen', 58 | render(): React.Element { 59 | return ; 60 | }, 61 | }, 62 | ]; 63 | -------------------------------------------------------------------------------- /RNTester/js/RNTesterNavigationReducer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | * @format 8 | * @flow 9 | */ 10 | 11 | 'use strict'; 12 | 13 | // $FlowFixMe : This is a platform-forked component, and flow seems to only run on iOS? 14 | const RNTesterList = require('./RNTesterList'); 15 | 16 | export type RNTesterNavigationState = { 17 | openExample: ?string, 18 | }; 19 | 20 | function RNTesterNavigationReducer( 21 | state: ?RNTesterNavigationState, 22 | action: any, 23 | ): RNTesterNavigationState { 24 | if ( 25 | // Default value is to see example list 26 | !state || 27 | // Handle the explicit list action 28 | action.type === 'RNTesterListAction' || 29 | // Handle requests to go back to the list when an example is open 30 | (state.openExample && action.type === 'RNTesterBackAction') 31 | ) { 32 | return { 33 | // A null openExample will cause the views to display the RNTester example list 34 | openExample: null, 35 | }; 36 | } 37 | 38 | if (action.type === 'RNTesterExampleAction') { 39 | // Make sure we see the module before returning the new state 40 | const ExampleModule = RNTesterList.Modules[action.openExample]; 41 | 42 | if (ExampleModule) { 43 | return { 44 | openExample: action.openExample, 45 | }; 46 | } 47 | } 48 | 49 | return state; 50 | } 51 | 52 | module.exports = RNTesterNavigationReducer; 53 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/appstate.cpp: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Copyright (C) 2016, Canonical Ltd. 4 | * All rights reserved. 5 | * 6 | * This source code is licensed under the BSD-style license found in the 7 | * LICENSE file in the root directory of this source tree. An additional grant 8 | * of patent rights can be found in the PATENTS file in the same directory. 9 | * 10 | * Author: Justin McPherson 11 | * 12 | */ 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include "appstate.h" 19 | 20 | namespace { 21 | QString reactAppState(Qt::ApplicationState state) { 22 | switch (state) { 23 | case Qt::ApplicationSuspended: 24 | case Qt::ApplicationHidden: 25 | return "background"; 26 | case Qt::ApplicationInactive: 27 | return "inactive"; 28 | case Qt::ApplicationActive: 29 | return "active"; 30 | } 31 | } 32 | } // namespace 33 | 34 | void AppState::getCurrentAppState(const ModuleInterface::ListArgumentBlock& success, 35 | const ModuleInterface::MapArgumentBlock& error) { 36 | success(m_bridge, QVariantList{QVariantMap{{"app_state", reactAppState(QGuiApplication::applicationState())}}}); 37 | } 38 | 39 | AppState::AppState(QObject* parent) : QObject(parent) {} 40 | 41 | AppState::~AppState() {} 42 | 43 | void AppState::setBridge(Bridge* bridge) { 44 | m_bridge = bridge; 45 | } 46 | 47 | ViewManager* AppState::viewManager() { 48 | return nullptr; 49 | } 50 | 51 | QString AppState::moduleName() { 52 | return "RCTAppState"; 53 | } 54 | -------------------------------------------------------------------------------- /ReactQt/runtime/src/qml/ReactWebView.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.9 2 | import QtQuick.Controls 2.2 3 | 4 | import QtWebView 1.1 5 | import React 0.1 as React 6 | 7 | WebView { 8 | id: webViewRoot 9 | property var p_source: '' 10 | property var webViewManager: null 11 | property var flexbox: React.Flexbox {control: webViewRoot} 12 | property var p_testID 13 | 14 | objectName: p_testID ? p_testID : null 15 | 16 | onWebViewManagerChanged: { 17 | if (!webViewManager) { 18 | return; 19 | } 20 | webViewManager.s_reload.connect(webViewRoot.reload); 21 | webViewManager.s_goBack.connect(webViewRoot.goBack); 22 | webViewManager.s_goForward.connect(webViewRoot.goForward); 23 | webViewManager.s_invokeJS.connect(webViewRoot.runJavaScript); 24 | } 25 | 26 | onP_sourceChanged: { 27 | webViewRoot.url = (p_source && p_source.uri) ? p_source.uri : ""; 28 | if(p_source && p_source.html) { 29 | webViewRoot.loadHtml(p_source.html) 30 | } 31 | } 32 | 33 | onLoadingChanged: { 34 | switch(loadRequest.status) { 35 | case WebView.LoadStartedStatus: 36 | webViewManager.sendOnLoadStartNotificationToJs(webViewRoot); 37 | break; 38 | case WebView.LoadSucceededStatus: 39 | webViewManager.sendOnLoadEndNotificationToJs(webViewRoot); 40 | break; 41 | case WebView.LoadFailedStatus: 42 | webViewManager.sendOnErrorNotificationToJs(webViewRoot); 43 | break; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /RNTester/js/XHRExampleAbortController.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | * @format 8 | * @flow 9 | */ 10 | 11 | 'use strict'; 12 | 13 | const React = require('react'); 14 | const {Alert, Button, View} = require('react-native'); 15 | 16 | class XHRExampleAbortController extends React.Component<{}, {}> { 17 | _timeout: any; 18 | 19 | _submit(abortDelay) { 20 | clearTimeout(this._timeout); 21 | // eslint-disable-next-line no-undef 22 | const abortController = new AbortController(); 23 | fetch('https://facebook.github.io/react-native/', { 24 | signal: abortController.signal, 25 | }) 26 | .then(res => res.text()) 27 | .then(res => Alert.alert(res)) 28 | .catch(err => Alert.alert(err.message)); 29 | this._timeout = setTimeout(() => { 30 | abortController.abort(); 31 | }, abortDelay); 32 | } 33 | 34 | componentWillUnmount() { 35 | clearTimeout(this._timeout); 36 | } 37 | 38 | render() { 39 | return ( 40 | 41 |