├── .all-contributorsrc ├── .circleci └── config.yml ├── .eslintignore ├── .eslintrc.js ├── .flowconfig ├── .gitignore ├── .gitmodules ├── .prettierignore ├── .prettierrc ├── .vscode ├── launch.json └── settings.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── Examples └── index.html ├── LICENSE.md ├── README.md ├── docs ├── doc1.md ├── doc2.md ├── doc3.md ├── exampledoc4.md └── exampledoc5.md ├── lerna.json ├── package.json ├── packages ├── react-native-dom │ ├── .babelrc │ ├── .eslintrc.js │ ├── .gitignore │ ├── .npmignore │ ├── CHANGELOG.md │ ├── Examples │ │ ├── AnimatedScrollView │ │ │ ├── config.js │ │ │ ├── index.dom.js │ │ │ ├── package.json │ │ │ ├── rn-cli.config.js │ │ │ ├── web │ │ │ │ ├── client.js │ │ │ │ └── index.html │ │ │ └── yarn.lock │ │ ├── Button │ │ │ ├── index.dom.js │ │ │ ├── package.json │ │ │ ├── rn-cli.config.js │ │ │ ├── web │ │ │ │ ├── client.js │ │ │ │ └── index.html │ │ │ └── yarn.lock │ │ ├── FlatList │ │ │ ├── index.dom.js │ │ │ ├── package.json │ │ │ ├── rn-cli.config.js │ │ │ ├── web │ │ │ │ ├── client.js │ │ │ │ └── index.html │ │ │ └── yarn.lock │ │ ├── LayoutAnimations │ │ │ ├── client.js │ │ │ ├── index.dom.js │ │ │ ├── index.html │ │ │ ├── package.json │ │ │ ├── rn-cli.config.js │ │ │ └── yarn.lock │ │ └── Tracking │ │ │ ├── assets │ │ │ ├── jason.jpg │ │ │ ├── ken.jpg │ │ │ ├── vincent.jpg │ │ │ └── vjeux.jpg │ │ │ ├── client.js │ │ │ ├── index.dom.js │ │ │ ├── index.html │ │ │ └── rn-cli.config.js │ ├── Libraries │ │ ├── Alert │ │ │ └── RCTAlertManager.dom.js │ │ ├── Components │ │ │ ├── AccessibilityInfo │ │ │ │ └── AccessibilityInfo.dom.js │ │ │ ├── ActivityIndicator │ │ │ │ └── ActivityIndicator.dom.js │ │ │ ├── AppleTV │ │ │ │ └── TVEventHandler.dom.js │ │ │ ├── Button.dom.js │ │ │ ├── CheckBox │ │ │ │ └── CheckBox.dom.js │ │ │ ├── Clipboard │ │ │ │ └── Clipboard.dom.js │ │ │ ├── DatePicker │ │ │ │ └── DatePickerIOS.dom.js │ │ │ ├── DatePickerAndroid │ │ │ │ └── DatePickerAndroid.dom.js │ │ │ ├── DrawerAndroid │ │ │ │ └── DrawerLayoutAndroid.dom.js │ │ │ ├── MaskedView │ │ │ │ └── MaskedViewIOS.dom.js │ │ │ ├── Navigation │ │ │ │ └── NavigatorIOS.dom.js │ │ │ ├── Picker │ │ │ │ ├── PickerAndroid.dom.js │ │ │ │ └── PickerIOS.dom.js │ │ │ ├── ProgressBarAndroid │ │ │ │ └── ProgressBarAndroid.dom.js │ │ │ ├── ProgressViewIOS │ │ │ │ └── ProgressViewIOS.dom.js │ │ │ ├── ReactNative │ │ │ │ └── UIManager.dom.js │ │ │ ├── SafeAreaView │ │ │ │ └── SafeAreaView.dom.js │ │ │ ├── ScrollView │ │ │ │ └── ScrollViewStickyHeader.dom.js │ │ │ ├── SegmentedControlIOS │ │ │ │ └── SegmentedControlIOS.dom.js │ │ │ ├── Slider │ │ │ │ └── Slider.dom.js │ │ │ ├── StatusBar │ │ │ │ └── StatusBarIOS.dom.js │ │ │ ├── Switch │ │ │ │ └── Switch.dom.js │ │ │ ├── TabBarIOS │ │ │ │ ├── TabBarIOS.dom.js │ │ │ │ └── TabBarItemIOS.dom.js │ │ │ ├── TextInput │ │ │ │ ├── TextInput.dom.js │ │ │ │ └── TextInputState.dom.js │ │ │ ├── TimePickerAndroid │ │ │ │ └── TimePickerAndroid.dom.js │ │ │ ├── ToastAndroid │ │ │ │ └── ToastAndroid.dom.js │ │ │ ├── ToolbarAndroid │ │ │ │ └── ToolbarAndroid.dom.js │ │ │ ├── Touchable │ │ │ │ └── TouchableNativeFeedback.dom.js │ │ │ ├── View │ │ │ │ └── PlatformViewPropTypes.dom.js │ │ │ ├── ViewPager │ │ │ │ └── ViewPagerAndroid.dom.js │ │ │ └── WebView │ │ │ │ └── WebView.dom.js │ │ ├── Core │ │ │ └── Devtools │ │ │ │ └── setupDevtools.dom.js │ │ ├── EventEmitter │ │ │ └── NativeEventEmitter.dom.js │ │ ├── Image │ │ │ └── Image.dom.js │ │ ├── Network │ │ │ ├── NetInfo.dom.js │ │ │ └── RCTNetworking.dom.js │ │ ├── RCTTest │ │ │ └── SnapshotViewIOS.dom.js │ │ ├── Settings │ │ │ └── Settings.dom.js │ │ ├── Utilities │ │ │ ├── BackHandler.dom.js │ │ │ ├── HMRLoadingView.dom.js │ │ │ └── Platform.dom.js │ │ ├── Vibration │ │ │ ├── Vibration.dom.js │ │ │ └── VibrationIOS.dom.js │ │ ├── YellowBox │ │ │ └── UI │ │ │ │ └── YellowBoxInspectorHeader.dom.js │ │ └── polyfills │ │ │ └── setBabelHelper.js │ ├── README.md │ ├── RNTester.md │ ├── ReactDom │ │ ├── DevSupport │ │ │ ├── RCTDevLoadingView.js │ │ │ └── RCTDevMenu.js │ │ ├── ReactDom.js │ │ ├── base │ │ │ ├── NotificationCenter.js │ │ │ ├── UIBorderView.js │ │ │ ├── UIChildContainerView.js │ │ │ ├── UIHitSlopView.js │ │ │ └── UIView.js │ │ ├── bridge │ │ │ ├── RCTBridge.js │ │ │ ├── RCTBridge.worker.js │ │ │ ├── RCTBridgeMethod.js │ │ │ ├── RCTEventDispatcher.js │ │ │ ├── RCTModule.js │ │ │ ├── RCTModuleConfig.js │ │ │ └── RCTRootView.js │ │ ├── defs │ │ │ └── InternalLib.js │ │ ├── modules │ │ │ ├── LayoutAnimation │ │ │ │ ├── RCTKeyframeGenerator.js │ │ │ │ ├── RCTLayoutAnimationManager.js │ │ │ │ └── __tests__ │ │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── keyframeGenerator.test.js.snap │ │ │ │ │ └── keyframeGenerator.test.js │ │ │ ├── NativeAnimation │ │ │ │ ├── Drivers │ │ │ │ │ ├── RCTAnimationDriver.js │ │ │ │ │ ├── RCTDecayAnimation.js │ │ │ │ │ ├── RCTEventAnimation.js │ │ │ │ │ ├── RCTFrameAnimation.js │ │ │ │ │ └── RCTSpringAnimation.js │ │ │ │ ├── Nodes │ │ │ │ │ ├── RCTAdditionAnimatedNode.js │ │ │ │ │ ├── RCTAnimatedNode.js │ │ │ │ │ ├── RCTDiffClampAnimatedNode.js │ │ │ │ │ ├── RCTDivisionAnimatedNode.js │ │ │ │ │ ├── RCTInterpolationAnimatedNode.js │ │ │ │ │ ├── RCTModuloAnimatedNode.js │ │ │ │ │ ├── RCTMultiplicationAnimatedNode.js │ │ │ │ │ ├── RCTPropsAnimatedNode.js │ │ │ │ │ ├── RCTStyleAnimatedNode.js │ │ │ │ │ ├── RCTSubtractionAnimatedNode.js │ │ │ │ │ ├── RCTTrackingAnimatedNode.js │ │ │ │ │ ├── RCTTransformAnimatedNode.js │ │ │ │ │ └── RCTValueAnimatedNode.js │ │ │ │ ├── RCTAnimationUtils.js │ │ │ │ ├── RCTNativeAnimatedModule.js │ │ │ │ └── RCTNativeAnimatedNodesManager.js │ │ │ ├── RCTAppState.js │ │ │ ├── RCTAsyncLocalStorage.js │ │ │ ├── RCTBlobManager.js │ │ │ ├── RCTDevSettings.js │ │ │ ├── RCTDeviceEventManager.js │ │ │ ├── RCTDeviceInfo.js │ │ │ ├── RCTExceptionsManager.js │ │ │ ├── RCTHistory.js │ │ │ ├── RCTI18nManager.js │ │ │ ├── RCTKeyboardObserver.js │ │ │ ├── RCTLinkingManager.js │ │ │ ├── RCTNativeEventEmitter.js │ │ │ ├── RCTNativeViewHierarchyOptimizer.js │ │ │ ├── RCTNetworkingNative.js │ │ │ ├── RCTPlatform.js │ │ │ ├── RCTSourceCode.js │ │ │ ├── RCTStatusBarManager.js │ │ │ ├── RCTTiming.js │ │ │ ├── RCTTouchEvent.js │ │ │ ├── RCTTouchHandler.js │ │ │ ├── RCTUIManager.js │ │ │ ├── RCTUIManagerObserverCoordinator.js │ │ │ ├── RCTVibration.js │ │ │ ├── RCTWebSocketModule.js │ │ │ └── RedBox │ │ │ │ └── RCTRedBox.js │ │ ├── utils │ │ │ ├── BundleFromRoot.js │ │ │ ├── CanUse.js │ │ │ ├── ColorArrayFromHexARGB.js │ │ │ ├── Guid.js │ │ │ ├── Instrument.js │ │ │ ├── NativeMatrixMath.js │ │ │ ├── isIOS.js │ │ │ ├── prefixInlineStyles.js │ │ │ └── static.js │ │ └── views │ │ │ ├── Image │ │ │ ├── RCTImageLoader.js │ │ │ ├── RCTImageSource.js │ │ │ ├── RCTImageView.js │ │ │ └── RCTImageViewManager.js │ │ │ ├── RCTActivityIndicatorView.js │ │ │ ├── RCTActivityIndicatorViewManager.js │ │ │ ├── RCTComponent.js │ │ │ ├── RCTComponentData.js │ │ │ ├── RCTPropDescription.js │ │ │ ├── RCTPropTypes.js │ │ │ ├── RCTRootShadowView.js │ │ │ ├── RCTScrollContentViewManager.js │ │ │ ├── RCTScrollView.js │ │ │ ├── RCTScrollViewLocalData.js │ │ │ ├── RCTScrollViewManager.js │ │ │ ├── RCTShadowScrollView.js │ │ │ ├── RCTShadowView.js │ │ │ ├── RCTView.js │ │ │ ├── RCTViewManager.js │ │ │ ├── SafeAreaView │ │ │ └── RCTSafeAreaViewManager.js │ │ │ ├── Switch │ │ │ ├── RCTSwitch.js │ │ │ └── RCTSwitchManager.js │ │ │ ├── Text │ │ │ ├── Metrics │ │ │ │ ├── TextMetrics.js │ │ │ │ ├── TextStyle.js │ │ │ │ └── deepCopyProperties.js │ │ │ ├── RCTRawText.js │ │ │ ├── RCTRawTextManager.js │ │ │ ├── RCTShadowRawText.js │ │ │ ├── RCTShadowText.js │ │ │ ├── RCTSharedTextValues.js │ │ │ ├── RCTText.js │ │ │ ├── RCTTextInput.js │ │ │ ├── RCTTextInputManager.js │ │ │ └── RCTTextManager.js │ │ │ └── WebView │ │ │ ├── RCTWebView.js │ │ │ └── RCTWebViewManager.js │ ├── flow-typed │ │ ├── local │ │ │ ├── flow-utils.js │ │ │ ├── pointer-events.js │ │ │ └── waapi.js │ │ └── npm │ │ │ ├── detect-it_vx.x.x.js │ │ │ ├── history_v4.x.x.js │ │ │ ├── idb-keyval_vx.x.x.js │ │ │ ├── resize-observer-polyfill_vx.x.x.js │ │ │ ├── rndom-redbox.js │ │ │ ├── rndom-switch.js │ │ │ └── yoga-dom.js │ ├── jest │ │ └── hasteImpl.js │ ├── local-cli │ │ ├── .npmignore │ │ ├── constants.js │ │ ├── core │ │ │ └── dom │ │ │ │ ├── findDepConfigPath.js │ │ │ │ ├── findVendorModulePath.js │ │ │ │ ├── getDomRequirePath.js │ │ │ │ └── index.js │ │ ├── generate-dom.js │ │ ├── generator-dom │ │ │ ├── index.js │ │ │ └── templates │ │ │ │ ├── App.dom.js │ │ │ │ ├── _gitignore │ │ │ │ ├── bootstrap.js │ │ │ │ ├── entry.js │ │ │ │ └── index.html │ │ ├── generator-utils.js │ │ ├── index.js │ │ ├── link │ │ │ ├── dom │ │ │ │ ├── getDependencyConfig.js │ │ │ │ ├── isInstalled.js │ │ │ │ ├── registerNativeModule.js │ │ │ │ ├── unregisterNativeModule.js │ │ │ │ ├── updateDependencyConfig.js │ │ │ │ └── updateVendorModuleFile.js │ │ │ └── index.js │ │ ├── platform.js │ │ └── runDom │ │ │ └── runDom.js │ ├── metro.config.js │ ├── now.json │ ├── package.json │ └── scripts │ │ ├── babel-plugin-haste-require.js │ │ └── eslint-module-resolver-haste.js ├── rndom-redbox │ ├── .gitignore │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── public │ │ ├── global.css │ │ └── index.html │ ├── rollup.config.js │ └── src │ │ └── index.svelte ├── rndom-switch │ ├── .gitignore │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── public │ │ ├── global.css │ │ └── index.html │ ├── rollup.config.js │ └── src │ │ └── index.svelte └── rnpm-plugin-dom │ ├── CHANGELOG.md │ ├── README.md │ ├── index.js │ ├── package.json │ └── src │ └── dom.js ├── scripts └── smoke.js ├── website ├── blog │ ├── 2016-03-11-blog-post.md │ ├── 2017-04-10-blog-post-two.md │ ├── 2017-09-25-testing-rss.md │ ├── 2017-09-26-adding-rss.md │ └── 2017-10-24-new-version-1.0.0.md ├── core │ └── Footer.js ├── package.json ├── pages │ └── en │ │ ├── help.js │ │ ├── index.js │ │ └── users.js ├── sidebars.json ├── siteConfig.js └── static │ ├── css │ └── custom.css │ └── img │ ├── docusaurus.svg │ ├── favicon.png │ ├── favicon │ ├── apple-touch-icon-114x114.png │ ├── apple-touch-icon-120x120.png │ ├── apple-touch-icon-144x144.png │ ├── apple-touch-icon-152x152.png │ ├── apple-touch-icon-180x180.png │ ├── apple-touch-icon-57x57.png │ ├── apple-touch-icon-60x60.png │ ├── apple-touch-icon-72x72.png │ ├── apple-touch-icon-76x76.png │ ├── apple-touch-icon.png │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── favicon.ico │ ├── launcher-icon-0-75x.png │ ├── launcher-icon-1-5x.png │ ├── launcher-icon-1x.png │ ├── launcher-icon-2x.png │ ├── launcher-icon-3x.png │ ├── launcher-icon-4x.png │ ├── manifest.json │ └── readme.txt │ ├── metro.svg │ ├── oss_logo.png │ ├── react-native-logo.png │ ├── react-native-logo@2x.png │ ├── react-native-logo@svg.svg │ ├── react.svg │ ├── rn-dom-logo-favicon.png │ ├── rn-dom-logo-large.svg │ ├── rn-dom-logo.sketch │ ├── rn-dom-logo.svg │ └── yoga.svg └── yarn.lock /.eslintignore: -------------------------------------------------------------------------------- 1 | **/*.js 2 | 3 | !packages/react-native-dom/ReactDom/**/*.js -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | 3 | module.exports = { 4 | root: true, 5 | parser: "babel-eslint", 6 | plugins: ["prettier", "import"], 7 | rules: { 8 | "no-extra-bind": 2, 9 | "no-else-return": 2, 10 | "no-useless-return": 2, 11 | "no-var": 2, 12 | "prettier/prettier": 2, 13 | "import/order": [ 14 | "error", 15 | { 16 | "newlines-between": "always", 17 | groups: [ 18 | "builtin", 19 | "external", 20 | "internal", 21 | "parent", 22 | "sibling", 23 | "index" 24 | ] 25 | } 26 | ], 27 | "import/no-unresolved": 2, 28 | "import/export": 2, 29 | "import/no-extraneous-dependencies": 2, 30 | "import/first": 2 31 | }, 32 | settings: { 33 | "import/resolver": { 34 | [path.resolve( 35 | __dirname, 36 | "./packages/react-native-dom/scripts/eslint-module-resolver-haste" 37 | )]: {}, 38 | node: { 39 | paths: [ 40 | path.resolve(__dirname, "node_modules"), 41 | path.resolve(__dirname, "./packages/react-native-dom/node_modules") 42 | ] 43 | } 44 | } 45 | } 46 | }; 47 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | .*/node_modules/fbjs/.* 4 | 5 | # We fork some components by platform. 6 | .*/*[.]android.js 7 | .*/*[.]dom.js 8 | 9 | .*/lib/.* 10 | .*/dist/.* 11 | 12 | .*/Libraries/react-native/React.js 13 | .*/Libraries/react-native/ReactNative.js 14 | 15 | /packages/react-native-dom/Examples/.* 16 | /packages/react-native-dom/Libraries/.* 17 | /packages/react-native-dom/RNTester/.* 18 | /packages/react-native-dom/local-cli/.* 19 | 20 | [include] 21 | ./packages/rndom-redbox/ 22 | ./packages/rndom-switch/ 23 | ./packages/rnpm-plugin-dom/ 24 | 25 | [libs] 26 | packages/react-native-dom/flow-typed 27 | 28 | [options] 29 | module.system.node.resolve_dirname=node_modules 30 | module.system.node.resolve_dirname=packages/react-native-dom/node_modules 31 | 32 | module.system=haste 33 | module.system.haste.use_name_reducers=true 34 | 35 | # keep the following in sync with server/haste/hasteImpl.js 36 | # get basename 37 | module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' 38 | # strip .js or .js.flow suffix 39 | module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' 40 | # strip .dom suffix 41 | module.system.haste.name_reducers='^\(.*\)\.dom$' -> '\1' 42 | module.system.haste.paths.whitelist=/packages/react-native-dom/Libraries/.* 43 | module.system.haste.paths.whitelist=/packages/react-native-dom/RNTester/.* 44 | module.system.haste.paths.whitelist=/packages/react-native-dom/ReactDom/.* 45 | 46 | [version] 47 | ^0.89.0 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | node_modules 4 | lerna-debug.log 5 | TestApp 6 | 7 | lib/core/metadata.js 8 | lib/core/MetadataBlog.js 9 | 10 | website/translated_docs 11 | website/build/ 12 | website/yarn.lock 13 | website/node_modules 14 | website/i18n/* -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "packages/react-native-dom/RNTester"] 2 | path = packages/react-native-dom/RNTester 3 | url = https://github.com/vincentriemer/react-native-dom.git 4 | branch = rntester 5 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | packages/react-native-dom/defs 3 | packages/react-native-dom/flow-typed 4 | packages/react-native-dom/RNTester -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "always", 3 | "proseWrap": "always" 4 | } 5 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Debug DOM", 9 | "program": "${workspaceRoot}/.vscode/launchReactNative.js", 10 | "type": "reactnative", 11 | "request": "launch", 12 | "platform": "dom", 13 | "sourceMaps": true, 14 | "outDir": "${workspaceRoot}/.vscode/.react" 15 | }, 16 | { 17 | "name": "Attach to packager", 18 | "program": "${workspaceRoot}/.vscode/launchReactNative.js", 19 | "type": "reactnative", 20 | "request": "attach", 21 | "sourceMaps": true, 22 | "outDir": "${workspaceRoot}/.vscode/.react" 23 | }, 24 | { 25 | "name": "Debug in Exponent", 26 | "program": "${workspaceRoot}/.vscode/launchReactNative.js", 27 | "type": "reactnative", 28 | "request": "launch", 29 | "platform": "exponent", 30 | "sourceMaps": true, 31 | "outDir": "${workspaceRoot}/.vscode/.react" 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true, 3 | "flow.useNPMPackagedFlow": true, 4 | "eslint.enable": true 5 | } 6 | -------------------------------------------------------------------------------- /Examples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | React Native DOM Examples 5 | 6 | 7 | 8 | 9 |

React Native DOM Examples

10 | 30 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Vincent Riemer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /docs/doc2.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: doc2 3 | title: document number 2 4 | --- 5 | 6 | This is a link to [another document.](doc3.md) 7 | This is a link to an [external page.](http://www.example.com) 8 | -------------------------------------------------------------------------------- /docs/doc3.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: doc3 3 | title: This is document number 3 4 | --- 5 | 6 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ac euismod odio, eu 7 | consequat dui. Nullam molestie consectetur risus id imperdiet. Proin sodales 8 | ornare turpis, non mollis massa ultricies id. Nam at nibh scelerisque, feugiat 9 | ante non, dapibus tortor. Vivamus volutpat diam quis tellus elementum bibendum. 10 | Praesent semper gravida velit quis aliquam. Etiam in cursus neque. Nam lectus 11 | ligula, malesuada et mauris a, bibendum faucibus mi. Phasellus ut interdum 12 | felis. Phasellus in odio pulvinar, porttitor urna eget, fringilla lectus. 13 | Aliquam sollicitudin est eros. Mauris consectetur quam vitae mauris interdum 14 | hendrerit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. 15 | 16 | Duis et egestas libero, imperdiet faucibus ipsum. Sed posuere eget urna vel 17 | feugiat. Vivamus a arcu sagittis, fermentum urna dapibus, congue lectus. Fusce 18 | vulputate porttitor nisl, ac cursus elit volutpat vitae. Nullam vitae ipsum 19 | egestas, convallis quam non, porta nibh. Morbi gravida erat nec neque bibendum, 20 | eu pellentesque velit posuere. Fusce aliquam erat eu massa eleifend tristique. 21 | 22 | Sed consequat sollicitudin ipsum eget tempus. Integer a aliquet velit. In justo 23 | nibh, pellentesque non suscipit eget, gravida vel lacus. Donec odio ante, 24 | malesuada in massa quis, pharetra tristique ligula. Donec eros est, tristique 25 | eget finibus quis, semper non nisl. Vivamus et elit nec enim ornare placerat. 26 | Sed posuere odio a elit cursus sagittis. 27 | 28 | Phasellus feugiat purus eu tortor ultrices finibus. Ut libero nibh, lobortis et 29 | libero nec, dapibus posuere eros. Sed sagittis euismod justo at consectetur. 30 | Nulla finibus libero placerat, cursus sapien at, eleifend ligula. Vivamus elit 31 | nisl, hendrerit ac nibh eu, ultrices tempus dui. Nam tellus neque, commodo non 32 | rhoncus eu, gravida in risus. Nullam id iaculis tortor. 33 | 34 | Nullam at odio in sem varius tempor sit amet vel lorem. Etiam eu hendrerit nisl. 35 | Fusce nibh mauris, vulputate sit amet ex vitae, congue rhoncus nisl. Sed eget 36 | tellus purus. Nullam tempus commodo erat ut tristique. Cras accumsan massa sit 37 | amet justo consequat eleifend. Integer scelerisque vitae tellus id consectetur. 38 | -------------------------------------------------------------------------------- /docs/exampledoc4.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: doc4 3 | title: Other Document 4 | --- 5 | 6 | this is another document 7 | -------------------------------------------------------------------------------- /docs/exampledoc5.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: doc5 3 | title: Fifth Document 4 | --- 5 | 6 | Another one 7 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "lerna": "3.4.3", 3 | "packages": ["packages/*"], 4 | "npmClient": "yarn", 5 | "version": "0.5.0", 6 | "exact": true, 7 | "command": { 8 | "publish": { 9 | "message": "chore(release): publish %s", 10 | "allowBranch": "master", 11 | "npmClient": "npm" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/react-native-dom/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/flow", "module:metro-react-native-babel-preset"], 3 | "plugins": [ 4 | "@babel/plugin-syntax-dynamic-import", 5 | "@babel/plugin-proposal-object-rest-spread", 6 | ["@babel/plugin-proposal-nullish-coalescing-operator", { "loose": true }], 7 | [ 8 | "@babel/plugin-transform-runtime", 9 | { 10 | "helpers": true, 11 | "regenerator": true 12 | } 13 | ], 14 | "transform-inline-environment-variables", 15 | "preval", 16 | "./scripts/babel-plugin-haste-require" 17 | ], 18 | "env": { 19 | "lib": { 20 | "presets": ["@babel/flow"] 21 | }, 22 | "production": { 23 | "plugins": [ 24 | "@babel/plugin-syntax-dynamic-import", 25 | "@babel/plugin-proposal-object-rest-spread", 26 | [ 27 | "@babel/plugin-proposal-nullish-coalescing-operator", 28 | { "loose": true } 29 | ], 30 | [ 31 | "@babel/plugin-transform-runtime", 32 | { 33 | "helpers": true, 34 | "regenerator": true 35 | } 36 | ], 37 | "transform-inline-environment-variables", 38 | "preval", 39 | [ 40 | "module-resolver", 41 | { 42 | "alias": { 43 | "ReactDom": "./lib/ReactDom.js" 44 | } 45 | } 46 | ], 47 | "./scripts/babel-plugin-haste-require" 48 | ] 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /packages/react-native-dom/.eslintrc.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | 3 | module.exports = { 4 | parserOptions: { 5 | ecmaVersion: 2018, 6 | sourceType: "module", 7 | ecmaFeatures: { 8 | jsx: true 9 | } 10 | }, 11 | env: { 12 | browser: true, 13 | worker: true 14 | }, 15 | settings: {} 16 | }; 17 | -------------------------------------------------------------------------------- /packages/react-native-dom/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | node_modules 3 | lib 4 | stats.html 5 | yarn-error.log 6 | flow-coverage 7 | .yarnrc 8 | yalc.lock -------------------------------------------------------------------------------- /packages/react-native-dom/.npmignore: -------------------------------------------------------------------------------- 1 | .babelrc 2 | dist 3 | ReactDom 4 | RNTester 5 | node_modules 6 | stats.html -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/AnimatedScrollView/config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | title: "Animated ScrollView Example" 3 | }; 4 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/AnimatedScrollView/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "animated-scrollview-example", 3 | "version": "1.0.0", 4 | "description": "", 5 | "scripts": { 6 | "start": "node ../../node_modules/react-native/local-cli/cli.js start --config ../../../../Examples/LayoutAnimations/layout-animations.config.js --reset-cache" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/AnimatedScrollView/rn-cli.config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const path = require("path"); 4 | const blacklist = require("metro-bundler/build/blacklist"); 5 | 6 | /** 7 | * Default configuration for the CLI. 8 | * 9 | * If you need to override any of this functions do so by defining the file 10 | * `rn-cli.config.js` on the root of your project with the functions you need 11 | * to tweak. 12 | */ 13 | const config = { 14 | getProjectRoots() { 15 | return getRoots(); 16 | }, 17 | 18 | // Ignore these files or directories when looking for modules. 19 | // OVRUI/package.json - Avoid importing OVRUI via its package.json file, 20 | // so that we can point the packager at the src directory instead, and 21 | // automatically respond to updates in that directory. 22 | // ReactVR/website - Avoid the react-native which may be installed here. 23 | // .git - Avoid all .git directories 24 | getBlacklistRE() { 25 | return blacklist([]); 26 | }, 27 | 28 | // Any modules that are under react-native-github and we want 29 | // to be able to require from non-opensource code, need to be 30 | // listed here 31 | extraNodeModules: { 32 | fbjs: path.resolve(__dirname, "..", "..", "node_modules", "fbjs"), 33 | react: path.resolve(__dirname, "..", "..", "node_modules", "react"), 34 | "react-native": path.resolve( 35 | __dirname, 36 | "..", 37 | "..", 38 | "node_modules", 39 | "react-native" 40 | ), 41 | "react-native-dom": path.resolve(__dirname, "..", "..", "ReactDom", "index") 42 | }, 43 | 44 | getAssetExts() { 45 | return []; 46 | }, 47 | 48 | getPlatforms() { 49 | return ["dom"]; 50 | }, 51 | 52 | getProvidesModuleNodeModules() { 53 | return ["react-native"]; 54 | } 55 | }; 56 | 57 | function getRoots() { 58 | return [path.resolve(__dirname, "..", "..")]; 59 | } 60 | 61 | module.exports = config; 62 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/AnimatedScrollView/web/client.js: -------------------------------------------------------------------------------- 1 | import { RNDomInstance } from "ReactDom"; 2 | 3 | function init(bundle, parent, options) { 4 | const web = new RNDomInstance(bundle, "scrollview", parent, options); 5 | 6 | web.start(); 7 | return web; 8 | } 9 | 10 | window.ReactDom = { init }; 11 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/AnimatedScrollView/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | start@^5.1.0: 6 | version "5.1.0" 7 | resolved "https://registry.yarnpkg.com/start/-/start-5.1.0.tgz#1c171f0ef9487f56d0ab9a755ace860169208763" 8 | 9 | xopen@^1.0.0: 10 | version "1.0.0" 11 | resolved "https://registry.yarnpkg.com/xopen/-/xopen-1.0.0.tgz#f09909f6da28e20739648f50cef8cbdc3b77f448" 12 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/Button/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "button-example", 3 | "version": "1.0.0", 4 | "description": "", 5 | "scripts": { 6 | "start": "node ../../node_modules/react-native/local-cli/cli.js start --config ../../../../Examples/LayoutAnimations/layout-animations.config.js --reset-cache" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/Button/rn-cli.config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const path = require("path"); 4 | const blacklist = require("metro-bundler/build/blacklist"); 5 | 6 | /** 7 | * Default configuration for the CLI. 8 | * 9 | * If you need to override any of this functions do so by defining the file 10 | * `rn-cli.config.js` on the root of your project with the functions you need 11 | * to tweak. 12 | */ 13 | const config = { 14 | getProjectRoots() { 15 | return getRoots(); 16 | }, 17 | 18 | // Ignore these files or directories when looking for modules. 19 | // OVRUI/package.json - Avoid importing OVRUI via its package.json file, 20 | // so that we can point the packager at the src directory instead, and 21 | // automatically respond to updates in that directory. 22 | // ReactVR/website - Avoid the react-native which may be installed here. 23 | // .git - Avoid all .git directories 24 | getBlacklistRE() { 25 | return blacklist([]); 26 | }, 27 | 28 | // Any modules that are under react-native-github and we want 29 | // to be able to require from non-opensource code, need to be 30 | // listed here 31 | extraNodeModules: { 32 | fbjs: path.resolve(__dirname, "..", "..", "node_modules", "fbjs"), 33 | react: path.resolve(__dirname, "..", "..", "node_modules", "react"), 34 | "react-native": path.resolve( 35 | __dirname, 36 | "..", 37 | "..", 38 | "node_modules", 39 | "react-native" 40 | ), 41 | "react-native-dom": path.resolve(__dirname, "..", "..", "ReactDom", "index") 42 | }, 43 | 44 | getAssetExts() { 45 | return []; 46 | }, 47 | 48 | getPlatforms() { 49 | return ["dom"]; 50 | }, 51 | 52 | getProvidesModuleNodeModules() { 53 | return ["react-native"]; 54 | } 55 | }; 56 | 57 | function getRoots() { 58 | return [path.resolve(__dirname, "..", "..")]; 59 | } 60 | 61 | module.exports = config; 62 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/Button/web/client.js: -------------------------------------------------------------------------------- 1 | import { RNDomInstance } from "ReactDom"; 2 | 3 | function init(bundle, parent, options) { 4 | const web = new RNDomInstance(bundle, "button", parent, { 5 | ...options 6 | }); 7 | 8 | web.start(); 9 | return web; 10 | } 11 | 12 | window.ReactDom = { init }; 13 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/Button/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | start@^5.1.0: 6 | version "5.1.0" 7 | resolved "https://registry.yarnpkg.com/start/-/start-5.1.0.tgz#1c171f0ef9487f56d0ab9a755ace860169208763" 8 | 9 | xopen@^1.0.0: 10 | version "1.0.0" 11 | resolved "https://registry.yarnpkg.com/xopen/-/xopen-1.0.0.tgz#f09909f6da28e20739648f50cef8cbdc3b77f448" 12 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/FlatList/index.dom.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import { 3 | AppRegistry, 4 | StyleSheet, 5 | Text, 6 | View, 7 | TouchableOpacity, 8 | LayoutAnimation, 9 | Button, 10 | ScrollView, 11 | FlatList 12 | } from "react-native"; 13 | 14 | class FlatListExample extends Component { 15 | getData() { 16 | const data = []; 17 | 18 | for (let i = 0; i < 500; i++) { 19 | data.push({ key: `Element ${i}` }); 20 | } 21 | 22 | return data; 23 | } 24 | 25 | render() { 26 | return ( 27 | 28 | ( 32 | console.log(item.key)} 34 | style={styles.item} 35 | > 36 | {item.key} 37 | 38 | )} 39 | /> 40 | 41 | ); 42 | } 43 | } 44 | 45 | const styles = StyleSheet.create({ 46 | container: { 47 | flex: 1, 48 | backgroundColor: "lightblue" 49 | }, 50 | scrollView: { 51 | flexDirection: "column", 52 | alignItems: "stretch" 53 | }, 54 | item: { 55 | padding: 50, 56 | backgroundColor: "pink", 57 | margin: 20 58 | } 59 | }); 60 | 61 | AppRegistry.registerComponent("flatlist", () => FlatListExample); 62 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/FlatList/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flatlist-example", 3 | "version": "1.0.0", 4 | "description": "", 5 | "scripts": { 6 | "start": "node ../../node_modules/react-native/local-cli/cli.js start --config ../../../../Examples/LayoutAnimations/layout-animations.config.js --reset-cache" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/FlatList/rn-cli.config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const path = require("path"); 4 | const blacklist = require("metro-bundler/build/blacklist"); 5 | 6 | /** 7 | * Default configuration for the CLI. 8 | * 9 | * If you need to override any of this functions do so by defining the file 10 | * `rn-cli.config.js` on the root of your project with the functions you need 11 | * to tweak. 12 | */ 13 | const config = { 14 | getProjectRoots() { 15 | return getRoots(); 16 | }, 17 | 18 | // Ignore these files or directories when looking for modules. 19 | // OVRUI/package.json - Avoid importing OVRUI via its package.json file, 20 | // so that we can point the packager at the src directory instead, and 21 | // automatically respond to updates in that directory. 22 | // ReactVR/website - Avoid the react-native which may be installed here. 23 | // .git - Avoid all .git directories 24 | getBlacklistRE() { 25 | return blacklist([]); 26 | }, 27 | 28 | // Any modules that are under react-native-github and we want 29 | // to be able to require from non-opensource code, need to be 30 | // listed here 31 | extraNodeModules: { 32 | fbjs: path.resolve(__dirname, "..", "..", "node_modules", "fbjs"), 33 | react: path.resolve(__dirname, "..", "..", "node_modules", "react"), 34 | "react-native": path.resolve( 35 | __dirname, 36 | "..", 37 | "..", 38 | "node_modules", 39 | "react-native" 40 | ), 41 | "react-native-dom": path.resolve(__dirname, "..", "..", "ReactDom", "index") 42 | }, 43 | 44 | getAssetExts() { 45 | return []; 46 | }, 47 | 48 | getPlatforms() { 49 | return ["dom"]; 50 | }, 51 | 52 | getProvidesModuleNodeModules() { 53 | return ["react-native"]; 54 | } 55 | }; 56 | 57 | function getRoots() { 58 | return [path.resolve(__dirname, "..", "..")]; 59 | } 60 | 61 | module.exports = config; 62 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/FlatList/web/client.js: -------------------------------------------------------------------------------- 1 | import { RNDomInstance } from "ReactDom"; 2 | 3 | function init(bundle, parent, options) { 4 | const web = new RNDomInstance(bundle, "flatlist", parent, { 5 | ...options 6 | }); 7 | 8 | web.start(); 9 | return web; 10 | } 11 | 12 | window.ReactDom = { init }; 13 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/FlatList/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | start@^5.1.0: 6 | version "5.1.0" 7 | resolved "https://registry.yarnpkg.com/start/-/start-5.1.0.tgz#1c171f0ef9487f56d0ab9a755ace860169208763" 8 | 9 | xopen@^1.0.0: 10 | version "1.0.0" 11 | resolved "https://registry.yarnpkg.com/xopen/-/xopen-1.0.0.tgz#f09909f6da28e20739648f50cef8cbdc3b77f448" 12 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/LayoutAnimations/client.js: -------------------------------------------------------------------------------- 1 | import { RNDomInstance } from "ReactDom"; 2 | 3 | function init(bundle, parent, options) { 4 | const web = new RNDomInstance(bundle, "layoutanimations", parent, { 5 | ...options 6 | }); 7 | 8 | web.start(); 9 | return web; 10 | } 11 | 12 | window.ReactDom = { init }; 13 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/LayoutAnimations/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "layout-animations-example", 3 | "version": "1.0.0", 4 | "description": "", 5 | "scripts": { 6 | "start": "node ../../node_modules/react-native/local-cli/cli.js start --config ../../../../Examples/LayoutAnimations/layout-animations.config.js --reset-cache" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/LayoutAnimations/rn-cli.config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const path = require("path"); 4 | const blacklist = require("metro-bundler/build/blacklist"); 5 | 6 | /** 7 | * Default configuration for the CLI. 8 | * 9 | * If you need to override any of this functions do so by defining the file 10 | * `rn-cli.config.js` on the root of your project with the functions you need 11 | * to tweak. 12 | */ 13 | const config = { 14 | getProjectRoots() { 15 | return getRoots(); 16 | }, 17 | 18 | // Ignore these files or directories when looking for modules. 19 | // OVRUI/package.json - Avoid importing OVRUI via its package.json file, 20 | // so that we can point the packager at the src directory instead, and 21 | // automatically respond to updates in that directory. 22 | // ReactVR/website - Avoid the react-native which may be installed here. 23 | // .git - Avoid all .git directories 24 | getBlacklistRE() { 25 | return blacklist([]); 26 | }, 27 | 28 | // Any modules that are under react-native-github and we want 29 | // to be able to require from non-opensource code, need to be 30 | // listed here 31 | extraNodeModules: { 32 | fbjs: path.resolve(__dirname, "..", "..", "node_modules", "fbjs"), 33 | react: path.resolve(__dirname, "..", "..", "node_modules", "react"), 34 | "react-native": path.resolve( 35 | __dirname, 36 | "..", 37 | "..", 38 | "node_modules", 39 | "react-native" 40 | ), 41 | "react-native-dom": path.resolve(__dirname, "..", "..", "ReactDom", "index") 42 | }, 43 | 44 | getAssetExts() { 45 | return []; 46 | }, 47 | 48 | getPlatforms() { 49 | return ["dom"]; 50 | }, 51 | 52 | getProvidesModuleNodeModules() { 53 | return ["react-native"]; 54 | } 55 | }; 56 | 57 | function getRoots() { 58 | return [path.resolve(__dirname, "..", "..")]; 59 | } 60 | 61 | module.exports = config; 62 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/LayoutAnimations/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | start@^5.1.0: 6 | version "5.1.0" 7 | resolved "https://registry.yarnpkg.com/start/-/start-5.1.0.tgz#1c171f0ef9487f56d0ab9a755ace860169208763" 8 | 9 | xopen@^1.0.0: 10 | version "1.0.0" 11 | resolved "https://registry.yarnpkg.com/xopen/-/xopen-1.0.0.tgz#f09909f6da28e20739648f50cef8cbdc3b77f448" 12 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/Tracking/assets/jason.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/packages/react-native-dom/Examples/Tracking/assets/jason.jpg -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/Tracking/assets/ken.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/packages/react-native-dom/Examples/Tracking/assets/ken.jpg -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/Tracking/assets/vincent.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/packages/react-native-dom/Examples/Tracking/assets/vincent.jpg -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/Tracking/assets/vjeux.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/packages/react-native-dom/Examples/Tracking/assets/vjeux.jpg -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/Tracking/client.js: -------------------------------------------------------------------------------- 1 | import { RNDomInstance } from "ReactDom"; 2 | 3 | function init(bundle, parent, options) { 4 | const dom = new RNDomInstance(bundle, "TrackingExample", parent, { 5 | ...options 6 | }); 7 | 8 | dom.start(); 9 | return dom; 10 | } 11 | 12 | window.ReactDom = { init }; 13 | -------------------------------------------------------------------------------- /packages/react-native-dom/Examples/Tracking/rn-cli.config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const path = require("path"); 4 | const blacklist = require("metro-bundler/build/blacklist"); 5 | 6 | /** 7 | * Default configuration for the CLI. 8 | * 9 | * If you need to override any of this functions do so by defining the file 10 | * `rn-cli.config.js` on the root of your project with the functions you need 11 | * to tweak. 12 | */ 13 | const config = { 14 | getProjectRoots() { 15 | return getRoots(); 16 | }, 17 | 18 | // Ignore these files or directories when looking for modules. 19 | // OVRUI/package.json - Avoid importing OVRUI via its package.json file, 20 | // so that we can point the packager at the src directory instead, and 21 | // automatically respond to updates in that directory. 22 | // ReactVR/website - Avoid the react-native which may be installed here. 23 | // .git - Avoid all .git directories 24 | getBlacklistRE() { 25 | return blacklist([]); 26 | }, 27 | 28 | // Any modules that are under react-native-github and we want 29 | // to be able to require from non-opensource code, need to be 30 | // listed here 31 | extraNodeModules: { 32 | fbjs: path.resolve(__dirname, "..", "..", "node_modules", "fbjs"), 33 | react: path.resolve(__dirname, "..", "..", "node_modules", "react"), 34 | "react-native": path.resolve( 35 | __dirname, 36 | "..", 37 | "..", 38 | "node_modules", 39 | "react-native" 40 | ), 41 | "react-native-dom": path.resolve(__dirname, "..", "..", "ReactDom", "index") 42 | }, 43 | 44 | getAssetExts() { 45 | return []; 46 | }, 47 | 48 | getPlatforms() { 49 | return ["dom"]; 50 | }, 51 | 52 | getProvidesModuleNodeModules() { 53 | return ["react-native"]; 54 | } 55 | }; 56 | 57 | function getRoots() { 58 | return [path.resolve(__dirname, "..", "..")]; 59 | } 60 | 61 | module.exports = config; 62 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Alert/RCTAlertManager.dom.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 RCTAlertManager 10 | * @flow 11 | */ 12 | "use strict"; 13 | 14 | var RCTAlertManager = require("NativeModules").AlertManager; 15 | 16 | module.exports = RCTAlertManager; 17 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/AccessibilityInfo/AccessibilityInfo.dom.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 AccessibilityInfo 10 | * @flow 11 | */ 12 | 13 | module.exports = {}; 14 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/AppleTV/TVEventHandler.dom.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( 17 | component: ?any, 18 | callback: Function 19 | ) {}; 20 | 21 | TVEventHandler.prototype.disable = function() {}; 22 | 23 | module.exports = TVEventHandler; 24 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/CheckBox/CheckBox.dom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2017-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 CheckBox 10 | * @flow 11 | */ 12 | "use strict"; 13 | 14 | module.exports = require("UnimplementedView"); 15 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/Clipboard/Clipboard.dom.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | // TODO: Replace with real implementation 4 | module.exports = { 5 | getString() { 6 | return Promise.resolve(""); 7 | }, 8 | setString(content: string) {} 9 | }; 10 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/DatePicker/DatePickerIOS.dom.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 DatePickerIOS 10 | * @flow 11 | */ 12 | 13 | module.exports = require("UnimplementedView"); 14 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/DatePickerAndroid/DatePickerAndroid.dom.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 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.dom.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 DrawerLayoutAndroid 10 | */ 11 | "use strict"; 12 | 13 | module.exports = require("UnimplementedView"); 14 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/MaskedView/MaskedViewIOS.dom.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 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/Navigation/NavigatorIOS.dom.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 NavigatorIOS 10 | */ 11 | "use strict"; 12 | 13 | module.exports = require("UnimplementedView"); 14 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/Picker/PickerAndroid.dom.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 PickerAndroid 10 | */ 11 | "use strict"; 12 | 13 | module.exports = require("UnimplementedView"); 14 | 15 | const UnimplementedView = require("UnimplementedView"); 16 | UnimplementedView.Item = require("UnimplementedView"); 17 | module.exports = UnimplementedView; 18 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/Picker/PickerIOS.dom.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 PickerIOS 10 | * 11 | * This is a controlled component version of RCTPickerIOS 12 | */ 13 | "use strict"; 14 | 15 | const UnimplementedView = require("UnimplementedView"); 16 | UnimplementedView.Item = require("UnimplementedView"); 17 | module.exports = UnimplementedView; 18 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.dom.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 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/ProgressViewIOS/ProgressViewIOS.dom.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 | // TODO: Remove when native module is implemented 13 | 14 | "use strict"; 15 | 16 | module.exports = require("UnimplementedView"); 17 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/SafeAreaView/SafeAreaView.dom.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 | * @format 12 | */ 13 | 14 | const React = require("React"); 15 | const ViewPropTypes = require("ViewPropTypes"); 16 | const requireNativeComponent = require("requireNativeComponent"); 17 | 18 | import type { ViewProps } from "ViewPropTypes"; 19 | 20 | type Props = ViewProps & { 21 | children: any 22 | }; 23 | 24 | /** 25 | * Renders nested content and automatically applies paddings reflect the portion of the view 26 | * that is not covered by navigation bars, tab bars, toolbars, and other ancestor views. 27 | * Moreover, and most importantly, Safe Area's paddings feflect physical limitation of the screen, 28 | * such as rounded corners or camera notches (aka sensor housing area on iPhone X). 29 | */ 30 | class SafeAreaView extends React.Component { 31 | static propTypes = { 32 | ...ViewPropTypes 33 | }; 34 | 35 | render() { 36 | return ; 37 | } 38 | } 39 | 40 | const RCTSafeAreaView = requireNativeComponent("RCTSafeAreaView", { 41 | name: "RCTSafeAreaView", 42 | displayName: "RCTSafeAreaView", 43 | propTypes: { 44 | ...ViewPropTypes 45 | } 46 | }); 47 | 48 | module.exports = SafeAreaView; 49 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/ScrollView/ScrollViewStickyHeader.dom.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 | * @providesModule ScrollViewStickyHeader 8 | * @flow 9 | * @format 10 | */ 11 | "use strict"; 12 | 13 | const AnimatedImplementation = require("AnimatedImplementation"); 14 | const React = require("React"); 15 | const StyleSheet = require("StyleSheet"); 16 | const View = require("View"); 17 | 18 | import type { LayoutEvent } from "CoreEventTypes"; 19 | 20 | type Props = { 21 | children?: React.Element, 22 | nextHeaderLayoutY: ?number, 23 | onLayout: (event: LayoutEvent) => void, 24 | scrollAnimatedValue: AnimatedImplementation.Value, 25 | // Will cause sticky headers to stick at the bottom of the ScrollView instead 26 | // of the top. 27 | inverted: ?boolean, 28 | // The height of the parent ScrollView. Currently only set when inverted. 29 | scrollViewHeight: ?number 30 | }; 31 | 32 | type State = {}; 33 | 34 | class ScrollViewStickyHeader extends React.Component { 35 | state = {}; 36 | 37 | render() { 38 | const { inverted, scrollViewHeight } = this.props; 39 | 40 | const child = React.Children.only(this.props.children); 41 | 42 | return ( 43 | 44 | {React.cloneElement(child, { 45 | style: styles.fill, // We transfer the child style to the wrapper. 46 | onLayout: undefined // we call this manually through our this._onLayout 47 | })} 48 | 49 | ); 50 | } 51 | } 52 | 53 | const styles = StyleSheet.create({ 54 | header: { 55 | zIndex: 10 56 | }, 57 | fill: { 58 | flex: 1 59 | } 60 | }); 61 | 62 | module.exports = ScrollViewStickyHeader; 63 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.dom.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 SegmentedControlIOS 10 | */ 11 | 12 | "use strict"; 13 | 14 | module.exports = require("UnimplementedView"); 15 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/Slider/Slider.dom.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 Slider 10 | * @flow 11 | */ 12 | 13 | "use strict"; 14 | 15 | module.exports = require("UnimplementedView"); 16 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/StatusBar/StatusBarIOS.dom.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 | const NativeEventEmitter = require("NativeEventEmitter"); 15 | 16 | module.exports = new NativeEventEmitter("StatusBarManager"); 17 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/TabBarIOS/TabBarIOS.dom.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 | * @flow 11 | */ 12 | 13 | "use strict"; 14 | 15 | const React = require("React"); 16 | const StyleSheet = require("StyleSheet"); 17 | const TabBarItemIOS = require("TabBarItemIOS"); 18 | const View = require("View"); 19 | 20 | class DummyTabBarIOS extends React.Component { 21 | static Item = TabBarItemIOS; 22 | 23 | render() { 24 | return ( 25 | 26 | {this.props.children} 27 | 28 | ); 29 | } 30 | } 31 | 32 | const styles = StyleSheet.create({ 33 | tabGroup: { 34 | flex: 1 35 | } 36 | }); 37 | 38 | module.exports = DummyTabBarIOS; 39 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/TabBarIOS/TabBarItemIOS.dom.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 TabBarItemIOS 10 | */ 11 | 12 | "use strict"; 13 | 14 | var React = require("React"); 15 | var View = require("View"); 16 | var StyleSheet = require("StyleSheet"); 17 | 18 | class DummyTab extends React.Component { 19 | render() { 20 | if (!this.props.selected) { 21 | return ; 22 | } 23 | return ( 24 | {this.props.children} 25 | ); 26 | } 27 | } 28 | 29 | var styles = StyleSheet.create({ 30 | tab: { 31 | // TODO(5405356): Implement overflow: visible so position: absolute isn't useless 32 | // position: 'absolute', 33 | top: 0, 34 | right: 0, 35 | bottom: 0, 36 | left: 0, 37 | borderColor: "red", 38 | borderWidth: 1 39 | } 40 | }); 41 | 42 | module.exports = DummyTab; 43 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/TextInput/TextInputState.dom.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 | * 8 | * This class is responsible for coordinating the "focused" 9 | * state for TextInputs. All calls relating to the keyboard 10 | * should be funneled through here 11 | * 12 | * @format 13 | * @flow 14 | */ 15 | 16 | "use strict"; 17 | 18 | const Platform = require("Platform"); 19 | const UIManager = require("UIManager"); 20 | 21 | let currentlyFocusedID: ?number = null; 22 | const inputs = new Set(); 23 | 24 | /** 25 | * Returns the ID of the currently focused text field, if one exists 26 | * If no text field is focused it returns null 27 | */ 28 | function currentlyFocusedField(): ?number { 29 | return currentlyFocusedID; 30 | } 31 | 32 | /** 33 | * @param {number} TextInputID id of the text field to focus 34 | * Focuses the specified text field 35 | * noop if the text field was already focused 36 | */ 37 | function focusTextInput(textFieldID: ?number) { 38 | if (currentlyFocusedID !== textFieldID && textFieldID !== null) { 39 | currentlyFocusedID = textFieldID; 40 | if (Platform.OS === "ios" || Platform.OS === "dom") { 41 | UIManager.focus(textFieldID); 42 | } else if (Platform.OS === "android") { 43 | UIManager.dispatchViewManagerCommand( 44 | textFieldID, 45 | UIManager.AndroidTextInput.Commands.focusTextInput, 46 | null 47 | ); 48 | } 49 | } 50 | } 51 | 52 | /** 53 | * @param {number} textFieldID id of the text field to unfocus 54 | * Unfocuses the specified text field 55 | * noop if it wasn't focused 56 | */ 57 | function blurTextInput(textFieldID: ?number) { 58 | if (currentlyFocusedID === textFieldID && textFieldID !== null) { 59 | currentlyFocusedID = null; 60 | if (Platform.OS === "ios" || Platform.OS === "dom") { 61 | UIManager.blur(textFieldID); 62 | } else if (Platform.OS === "android") { 63 | UIManager.dispatchViewManagerCommand( 64 | textFieldID, 65 | UIManager.AndroidTextInput.Commands.blurTextInput, 66 | null 67 | ); 68 | } 69 | } 70 | } 71 | 72 | function registerInput(textFieldID: number) { 73 | inputs.add(textFieldID); 74 | } 75 | 76 | function unregisterInput(textFieldID: number) { 77 | inputs.delete(textFieldID); 78 | } 79 | 80 | function isTextInput(textFieldID: number) { 81 | return inputs.has(textFieldID); 82 | } 83 | 84 | module.exports = { 85 | currentlyFocusedField, 86 | focusTextInput, 87 | blurTextInput, 88 | registerInput, 89 | unregisterInput, 90 | isTextInput 91 | }; 92 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/TimePickerAndroid/TimePickerAndroid.dom.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 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/ToastAndroid/ToastAndroid.dom.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 | * @noflow 11 | */ 12 | "use strict"; 13 | 14 | var warning = require("fbjs/lib/warning"); 15 | 16 | var ToastAndroid = { 17 | show: function(message: string, duration: number): void { 18 | warning(false, "ToastAndroid is not supported on this platform."); 19 | } 20 | }; 21 | 22 | module.exports = ToastAndroid; 23 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/ToolbarAndroid/ToolbarAndroid.dom.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 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/Touchable/TouchableNativeFeedback.dom.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 | "use strict"; 12 | 13 | module.exports = require("UnimplementedView"); 14 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/View/PlatformViewPropTypes.dom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule PlatformViewPropTypes 3 | * @flow 4 | */ 5 | 6 | module.exports = {}; 7 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Components/ViewPager/ViewPagerAndroid.dom.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 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Core/Devtools/setupDevtools.dom.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 setupDevtools 10 | * @flow 11 | */ 12 | "use strict"; 13 | 14 | type DevToolsPluginConnection = { 15 | isAppActive: () => boolean, 16 | host: string, 17 | port: number 18 | }; 19 | 20 | type DevToolsPlugin = { 21 | connectToDevTools: (connection: DevToolsPluginConnection) => void 22 | }; 23 | 24 | let register = function() { 25 | // noop 26 | }; 27 | 28 | if (__DEV__) { 29 | const AppState = require("AppState"); 30 | const WebSocket = require("WebSocket"); 31 | const { PlatformConstants } = require("NativeModules"); 32 | /* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an 33 | * error found when Flow v0.54 was deployed. To see the error delete this 34 | * comment and run Flow. */ 35 | const reactDevTools = require("react-devtools-core"); 36 | 37 | register = function(plugin: DevToolsPlugin) { 38 | // Initialize dev tools only if the native module for WebSocket is available 39 | if (self.__DEVTOOLS__ && WebSocket.isAvailable) { 40 | // Don't steal the DevTools from currently active app. 41 | // Note: if you add any AppState subscriptions to this file, 42 | // you will also need to guard against `AppState.isAvailable`, 43 | // or the code will throw for bundles that don't have it. 44 | const isAppActive = () => true; 45 | 46 | // Special case: Genymotion is running on a different host. 47 | const host = 48 | PlatformConstants && PlatformConstants.ServerHost 49 | ? PlatformConstants.ServerHost.split(":")[0] 50 | : "localhost"; 51 | 52 | plugin.connectToDevTools({ 53 | isAppActive, 54 | host, 55 | // Read the optional global variable for backward compatibility. 56 | // It was added in https://github.com/facebook/react-native/commit/bf2b435322e89d0aeee8792b1c6e04656c2719a0. 57 | port: window.__REACT_DEVTOOLS_PORT__, 58 | resolveRNStyle: require("flattenStyle") 59 | }); 60 | } 61 | }; 62 | 63 | register(reactDevTools); 64 | global.registerDevtoolsPlugin = register; 65 | } 66 | 67 | module.exports = { 68 | register 69 | }; 70 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/EventEmitter/NativeEventEmitter.dom.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 | * @providesModule NativeEventEmitter 8 | * @flow 9 | */ 10 | "use strict"; 11 | 12 | const EventEmitter = require("EventEmitter"); 13 | const Platform = require("Platform"); 14 | const RCTDeviceEventEmitter = require("RCTDeviceEventEmitter"); 15 | 16 | const invariant = require("fbjs/lib/invariant"); 17 | 18 | import type EmitterSubscription from "EmitterSubscription"; 19 | 20 | type NativeModule = { 21 | +addListener: (eventType: string) => void, 22 | +removeListeners: (count: number) => void 23 | }; 24 | 25 | /** 26 | * Abstract base class for implementing event-emitting modules. This implements 27 | * a subset of the standard EventEmitter node module API. 28 | */ 29 | class NativeEventEmitter extends EventEmitter { 30 | _nativeModule: ?NativeModule; 31 | 32 | constructor(nativeModule: ?NativeModule) { 33 | super(RCTDeviceEventEmitter.sharedSubscriber); 34 | if (Platform.OS === "ios" || Platform.OS === "dom") { 35 | invariant(nativeModule, "Native module cannot be null."); 36 | this._nativeModule = nativeModule; 37 | } 38 | } 39 | 40 | addListener( 41 | eventType: string, 42 | listener: Function, 43 | context: ?Object 44 | ): EmitterSubscription { 45 | if (this._nativeModule != null) { 46 | this._nativeModule.addListener(eventType); 47 | } 48 | return super.addListener(eventType, listener, context); 49 | } 50 | 51 | removeAllListeners(eventType: string) { 52 | invariant(eventType, "eventType argument is required."); 53 | const count = this.listeners(eventType).length; 54 | if (this._nativeModule != null) { 55 | this._nativeModule.removeListeners(count); 56 | } 57 | super.removeAllListeners(eventType); 58 | } 59 | 60 | removeSubscription(subscription: EmitterSubscription) { 61 | if (this._nativeModule != null) { 62 | this._nativeModule.removeListeners(1); 63 | } 64 | super.removeSubscription(subscription); 65 | } 66 | } 67 | 68 | module.exports = NativeEventEmitter; 69 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/RCTTest/SnapshotViewIOS.dom.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 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Settings/Settings.dom.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 Web"); 17 | return null; 18 | }, 19 | 20 | set(settings: Object) { 21 | console.warn("Settings is not yet supported on Web"); 22 | }, 23 | 24 | watchKeys(keys: string | Array, callback: Function): number { 25 | console.warn("Settings is not yet supported on Web"); 26 | return -1; 27 | }, 28 | 29 | clearWatch(watchId: number) { 30 | console.warn("Settings is not yet supported on Web"); 31 | } 32 | }; 33 | 34 | module.exports = Settings; 35 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Utilities/HMRLoadingView.dom.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 HMRLoadingView 10 | * @flow 11 | */ 12 | 13 | "use strict"; 14 | 15 | const processColor = require("processColor"); 16 | const { DevLoadingView } = require("NativeModules"); 17 | 18 | class HMRLoadingView { 19 | static showMessage(message: string) { 20 | DevLoadingView.showMessage( 21 | message, 22 | processColor("#000000"), 23 | processColor("#aaaaaa") 24 | ); 25 | } 26 | 27 | static hide() { 28 | DevLoadingView.hide(); 29 | } 30 | } 31 | 32 | module.exports = HMRLoadingView; 33 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Utilities/Platform.dom.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 Platform 10 | * @flow 11 | */ 12 | 13 | "use strict"; 14 | 15 | const NativeModules = require("NativeModules"); 16 | 17 | const Platform = { 18 | OS: "dom", 19 | get ForceTouchAvailable() { 20 | const constants = NativeModules.PlatformConstants; 21 | return constants ? !!constants.forceTouchAvailable : false; 22 | }, 23 | select: (obj: Object) => ("dom" in obj ? obj.dom : obj.default) 24 | }; 25 | 26 | module.exports = Platform; 27 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/Vibration/VibrationIOS.dom.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 | -------------------------------------------------------------------------------- /packages/react-native-dom/Libraries/polyfills/setBabelHelper.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 | * @polyfill 10 | */ 11 | 12 | /* eslint-disable */ 13 | 14 | var babelHelpers = global.babelHelpers || {}; 15 | 16 | babelHelpers.set = function set(object, property, value, receiver) { 17 | var desc = Object.getOwnPropertyDescriptor(object, property); 18 | if (desc === undefined) { 19 | var parent = Object.getPrototypeOf(object); 20 | if (parent !== null) { 21 | set(parent, property, value, receiver); 22 | } 23 | } else if ("value" in desc && desc.writable) { 24 | desc.value = value; 25 | } else { 26 | var setter = desc.set; 27 | if (setter !== undefined) { 28 | setter.call(receiver, value); 29 | } 30 | } 31 | return value; 32 | }; 33 | 34 | global.babelHelpers = babelHelpers; 35 | -------------------------------------------------------------------------------- /packages/react-native-dom/README.md: -------------------------------------------------------------------------------- 1 | # React Native DOM 2 | 3 | Documentation for the framework as a whole can be found at the root Readme of 4 | this monorepo. 5 | -------------------------------------------------------------------------------- /packages/react-native-dom/RNTester.md: -------------------------------------------------------------------------------- 1 | ### Update the `RNTester` branch 2 | 3 | The same example apps from `react-native` are also available for 4 | `react-native-dom`, including the 5 | [RNTester](https://github.com/facebook/react-native/tree/master/Examples/UIExplorer). 6 | 7 | We maintain a fork of the `RNTester` folder from `react-native` as a submodule 8 | of `react-native-dom`. The fork uses `git filter-branch` to produce a branch of 9 | `react-native` that includes only the content of the Examples folder. We then 10 | merge all the changes specific to `react-native-dom` with that filtered branch. 11 | 12 | ```bash 13 | # Be sure that you have all submodules initialized and up-to-date for react-native-dom. 14 | cd RNTester 15 | 16 | # If you don't already have facebook/react-native set up as a Git remote... 17 | git remote add facebook git@github.com:facebook/react-native 18 | 19 | # Fetch the latest from facebook 20 | git fetch facebook 21 | 22 | # Create a new branch to run the `filter-branch` command only 23 | git checkout -b fbmaster facebook/master 24 | 25 | # Filter the react-native master branch for Examples only, this will take some time 26 | # You may have to use `-f` if you've previously run a `filter-branch` command 27 | git filter-branch --prune-empty --subdirectory-filter RNTester fbmaster 28 | 29 | # Fetch the latest from react-native-dom 30 | git fetch origin 31 | 32 | # Create a new staging branch to perform a merge onto the react-native-dom `examples` branch 33 | git checkout -b staging origin/rntester 34 | 35 | # Merge the latest from facebook/react-native RNTester and resolve any merge conflicts 36 | git merge fbmaster 37 | 38 | # Fast-forward the `rntester` branch from the `staging` branch 39 | # Before doing this, it's probably a good idea to test that the examples are working by running them 40 | # If anything has broken (it's common), fix it 41 | git checkout rntester 42 | git merge staging 43 | 44 | # Use the RNTester to test changes before pushing to react-native-dom 45 | 46 | # Push (or PR) your changes to react-native-dom 47 | git push origin rntester 48 | 49 | # Cleanup your staging branches 50 | git branch -D fbmaster 51 | git branch -D staging 52 | ``` 53 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/DevSupport/RCTDevMenu.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import RCTModule from "RCTModule"; 4 | import type RCTBridge from "RCTBridge"; 5 | 6 | class RCTDevMenu extends RCTModule { 7 | static moduleName = "RCTDevMenu"; 8 | 9 | constructor(bridge: RCTBridge) { 10 | super(bridge); 11 | this.bridge = bridge; 12 | document.addEventListener("keydown", this.handleKeyPress.bind(this)); 13 | } 14 | 15 | handleKeyPress(event: KeyboardEvent) { 16 | // toggling the inspector 17 | if (event.metaKey && event.key === "i") { 18 | event.preventDefault(); 19 | this.bridge.devSettings.$toggleElementInspector(); 20 | } 21 | } 22 | } 23 | 24 | export default RCTDevMenu; 25 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/base/NotificationCenter.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | import EventEmitter from "wolfy87-eventemitter"; 3 | 4 | class NotificationCenter extends EventEmitter {} 5 | 6 | export default new NotificationCenter(); 7 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/base/UIChildContainerView.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | import prefixInlineStyles from "prefixInlineStyles"; 3 | 4 | class UIChildContainerView extends HTMLElement { 5 | constructor() { 6 | super(); 7 | Object.assign( 8 | this.style, 9 | prefixInlineStyles({ 10 | contain: "layout style size", 11 | position: "absolute", 12 | top: "0", 13 | left: "0", 14 | userSelect: "inherit", 15 | transformOrigin: "top left", 16 | pointerEvents: "unset" 17 | }) 18 | ); 19 | } 20 | 21 | updateDimensions(width: number, height: number) { 22 | this.style.width = `${width}px`; 23 | this.style.height = `${height}px`; 24 | } 25 | } 26 | 27 | customElements.define("ui-child-container-view", UIChildContainerView); 28 | 29 | export default UIChildContainerView; 30 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/base/UIHitSlopView.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import prefixInlineStyles from "prefixInlineStyles"; 4 | import type UIView from "UIView"; 5 | 6 | export type HitSlop = { 7 | top?: number, 8 | bottom?: number, 9 | left?: number, 10 | right?: number 11 | }; 12 | 13 | class UIHitSlopView extends HTMLElement { 14 | static defaultHitSlop: HitSlop = { 15 | top: 0, 16 | bottom: 0, 17 | left: 0, 18 | right: 0 19 | }; 20 | 21 | viewOwner: UIView; 22 | 23 | constructor(viewOwner: UIView, touchable: boolean) { 24 | super(); 25 | 26 | this.viewOwner = viewOwner; 27 | this.touchable = touchable; 28 | 29 | Object.assign( 30 | this.style, 31 | prefixInlineStyles({ 32 | contain: "strict", 33 | position: "absolute" 34 | }) 35 | ); 36 | } 37 | 38 | set slop(value: HitSlop) { 39 | const resolvedValue = Object.entries({ 40 | ...UIHitSlopView.defaultHitSlop, 41 | ...value 42 | }).reduce( 43 | (acc, cur: any) => ({ 44 | ...acc, 45 | [cur[0]]: `${-1 * cur[1]}px` 46 | }), 47 | {} 48 | ); 49 | 50 | Object.assign(this.style, resolvedValue); 51 | } 52 | 53 | set touchable(value: boolean) { 54 | this.style.cursor = value ? "pointer" : "auto"; 55 | } 56 | } 57 | 58 | customElements.define("ui-hit-slop-view", UIHitSlopView); 59 | 60 | export default UIHitSlopView; 61 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/bridge/RCTBridgeMethod.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | import type RCTBridge from "RCTBridge"; 3 | 4 | export const RCTFunctionTypeNormal = "async"; 5 | export const RCTFunctionTypePromise = "promise"; 6 | export const RCTFunctionTypeSync = "sync"; 7 | 8 | export type RCTFunctionType = string; 9 | 10 | export interface RCTBridgeMethod { 11 | jsMethodName: string; 12 | functionType: RCTFunctionType; 13 | invokeWithBridge: ( 14 | bridge: RCTBridge, 15 | module: any, 16 | arguments: Array 17 | ) => any; 18 | } 19 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/bridge/RCTModuleConfig.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type { ModuleDescription, Constants } from "RCTModule"; 4 | 5 | export function moduleConfigFactory( 6 | name: string, 7 | constants: Constants, 8 | functions: Array, 9 | promiseMethodIDs: Array, 10 | syncMethodIDs: Array 11 | ): ModuleDescription { 12 | return [name, constants, functions, promiseMethodIDs, syncMethodIDs]; 13 | } 14 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/defs/InternalLib.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | export type Frame = { 4 | top: number, 5 | left: number, 6 | width: number, 7 | height: number 8 | }; 9 | 10 | export type Size = { 11 | width: number, 12 | height: number 13 | }; 14 | 15 | export type Position = { 16 | x: number, 17 | y: number 18 | }; 19 | 20 | export type Inset = { 21 | top: number, 22 | left: number, 23 | bottom: number, 24 | right: number 25 | }; 26 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/LayoutAnimation/__tests__/keyframeGenerator.test.js: -------------------------------------------------------------------------------- 1 | import RCTKeyframeGenerator from "RCTKeyframeGenerator"; 2 | 3 | test("generates tranditional easing function keyframes", () => { 4 | const linear = RCTKeyframeGenerator( 5 | { 6 | type: "linear" 7 | }, 8 | 1000 9 | ); 10 | expect(linear).toMatchSnapshot(); 11 | 12 | const easeIn = RCTKeyframeGenerator( 13 | { 14 | type: "easeIn" 15 | }, 16 | 1000 17 | ); 18 | expect(easeIn).toMatchSnapshot(); 19 | 20 | const easeOut = RCTKeyframeGenerator( 21 | { 22 | type: "easeOut" 23 | }, 24 | 1000 25 | ); 26 | expect(easeOut).toMatchSnapshot(); 27 | 28 | const easeInEaseOut = RCTKeyframeGenerator( 29 | { 30 | type: "easeInEaseOut" 31 | }, 32 | 1000 33 | ); 34 | expect(easeInEaseOut).toMatchSnapshot(); 35 | }); 36 | 37 | test("generates spring keyframes without initialVelocity", () => { 38 | const springWithoutVelocity = RCTKeyframeGenerator({ 39 | type: "spring", 40 | springDamping: 0.5 41 | }); 42 | expect(springWithoutVelocity).toMatchSnapshot(); 43 | }); 44 | 45 | test("generates spring keyframes with negative initialVelocity", () => { 46 | const springWithVelocity = RCTKeyframeGenerator({ 47 | type: "spring", 48 | springDamping: 0.5, 49 | initialVelocity: -50 50 | }); 51 | expect(springWithVelocity).toMatchSnapshot(); 52 | }); 53 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/NativeAnimation/Drivers/RCTAnimationDriver.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type RCTValueAnimatedNode from "RCTValueAnimatedNode"; 4 | import type RCTNativeAnimatedNodesManager from "RCTNativeAnimatedNodesManager"; 5 | import type { Config } from "RCTNativeAnimatedModule"; 6 | 7 | export interface RCTAnimationDriver { 8 | animationId: number; 9 | valueNode: RCTValueAnimatedNode; 10 | animationHasBegun: boolean; 11 | animationHasFinished: boolean; 12 | 13 | constructor( 14 | animationId: number, 15 | config: Config, 16 | valueNode: RCTValueAnimatedNode, 17 | callback: ?Function 18 | ): RCTAnimationDriver; 19 | 20 | startAnimation(): void; 21 | stepAnimationWithTime(currentTime: number): void; 22 | stopAnimation(): void; 23 | } 24 | 25 | export const RCTSingleFrameInterval = 16.667; 26 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/NativeAnimation/Drivers/RCTEventAnimation.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type RCTValueAnimatedNode from "RCTValueAnimatedNode"; 4 | import type { RCTEvent } from "RCTEventDispatcher"; 5 | 6 | class RCTEventAnimation { 7 | eventPath: string[]; 8 | valueNode: RCTValueAnimatedNode; 9 | 10 | constructor(eventPath: string[], valueNode: RCTValueAnimatedNode) { 11 | this.eventPath = eventPath; 12 | this.valueNode = valueNode; 13 | } 14 | 15 | updateWithEvent(event: RCTEvent) { 16 | const args = event.arguments(); 17 | // Supported events args are in the following order: viewTag, eventName, eventData. 18 | let currentValue = args[2]; 19 | for (let key of this.eventPath) { 20 | currentValue = currentValue[key]; 21 | } 22 | 23 | this.valueNode.value = currentValue; 24 | this.valueNode.setNeedsUpdate(); 25 | } 26 | } 27 | 28 | export default RCTEventAnimation; 29 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/NativeAnimation/Nodes/RCTAdditionAnimatedNode.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import RCTValueAnimatedNode from "RCTValueAnimatedNode"; 4 | 5 | class RCTAdditionAnimatedNode extends RCTValueAnimatedNode { 6 | performUpdate() { 7 | super.performUpdate(); 8 | 9 | const parentNodes = this.parentNodes; 10 | if (!parentNodes) { 11 | return; 12 | } 13 | 14 | const inputNodes: ?(number[]) = this.config.input; 15 | if (inputNodes && inputNodes.length > 1) { 16 | const parent1 = parentNodes[inputNodes[0]]; 17 | const parent2 = parentNodes[inputNodes[1]]; 18 | if ( 19 | parent1 instanceof RCTValueAnimatedNode && 20 | parent2 instanceof RCTValueAnimatedNode 21 | ) { 22 | this.value = parent1.value + parent2.value; 23 | } 24 | } 25 | } 26 | } 27 | 28 | export default RCTAdditionAnimatedNode; 29 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import invariant from "invariant"; 4 | 5 | import type RCTAnimatedNode from "RCTAnimatedNode"; 6 | import RCTValueAnimatedNode from "RCTValueAnimatedNode"; 7 | 8 | class RCTDiffClampAnimatedNode extends RCTValueAnimatedNode { 9 | inputNodeTag: number; 10 | min: number; 11 | max: number; 12 | lastValue: ?number; 13 | 14 | constructor(tag: number, config: Object) { 15 | super(tag, config); 16 | this.inputNodeTag = config.input; 17 | this.min = config.min; 18 | this.max = config.max; 19 | } 20 | 21 | onAttachedToNode(parent: RCTAnimatedNode) { 22 | super.onAttachedToNode(parent); 23 | this.value = this.lastValue = this.inputNodeValue; 24 | } 25 | 26 | performUpdate() { 27 | super.performUpdate(); 28 | 29 | const lastValue = this.lastValue ? this.lastValue : 0; 30 | const value = this.inputNodeValue; 31 | 32 | const diff = value - lastValue; 33 | this.lastValue = value; 34 | this.value = Math.min(Math.max(this.value + diff, this.min), this.max); 35 | } 36 | 37 | get inputNodeValue(): number { 38 | invariant(this.parentNodes, `diffClamp node has no parents`); 39 | const inputNode = this.parentNodes[this.inputNodeTag]; 40 | if (!(inputNode instanceof RCTValueAnimatedNode)) { 41 | console.error( 42 | "Illegal node ID set as an input for Animated.DiffClamp node" 43 | ); 44 | return 0; 45 | } 46 | return inputNode.value; 47 | } 48 | } 49 | 50 | export default RCTDiffClampAnimatedNode; 51 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/NativeAnimation/Nodes/RCTDivisionAnimatedNode.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import RCTValueAnimatedNode from "RCTValueAnimatedNode"; 4 | 5 | class RCTDivisionAnimatedNode extends RCTValueAnimatedNode { 6 | performUpdate() { 7 | super.performUpdate(); 8 | 9 | const inputNodes: number[] = this.config.input; 10 | if (inputNodes.length > 1) { 11 | const parentNodes = this.parentNodes; 12 | if (!parentNodes) return; 13 | 14 | const parent1 = parentNodes[inputNodes[0]]; 15 | const parent2 = parentNodes[inputNodes[2]]; 16 | 17 | if ( 18 | parent1 instanceof RCTValueAnimatedNode && 19 | parent2 instanceof RCTValueAnimatedNode 20 | ) { 21 | if (parent2.value === 0) { 22 | console.error("Detected a division by zero in Animated.divide node"); 23 | return; 24 | } 25 | this.value = parent1.value / parent2.value; 26 | } 27 | } 28 | } 29 | } 30 | 31 | export default RCTDivisionAnimatedNode; 32 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type { Config } from "RCTNativeAnimatedModule"; 4 | import type RCTAnimatedNode from "RCTAnimatedNode"; 5 | import RCTValueAnimatedNode from "RCTValueAnimatedNode"; 6 | import { RCTInterpolateValueInRange } from "RCTAnimationUtils"; 7 | 8 | class RCTInterpolationAnimatedNode extends RCTValueAnimatedNode { 9 | parentNode: ?RCTValueAnimatedNode; 10 | inputRange: number[]; 11 | outputRange: number[]; 12 | extrapolateLeft: string; 13 | extrapolateRight: string; 14 | 15 | constructor(tag: number, config: Config) { 16 | super(tag, config); 17 | 18 | this.inputRange = [...config.inputRange]; 19 | this.outputRange = []; 20 | for (let value of config.outputRange) { 21 | if (typeof value === "number") { 22 | this.outputRange.push(value); 23 | } 24 | } 25 | this.extrapolateLeft = config.extrapolateLeft; 26 | this.extrapolateRight = config.extrapolateRight; 27 | } 28 | 29 | onAttachedToNode(parent: RCTAnimatedNode) { 30 | super.onAttachedToNode(parent); 31 | if (parent instanceof RCTValueAnimatedNode) { 32 | this.parentNode = parent; 33 | } 34 | } 35 | 36 | onDetachedFromNode(parent: RCTAnimatedNode) { 37 | super.onDetachedFromNode(parent); 38 | if (this.parentNode === parent) { 39 | this.parentNode = null; 40 | } 41 | } 42 | 43 | performUpdate() { 44 | super.performUpdate(); 45 | 46 | const parentNode = this.parentNode; 47 | if (!parentNode) { 48 | return; 49 | } 50 | 51 | const inputValue = parentNode.value; 52 | 53 | const outputValue = RCTInterpolateValueInRange( 54 | inputValue, 55 | this.inputRange, 56 | this.outputRange, 57 | this.extrapolateLeft, 58 | this.extrapolateRight 59 | ); 60 | 61 | this._value = outputValue; 62 | } 63 | } 64 | 65 | export default RCTInterpolationAnimatedNode; 66 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/NativeAnimation/Nodes/RCTModuloAnimatedNode.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import invariant from "invariant"; 4 | 5 | import RCTValueAnimatedNode from "RCTValueAnimatedNode"; 6 | 7 | class RCTModuloAnimatedNode extends RCTValueAnimatedNode { 8 | performUpdate() { 9 | super.performUpdate(); 10 | const inputNode = this.config.input; 11 | const modulus = this.config.modulus; 12 | if (this.parentNodes) { 13 | const parent = this.parentNodes[inputNode]; 14 | invariant( 15 | parent instanceof RCTValueAnimatedNode, 16 | "Parent AnimatedNode must be an RCTValueAnimatedNode" 17 | ); 18 | this.value = parent.value % modulus; 19 | } 20 | } 21 | } 22 | 23 | export default RCTModuloAnimatedNode; 24 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import RCTValueAnimatedNode from "RCTValueAnimatedNode"; 4 | 5 | class RCTMultiplicationAnimatedNode extends RCTValueAnimatedNode { 6 | performUpdate() { 7 | super.performUpdate(); 8 | 9 | const parentNodes = this.parentNodes; 10 | if (!parentNodes) { 11 | return; 12 | } 13 | 14 | const inputNodes: ?(number[]) = this.config.input; 15 | if (inputNodes && inputNodes.length > 1) { 16 | const parent1 = parentNodes[inputNodes[0]]; 17 | const parent2 = parentNodes[inputNodes[1]]; 18 | if ( 19 | parent1 instanceof RCTValueAnimatedNode && 20 | parent2 instanceof RCTValueAnimatedNode 21 | ) { 22 | this.value = parent1.value * parent2.value; 23 | } 24 | } 25 | } 26 | } 27 | 28 | export default RCTMultiplicationAnimatedNode; 29 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/NativeAnimation/Nodes/RCTStyleAnimatedNode.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type { Config } from "RCTNativeAnimatedModule"; 4 | import RCTTransformAnimatedNode from "RCTTransformAnimatedNode"; 5 | import RCTValueAnimatedNode from "RCTValueAnimatedNode"; 6 | import RCTAnimatedNode from "RCTAnimatedNode"; 7 | 8 | class RCTStyleAnimatedNode extends RCTAnimatedNode { 9 | propsDictionary: { [propName: string]: any }; 10 | 11 | constructor(tag: number, config: Config) { 12 | super(tag, config); 13 | this.propsDictionary = {}; 14 | } 15 | 16 | performUpdate() { 17 | super.performUpdate(); 18 | 19 | const style: { [propName: string]: any } = this.config.style; 20 | Object.entries(style).forEach(([property, nodeTag]) => { 21 | if (this.parentNodes) { 22 | // $FlowFixMe - Object.entries incorrectly sets value to mixed 23 | const node: RCTAnimatedNode = this.parentNodes[nodeTag]; 24 | if (node) { 25 | if (node instanceof RCTValueAnimatedNode) { 26 | this.propsDictionary[property] = node.value; 27 | } else if (node instanceof RCTTransformAnimatedNode) { 28 | this.propsDictionary = { 29 | ...this.propsDictionary, 30 | ...node.propsDictionary 31 | }; 32 | } 33 | } 34 | } 35 | }); 36 | } 37 | } 38 | 39 | export default RCTStyleAnimatedNode; 40 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import RCTValueAnimatedNode from "RCTValueAnimatedNode"; 4 | 5 | class RCTSubtractionAnimatedNode extends RCTValueAnimatedNode { 6 | performUpdate() { 7 | super.performUpdate(); 8 | 9 | const parentNodes = this.parentNodes; 10 | if (!parentNodes) { 11 | return; 12 | } 13 | 14 | const inputNodes: ?(number[]) = this.config.input; 15 | if (inputNodes && inputNodes.length > 1) { 16 | const parent1 = parentNodes[inputNodes[0]]; 17 | const parent2 = parentNodes[inputNodes[1]]; 18 | if ( 19 | parent1 instanceof RCTValueAnimatedNode && 20 | parent2 instanceof RCTValueAnimatedNode 21 | ) { 22 | this.value = parent1.value - parent2.value; 23 | } 24 | } 25 | } 26 | } 27 | 28 | export default RCTSubtractionAnimatedNode; 29 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/NativeAnimation/Nodes/RCTTrackingAnimatedNode.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import invariant from "invariant"; 4 | 5 | import type { Config } from "RCTNativeAnimatedModule"; 6 | import RCTValueAnimatedNode from "RCTValueAnimatedNode"; 7 | import RCTAnimatedNode from "RCTAnimatedNode"; 8 | 9 | class RCTTrackingAnimatedNode extends RCTAnimatedNode { 10 | animationId: number; 11 | toValueNodeTag: number; 12 | valueNodeTag: number; 13 | animationConfig: Object; 14 | 15 | constructor(tag: number, config: Config) { 16 | super(tag, config); 17 | 18 | this.animationId = config.animationId; 19 | this.toValueNodeTag = config.toValue; 20 | this.valueNodeTag = config.value; 21 | this.animationConfig = config.animationConfig; 22 | } 23 | 24 | onDetachedFromNode(parent: RCTAnimatedNode) { 25 | this.manager.stopAnimation(this.animationId); 26 | super.onDetachedFromNode(parent); 27 | } 28 | 29 | performUpdate() { 30 | super.performUpdate(); 31 | 32 | const parentNodes = this.parentNodes; 33 | invariant(parentNodes, `No parent nodes in TrackingAnimatedNode`); 34 | 35 | // change animation config's "toValue" to reflect updated value of the parent node 36 | const node: RCTValueAnimatedNode = (parentNodes[this.toValueNodeTag]: any); 37 | this.animationConfig.toValue = node.value; 38 | 39 | this.manager.startAnimatingNode( 40 | this.animationId, 41 | this.valueNodeTag, 42 | this.animationConfig, 43 | null 44 | ); 45 | } 46 | } 47 | 48 | export default RCTTrackingAnimatedNode; 49 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/NativeAnimation/Nodes/RCTTransformAnimatedNode.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type { Config } from "RCTNativeAnimatedModule"; 4 | import RCTValueAnimatedNode from "RCTValueAnimatedNode"; 5 | import RCTAnimatedNode from "RCTAnimatedNode"; 6 | 7 | class RCTTransformAnimatedNode extends RCTAnimatedNode { 8 | propsDictionary: { [propName: string]: any }; 9 | 10 | constructor(tag: number, config: Config) { 11 | super(tag, config); 12 | this.propsDictionary = {}; 13 | } 14 | 15 | performUpdate() { 16 | super.performUpdate(); 17 | 18 | const transformConfigs = this.config.transforms; 19 | const transform = []; 20 | 21 | for (let transformConfig of transformConfigs) { 22 | const type = transformConfig.type; 23 | const property = transformConfig.property; 24 | 25 | let value; 26 | if (type === "animated") { 27 | const nodeTag = transformConfig.nodeTag; 28 | const node = this.parentNodes ? this.parentNodes[nodeTag] : null; 29 | if (!(node instanceof RCTValueAnimatedNode)) { 30 | continue; 31 | } 32 | value = node.value; 33 | } else { 34 | value = transformConfig.value; 35 | } 36 | transform.push({ [property]: value }); 37 | } 38 | 39 | this.propsDictionary.animatedTransform = transform; 40 | } 41 | } 42 | 43 | export default RCTTransformAnimatedNode; 44 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/NativeAnimation/Nodes/RCTValueAnimatedNode.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type { Config } from "RCTNativeAnimatedModule"; 4 | import RCTAnimatedNode from "RCTAnimatedNode"; 5 | 6 | export interface RCTValueAnimatedNodeObserver { 7 | animatedNodeDidUpdateValue(node: RCTValueAnimatedNode, value: number): void; 8 | } 9 | 10 | class RCTValueAnimatedNode extends RCTAnimatedNode { 11 | _offset: number; 12 | _value: number; 13 | 14 | valueObserver: ?RCTValueAnimatedNodeObserver; 15 | 16 | constructor(tag: number, config: Config) { 17 | super(tag, config); 18 | this._offset = this.config.offset || 0; 19 | this._value = this.config.value; 20 | } 21 | 22 | flattenOffset() { 23 | this._value += this._offset; 24 | this._offset = 0; 25 | } 26 | 27 | extractOffset() { 28 | this._offset += this._value; 29 | this._value = 0; 30 | } 31 | 32 | get offset(): number { 33 | return this._offset; 34 | } 35 | 36 | set offset(value: number) { 37 | this._offset = value; 38 | } 39 | 40 | get value(): number { 41 | return this._value + this._offset; 42 | } 43 | 44 | set value(value: number) { 45 | this._value = value; 46 | 47 | if (this.valueObserver) { 48 | this.valueObserver.animatedNodeDidUpdateValue(this, this._value); 49 | } 50 | } 51 | } 52 | 53 | export default RCTValueAnimatedNode; 54 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/NativeAnimation/RCTAnimationUtils.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | export const EXTRAPOLATE_TYPE_IDENTITY = "identity"; 4 | export const EXTRAPOLATE_TYPE_CLAMP = "clamp"; 5 | export const EXTRAPOLATE_TYPE_EXTEND = "extend"; 6 | 7 | function RCTFindIndexOfNearestValue(value: number, range: number[]) { 8 | let index; 9 | const rangeCount = range.length; 10 | for (index = 1; index < rangeCount - 1; index++) { 11 | const inputValue = range[index]; 12 | if (inputValue >= value) { 13 | break; 14 | } 15 | } 16 | return index - 1; 17 | } 18 | 19 | export function RCTInterpolateValue( 20 | value: number, 21 | inputMin: number, 22 | inputMax: number, 23 | outputMin: number, 24 | outputMax: number, 25 | extrapolateLeft: string, 26 | extrapolateRight: string 27 | ) { 28 | if (value < inputMin) { 29 | if (extrapolateLeft === "identity") { 30 | return value; 31 | } else if (extrapolateLeft === "clamp") { 32 | value = inputMin; 33 | } else if (extrapolateLeft === "extend") { 34 | // noop 35 | } else { 36 | throw new Error( 37 | `Invalid extrapolation type ${extrapolateLeft} for left extrapolation` 38 | ); 39 | } 40 | } 41 | 42 | if (value > inputMax) { 43 | if (extrapolateRight === "identity") { 44 | return value; 45 | } else if (extrapolateRight === "clamp") { 46 | value = inputMax; 47 | } else if (extrapolateRight === "extend") { 48 | // noop 49 | } else { 50 | throw new Error( 51 | `Invalid extrapolation type ${extrapolateRight} for right extrapolation` 52 | ); 53 | } 54 | } 55 | 56 | return ( 57 | outputMin + 58 | ((value - inputMin) * (outputMax - outputMin)) / (inputMax - inputMin) 59 | ); 60 | } 61 | 62 | export function RCTInterpolateValueInRange( 63 | value: number, 64 | inputRange: number[], 65 | outputRange: number[], 66 | extrapolateLeft: string, 67 | extrapolateRight: string 68 | ) { 69 | const rangeIndex = RCTFindIndexOfNearestValue(value, inputRange); 70 | const inputMin = inputRange[rangeIndex]; 71 | const inputMax = inputRange[rangeIndex + 1]; 72 | const outputMin = outputRange[rangeIndex]; 73 | const outputMax = outputRange[rangeIndex + 1]; 74 | 75 | const output = RCTInterpolateValue( 76 | value, 77 | inputMin, 78 | inputMax, 79 | outputMin, 80 | outputMax, 81 | extrapolateLeft, 82 | extrapolateRight 83 | ); 84 | 85 | return output; 86 | } 87 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/RCTAppState.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type RCTBridge from "RCTBridge"; 4 | import RCTEventEmitter from "RCTNativeEventEmitter"; 5 | 6 | let hidden, visibilityChange; 7 | if (typeof document.hidden !== "undefined") { 8 | // Opera 12.10 and Firefox 18 and later support 9 | hidden = "hidden"; 10 | visibilityChange = "visibilitychange"; 11 | // $FlowFixMe: libdef 12 | } else if (typeof document.msHidden !== "undefined") { 13 | hidden = "msHidden"; 14 | visibilityChange = "msvisibilitychange"; 15 | // $FlowFixMe: libdef 16 | } else if (typeof document.webkitHidden !== "undefined") { 17 | hidden = "webkitHidden"; 18 | visibilityChange = "webkitvisibilitychange"; 19 | } 20 | 21 | class RCTAppState extends RCTEventEmitter { 22 | static moduleName = "RCTAppState"; 23 | 24 | startObserving() { 25 | document.addEventListener( 26 | visibilityChange, 27 | this.didUpdateVisibility, 28 | false 29 | ); 30 | } 31 | 32 | stopObserving() { 33 | document.removeEventListener( 34 | visibilityChange, 35 | this.didUpdateVisibility, 36 | false 37 | ); 38 | } 39 | 40 | currentBackgroundState() { 41 | // $FlowFixMe 42 | if (document[hidden] == null) { 43 | return "unknown"; 44 | } 45 | if (document[hidden]) { 46 | return "background"; 47 | } 48 | return "active"; 49 | } 50 | 51 | constantsToExport() { 52 | return { 53 | initialAppState: this.currentBackgroundState() 54 | }; 55 | } 56 | 57 | supportedEvents() { 58 | return ["appStateDidChange"]; 59 | } 60 | 61 | didUpdateVisibility = () => { 62 | this.bridge.uiManager.requestTick(); 63 | this.sendEventWithName("appStateDidChange", { 64 | app_state: this.currentBackgroundState() 65 | }); 66 | }; 67 | 68 | $getCurrentAppState(callbackId: number) { 69 | this.bridge.callbackFromId(callbackId)({ 70 | app_state: this.currentBackgroundState() 71 | }); 72 | } 73 | } 74 | 75 | export default RCTAppState; 76 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/RCTAsyncLocalStorage.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import * as idbKeyval from "idb-keyval"; 4 | import deepmerge from "deepmerge"; 5 | 6 | import RCTModule from "RCTModule"; 7 | import type RCTBridge from "RCTBridge"; 8 | 9 | class RCTAsyncLocalStorage extends RCTModule { 10 | static moduleName = "RCTAsyncLocalStorage"; 11 | 12 | $multiGet(keys: string[], callbackId: number) { 13 | const callback = this.bridge.callbackFromId(callbackId); 14 | Promise.all( 15 | keys.map((key) => { 16 | return idbKeyval.get(key); 17 | }) 18 | ) 19 | .then((result) => { 20 | callback(null, result.map((value, index) => [keys[index], value])); 21 | }) 22 | .catch((err) => { 23 | callback(err); 24 | }); 25 | } 26 | 27 | $multiMerge(kvPairs: [string, any][], callbackId: number) { 28 | const callback = this.bridge.callbackFromId(callbackId); 29 | Promise.all( 30 | kvPairs.map(([key, prevValue]) => { 31 | return idbKeyval.get(key).then((nextValue) => { 32 | if (nextValue == null || typeof nextValue !== "object") { 33 | return idbKeyval.set(key, prevValue); 34 | } 35 | return idbKeyval.set(key, deepmerge(prevValue, nextValue)); 36 | }); 37 | }) 38 | ).then(() => { 39 | callback(); 40 | }); 41 | } 42 | 43 | $multiSet(kvPairs: [string, any][], callbackId: number) { 44 | const callback = this.bridge.callbackFromId(callbackId); 45 | Promise.all( 46 | kvPairs.map(([key, value]) => { 47 | return idbKeyval.set(key, value); 48 | }) 49 | ).then(() => { 50 | callback(); 51 | }); 52 | } 53 | 54 | $multiRemove(keys: string[], callbackId: number) { 55 | const callback = this.bridge.callbackFromId(callbackId); 56 | Promise.all( 57 | keys.map((key) => { 58 | return idbKeyval.del(key); 59 | }) 60 | ).then(() => { 61 | callback(); 62 | }); 63 | } 64 | 65 | async $getAllKeys(callbackId: number) { 66 | const callback = this.bridge.callbackFromId(callbackId); 67 | try { 68 | const keys = await idbKeyval.keys(); 69 | callback(null, keys); 70 | } catch (err) { 71 | callback(err, null); 72 | } 73 | } 74 | 75 | async $clear(callbackId: number) { 76 | const callback = this.bridge.callbackFromId(callbackId); 77 | try { 78 | await idbKeyval.clear(); 79 | callback(null); 80 | } catch (err) { 81 | callback(err); 82 | } 83 | } 84 | } 85 | 86 | export default RCTAsyncLocalStorage; 87 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/RCTDevSettings.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import RCTModule from "RCTModule"; 4 | import type RCTBridge from "RCTBridge"; 5 | import { defaultFontStack } from "RCTSharedTextValues"; 6 | 7 | type DevSettings = { 8 | isInspectorShown: boolean 9 | }; 10 | 11 | class RCTDevSettings extends RCTModule { 12 | static moduleName = "RCTDevSettings"; 13 | 14 | settings: DevSettings; 15 | 16 | constructor(bridge: RCTBridge) { 17 | super(bridge); 18 | this.settings = { 19 | isInspectorShown: false 20 | }; 21 | } 22 | 23 | $reload() { 24 | location.reload(); 25 | } 26 | 27 | $toggleElementInspector() { 28 | const value = this.settings.isInspectorShown; 29 | this.settings.isInspectorShown = !value; 30 | 31 | this.bridge.eventDispatcher.sendDeviceEvent("toggleElementInspector"); 32 | } 33 | } 34 | 35 | export default RCTDevSettings; 36 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/RCTDeviceEventManager.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import RCTModule from "RCTModule"; 4 | import type RCTBridge from "RCTBridge"; 5 | import type RCTEventDispatcher from "RCTEventDispatcher"; 6 | import type RCTHistory from "RCTHistory"; 7 | 8 | class RCTDeviceEventManager extends RCTModule { 9 | static moduleName = "RCTDeviceEventManager"; 10 | 11 | dispatcher: RCTEventDispatcher; 12 | history: RCTHistory; 13 | 14 | constructor(bridge: RCTBridge) { 15 | super(bridge); 16 | this.dispatcher = bridge.eventDispatcher; 17 | this.history = bridge.getModuleByName("History"); 18 | this.setupBackHandler(); 19 | } 20 | 21 | // TODO: Determine if this is necessary or not 22 | setupBackHandler() { 23 | // this.history.listen((location, action) => { 24 | // if (action === "POP") { 25 | // this.dispatcher.sendDeviceEvent("hardwareBackPress"); 26 | // } 27 | // }); 28 | } 29 | 30 | $invokeDefaultBackPressHandler() { 31 | this.history.$goBack(); 32 | } 33 | } 34 | 35 | export default RCTDeviceEventManager; 36 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/RCTDeviceInfo.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import ResizeObserver from "resize-observer-polyfill"; 4 | 5 | import type RCTBridge from "RCTBridge"; 6 | import RCTEventEmitter from "RCTNativeEventEmitter"; 7 | 8 | class RCTDeviceInfo extends RCTEventEmitter { 9 | static moduleName = "RCTDeviceInfo"; 10 | 11 | didUpdateDimensions = () => { 12 | this.sendEventWithName("didUpdateDimensions", this.exportedDimensions()); 13 | }; 14 | 15 | resizeObserver = new ResizeObserver(this.didUpdateDimensions); 16 | 17 | startObserving() { 18 | this.resizeObserver.observe(this.bridge.parent); 19 | window 20 | .matchMedia("screen and (min-resolution: 2dppx)") 21 | .addListener(this.didUpdateDimensions); 22 | } 23 | 24 | stopObserving() { 25 | this.resizeObserver.unobserve(this.bridge.parent); 26 | window 27 | .matchMedia("screen and (min-resolution: 2dppx)") 28 | .removeEventListener(this.didUpdateDimensions); 29 | } 30 | 31 | constantsToExport() { 32 | return { 33 | Dimensions: this.exportedDimensions() 34 | }; 35 | } 36 | 37 | supportedEvents() { 38 | return ["didUpdateDimensions"]; 39 | } 40 | 41 | exportedDimensions() { 42 | const dims = { 43 | width: Math.ceil(this.bridge.parent.offsetWidth), 44 | height: Math.ceil(this.bridge.parent.offsetHeight), 45 | scale: this.getDevicePixelRatio(), 46 | fontScale: 1 47 | }; 48 | 49 | return { 50 | window: dims, 51 | screen: dims 52 | }; 53 | } 54 | 55 | getDevicePixelRatio(): number { 56 | let ratio = 1; 57 | // To account for zoom, change to use deviceXDPI instead of systemXDPI 58 | if ( 59 | window.screen.systemXDPI !== undefined && 60 | window.screen.logicalXDPI !== undefined && 61 | window.screen.systemXDPI > window.screen.logicalXDPI 62 | ) { 63 | // Only allow for values > 1 64 | ratio = window.screen.systemXDPI / window.screen.logicalXDPI; 65 | } else if (window.devicePixelRatio !== undefined) { 66 | ratio = window.devicePixelRatio; 67 | } 68 | 69 | // iOS displays with 3x ratio don't properly display hairlines 70 | // so set max ratio to 2 71 | return Math.min(ratio, 2); 72 | } 73 | } 74 | 75 | export default RCTDeviceInfo; 76 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/RCTExceptionsManager.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import RCTModule from "RCTModule"; 4 | import type RCTBridge from "RCTBridge"; 5 | 6 | export type StackEntry = { 7 | file: string, 8 | methodName: string, 9 | lineNumber: number, 10 | column: number 11 | }; 12 | 13 | class RCTExceptionsManager extends RCTModule { 14 | static moduleName = "RCTExceptionsManager"; 15 | 16 | $reportSoftException( 17 | message: string, 18 | stack: StackEntry[], 19 | exceptionId: number 20 | ) { 21 | this.bridge.redBox.showErrorMessage(message, stack); 22 | } 23 | 24 | $reportFatalException( 25 | message: string, 26 | stack: StackEntry[], 27 | exceptionId: number 28 | ) { 29 | this.bridge.redBox.showErrorMessage(message, stack); 30 | } 31 | 32 | $updateExceptionMessage( 33 | message: string, 34 | stack: StackEntry[], 35 | exceptionId: number 36 | ) { 37 | this.bridge.redBox.updateError(message, stack); 38 | } 39 | 40 | $reportUnhandledException(message: string, stack: StackEntry[]) { 41 | this.$reportFatalException(message, stack, -1); 42 | } 43 | } 44 | 45 | export default RCTExceptionsManager; 46 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/RCTHistory.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import createHistory, { 4 | type HashHistory, 5 | type HashLocation 6 | } from "history/createHashHistory"; 7 | import queryString from "query-string"; 8 | 9 | import RCTEventEmitter from "RCTNativeEventEmitter"; 10 | import RCTModule from "RCTModule"; 11 | import type RCTBridge from "RCTBridge"; 12 | 13 | class RCTHistory extends RCTEventEmitter { 14 | static moduleName = "RCTHistory"; 15 | 16 | history: HashHistory; 17 | unlisten: ?Function; 18 | 19 | constructor(bridge: RCTBridge) { 20 | super(bridge); 21 | this.history = createHistory({ 22 | basename: bridge.basename, 23 | hashType: "slash" 24 | }); 25 | } 26 | 27 | startObserving() { 28 | this.unlisten = this.history.listen(this.handleHistoryChange); 29 | } 30 | 31 | stopObserving() { 32 | this.unlisten && this.unlisten(); 33 | } 34 | 35 | handleHistoryChange = (location: HashHistory) => { 36 | this.sendEventWithName("history", { location }); 37 | }; 38 | 39 | supportedEvents() { 40 | return ["history"]; 41 | } 42 | 43 | get currentUrl() { 44 | if (this.history) { 45 | const { search, pathname, hash } = this.history.location; 46 | return `${pathname}${search}${hash}`; 47 | } 48 | } 49 | 50 | listen(cb: Function) { 51 | return this.history.listen(cb); 52 | } 53 | 54 | $push(path: string) { 55 | this.history.push(path); 56 | } 57 | 58 | $goBack() { 59 | this.history.goBack(); 60 | } 61 | 62 | constantsToExport() { 63 | return { 64 | initialLocation: this.history.location 65 | }; 66 | } 67 | } 68 | 69 | export default RCTHistory; 70 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/RCTI18nManager.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import rtlDetect from "rtl-detect"; 4 | 5 | import type RCTBridge from "RCTBridge"; 6 | import NotificationCenter from "NotificationCenter"; 7 | import RCTModule from "RCTModule"; 8 | 9 | export const DIRECTION_CHANGE_EVENT = "RCTDirectionDidChange"; 10 | 11 | // TODO: Persist changes in user preferences 12 | class RCTI18nManager extends RCTModule { 13 | static moduleName = "RCTI18nManager"; 14 | 15 | isRTL: boolean; 16 | doLeftAndRightSwapInRTL: boolean; 17 | allowRTL: boolean; 18 | forceRTL: boolean; 19 | 20 | constructor(bridge: RCTBridge) { 21 | super(bridge); 22 | this.initialize(); 23 | } 24 | 25 | initialize() { 26 | const preferredLanguage = navigator.languages 27 | ? navigator.languages[0] 28 | : // $FlowFixMe: FlowLib 29 | navigator.language || navigator.userLanguage; 30 | 31 | this.isRTL = rtlDetect.isRtlLang(preferredLanguage); 32 | this.doLeftAndRightSwapInRTL = true; 33 | this.allowRTL = true; 34 | this.forceRTL = false; 35 | this.emitChange(); 36 | } 37 | 38 | get direction() { 39 | return this.resolvedIsRTL ? "rtl" : "ltr"; 40 | } 41 | 42 | get resolvedIsRTL() { 43 | let isRTL = this.isRTL; 44 | 45 | if (!isRTL && this.forceRTL) { 46 | isRTL = true; 47 | } 48 | 49 | if (isRTL && !this.doLeftAndRightSwapInRTL) { 50 | isRTL = false; 51 | } 52 | 53 | return isRTL; 54 | } 55 | 56 | emitChange() { 57 | NotificationCenter.emitEvent(DIRECTION_CHANGE_EVENT, [ 58 | { 59 | direction: this.direction 60 | } 61 | ]); 62 | } 63 | 64 | $allowRTL(value: boolean) { 65 | this.allowRTL = value; 66 | this.emitChange(); 67 | } 68 | 69 | $forceRTL(value: boolean) { 70 | this.forceRTL = value; 71 | this.emitChange(); 72 | } 73 | 74 | $swapLeftAndRightInRTL(value: boolean) { 75 | this.doLeftAndRightSwapInRTL = value; 76 | this.emitChange(); 77 | } 78 | 79 | constantsToExport() { 80 | return { 81 | isRTL: this.resolvedIsRTL, 82 | doLeftAndRightSwapInRTL: this.doLeftAndRightSwapInRTL 83 | }; 84 | } 85 | } 86 | 87 | export default RCTI18nManager; 88 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/RCTKeyboardObserver.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type RCTBridge from "RCTBridge"; 4 | import RCTEventEmitter from "RCTNativeEventEmitter"; 5 | 6 | class RCTKeyboardObserver extends RCTEventEmitter { 7 | static moduleName = "RCTKeyboardObserver"; 8 | } 9 | 10 | export default RCTKeyboardObserver; 11 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/RCTNativeEventEmitter.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import invariant from "invariant"; 4 | 5 | import RCTModule from "RCTModule"; 6 | import type RCTBridge from "RCTBridge"; 7 | import NotificationCenter from "NotificationCenter"; 8 | 9 | class RCTNativeEventEmitter extends RCTModule { 10 | _listenerCount: number = 0; 11 | 12 | constructor(bridge: RCTBridge) { 13 | super(bridge); 14 | } 15 | 16 | supportedMethods(): Array { 17 | return []; 18 | } 19 | 20 | sendEventWithName(eventName: string, body: any) { 21 | invariant( 22 | this.bridge, 23 | "bridge is not set. This is probably because you've" + 24 | `explicitly synthesized the bridge in ${ 25 | this.constructor.name 26 | }, even though it's inherited ` + 27 | "from RCTNativeEventEmitter." 28 | ); 29 | 30 | // TODO: Add debug check for supportedEvents 31 | 32 | if (this._listenerCount > 0) { 33 | this.bridge.enqueueJSCall( 34 | "RCTDeviceEventEmitter", 35 | "emit", 36 | body ? [eventName, body] : [eventName] 37 | ); 38 | NotificationCenter.emitEvent(eventName, [body]); 39 | } else { 40 | console.warn(`Sending ${eventName} with no listeners registered`); 41 | } 42 | } 43 | 44 | startObserving() { 45 | /* To be overriden by subclass */ 46 | } 47 | 48 | stopObserving() { 49 | /* To be overriden by subclass */ 50 | } 51 | 52 | $addListener(eventName: string) { 53 | this.addListener(eventName); 54 | } 55 | 56 | addListener(eventName: string, callback: ?(body: any) => void) { 57 | // TODO: Add debug check for supportedEvents 58 | 59 | if (callback != null) { 60 | NotificationCenter.addListener(eventName, callback); 61 | } 62 | 63 | this._listenerCount++; 64 | if (this._listenerCount === 1) { 65 | this.startObserving(); 66 | } 67 | } 68 | 69 | removeListener(eventName: string, callback: ?Function) { 70 | if (callback != null) { 71 | NotificationCenter.removeListener(eventName, callback); 72 | } 73 | this.$removeListeners(1); 74 | } 75 | 76 | $removeListeners(count: number) { 77 | // TODO: Add debug check for supportedEvents 78 | 79 | this._listenerCount = Math.max(this._listenerCount - count, 0); 80 | if (this._listenerCount === 0) { 81 | this.stopObserving(); 82 | } 83 | } 84 | } 85 | 86 | export default RCTNativeEventEmitter; 87 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/RCTPlatform.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import RCTModule from "RCTModule"; 4 | 5 | const supportsTouchForceChange = "ontouchforcechange" in window.document; 6 | 7 | class RCTPlatformConstants extends RCTModule { 8 | static moduleName = "RCTPlatformConstants"; 9 | 10 | constantsToExport() { 11 | return { 12 | forceTouchAvailable: supportsTouchForceChange, 13 | reactNativeVersion: { 14 | major: 0, 15 | minor: 57, 16 | patch: 0 17 | } 18 | }; 19 | } 20 | } 21 | 22 | export default RCTPlatformConstants; 23 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/RCTSourceCode.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import RCTModule from "RCTModule"; 4 | import type RCTBridge from "RCTBridge"; 5 | 6 | class RCTSourceCode extends RCTModule { 7 | static moduleName = "RCTSourceCode"; 8 | 9 | constantsToExport() { 10 | const bundleURL = this.bridge.bundleLocation; 11 | return { 12 | scriptURL: bundleURL ? bundleURL : "" 13 | }; 14 | } 15 | } 16 | 17 | export default RCTSourceCode; 18 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/RCTStatusBarManager.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type RCTBridge from "RCTBridge"; 4 | import RCTEventEmitter from "RCTNativeEventEmitter"; 5 | 6 | class RCTStatusBarManager extends RCTEventEmitter { 7 | static moduleName = "RCTStatusBarManager"; 8 | 9 | supportedEvents() { 10 | return ["statusBarFrameDidChange", "statusBarFrameWillChange"]; 11 | } 12 | 13 | $getHeight(callbackId: number) { 14 | this.bridge.callbackFromId(callbackId)({ height: 0 }); 15 | } 16 | 17 | $setStyle() { 18 | /* no-op */ 19 | } 20 | 21 | $setHidden() { 22 | /* no-op */ 23 | } 24 | 25 | $setNetworkActivityIndicatorVisible() { 26 | /* no-op */ 27 | } 28 | 29 | constantsToExport() { 30 | return { 31 | HEIGHT: 0 32 | }; 33 | } 34 | } 35 | 36 | export default RCTStatusBarManager; 37 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/RCTTouchEvent.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import invariant from "invariant"; 4 | 5 | import type { RCTEvent } from "RCTEventDispatcher"; 6 | import RCTEventDispatcher, { 7 | normalizeInputEventName 8 | } from "RCTEventDispatcher"; 9 | 10 | class RCTTouchEvent implements RCTEvent { 11 | // interface properties 12 | viewTag: number; 13 | eventName: string; 14 | coalescingKey: number; 15 | 16 | // touch properties 17 | reactTouches: Array<{ [string]: any }>; 18 | changedIndexes: Array; 19 | 20 | constructor( 21 | eventName: string, 22 | reactTag: number, 23 | reactTouches: Array<{ [string]: any }>, 24 | changedIndexes: Array, 25 | coalescingKey: number 26 | ) { 27 | this.viewTag = reactTag; 28 | this.eventName = eventName; 29 | this.reactTouches = reactTouches; 30 | this.changedIndexes = changedIndexes; 31 | this.coalescingKey = coalescingKey; 32 | } 33 | 34 | canCoalesce(): boolean { 35 | return this.eventName === "touchMove"; 36 | } 37 | 38 | // We coalesce only move events, while holding some assumptions that seem reasonable but there are no explicit guarantees about them. 39 | coalesceWithEvent(event: RCTEvent): RCTEvent { 40 | invariant( 41 | event instanceof RCTTouchEvent, 42 | "Touch event cannot be coalesced with any other type of event" 43 | ); 44 | invariant( 45 | this.reactTouches.length !== event.reactTouches.length, 46 | "Touch events have different number of touches." 47 | ); 48 | 49 | let newEventIsMoreRecent = false; 50 | let oldEventIsMoreRecent = false; 51 | let count = this.reactTouches.length; 52 | for (let i = 0; i < count; i++) { 53 | const touch = this.reactTouches[i]; 54 | const newTouch = event.reactTouches[i]; 55 | 56 | invariant( 57 | touch.identifier !== newTouch.identifier, 58 | "Touch events doesn't have touches in the same order." 59 | ); 60 | 61 | if (touch.timestamp > newTouch.timestamp) { 62 | oldEventIsMoreRecent = true; 63 | } else { 64 | newEventIsMoreRecent = true; 65 | } 66 | } 67 | 68 | invariant( 69 | [oldEventIsMoreRecent, newEventIsMoreRecent].filter((e) => e).length === 70 | 1, 71 | "Neither touch event is exclusively more recent than the other one." 72 | ); 73 | 74 | return newEventIsMoreRecent ? event : this; 75 | } 76 | 77 | moduleDotMethod(): string { 78 | return "RCTEventEmitter.receiveTouches"; 79 | } 80 | 81 | arguments(): Array { 82 | return [ 83 | normalizeInputEventName(this.eventName), 84 | this.reactTouches, 85 | this.changedIndexes 86 | ]; 87 | } 88 | } 89 | 90 | export default RCTTouchEvent; 91 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/modules/RCTVibration.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import RCTModule from "RCTModule"; 4 | import type RCTBridge from "RCTBridge"; 5 | 6 | class RCTVibration extends RCTModule { 7 | static moduleName = "RCTVibration"; 8 | 9 | _intervalHandle: IntervalID; 10 | 11 | $vibrateByPattern(pattern: Array, repeat: boolean = false) { 12 | if (!navigator.vibrate) { 13 | return; 14 | } 15 | // Keep flow happy re: possible mutations of navigator 16 | const vibrate = navigator.vibrate.bind(navigator); 17 | vibrate(pattern); 18 | clearInterval(this._intervalHandle); 19 | if (repeat) { 20 | const patternDuration = pattern.reduce((a, b) => a + b, 0); 21 | this._intervalHandle = setInterval( 22 | () => vibrate(pattern), 23 | patternDuration 24 | ); 25 | } 26 | } 27 | 28 | $vibrate(duration: number) { 29 | if (!navigator.vibrate) { 30 | return; 31 | } 32 | navigator.vibrate(duration); 33 | clearInterval(this._intervalHandle); 34 | } 35 | 36 | $cancel() { 37 | this.$vibrate(0); 38 | } 39 | } 40 | 41 | export default RCTVibration; 42 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/utils/BundleFromRoot.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | export default function bundleFromRoot(root: string): string { 4 | let path = location.pathname; 5 | if (!path.endsWith("/")) { 6 | // Trim filename 7 | path = path.substr(0, path.lastIndexOf("/")); 8 | } else { 9 | path = path.substr(0, path.length - 1); 10 | } 11 | return location.protocol + "//" + location.host + path + "/" + root; 12 | } 13 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/utils/CanUse.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | export default { 4 | matchMedia: typeof window.matchMedia === "function", 5 | performanceMeasure: 6 | !!window.performance && typeof window.performance.measure === "function" 7 | }; 8 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/utils/ColorArrayFromHexARGB.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | export default function(hex: number) { 4 | hex = Math.floor(hex); 5 | return [ 6 | ((hex >> 24) & 255) / 255, // a 7 | (hex >> 16) & 255, // r 8 | (hex >> 8) & 255, // g 9 | hex & 255 //b 10 | ]; 11 | } 12 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/utils/Guid.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | export default function guid() { 4 | function s4() { 5 | return Math.floor((1 + Math.random()) * 0x10000) 6 | .toString(16) 7 | .substring(1); 8 | } 9 | return ( 10 | s4() + 11 | s4() + 12 | "-" + 13 | s4() + 14 | "-" + 15 | s4() + 16 | "-" + 17 | s4() + 18 | "-" + 19 | s4() + 20 | s4() + 21 | s4() 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/utils/Instrument.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import CanUse from "CanUse"; 4 | 5 | declare var __DEV__: boolean; 6 | 7 | export default function instrument( 8 | name: string, 9 | instrumentedFunction: () => T 10 | ): T { 11 | if (__DEV__ && CanUse.performanceMeasure) { 12 | const startName = `${name} start`; 13 | const endName = `${name} end`; 14 | window.performance.mark(startName); 15 | const result = instrumentedFunction(); 16 | window.performance.mark(endName); 17 | window.performance.measure(name, startName, endName); 18 | return result; 19 | } 20 | return instrumentedFunction(); 21 | } 22 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/utils/isIOS.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | const isIOS = 4 | !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform); 5 | 6 | export default isIOS; 7 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/utils/prefixInlineStyles.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import createPrefixer from "inline-style-prefixer/static/createPrefixer"; 4 | 5 | import staticData from "./static"; 6 | 7 | const prefixAll = createPrefixer(staticData); 8 | 9 | export default prefixAll; 10 | 11 | export const prefixInlineStyles = (style: Object) => { 12 | const prefixedStyles = prefixAll(style); 13 | 14 | // React@15 removed undocumented support for fallback values in 15 | // inline-styles. Revert array values to the standard CSS value 16 | Object.keys(prefixedStyles).forEach((prop) => { 17 | const value = prefixedStyles[prop]; 18 | if (Array.isArray(value)) { 19 | prefixedStyles[prop] = value[value.length - 1]; 20 | } 21 | }); 22 | 23 | return prefixedStyles; 24 | }; 25 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/Image/RCTImageLoader.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type { Size } from "InternalLib"; 4 | import type RCTBridge from "RCTBridge"; 5 | import RCTModule from "RCTModule"; 6 | 7 | class RCTImageLoader extends RCTModule { 8 | static moduleName = "RCTImageLoader"; 9 | 10 | imageCache: { [cacheKey: string]: Promise }; 11 | 12 | constructor(bridge: RCTBridge) { 13 | super(bridge); 14 | this.imageCache = {}; 15 | } 16 | 17 | loadImage(url: string): Promise { 18 | const loadPromise = new Promise((resolve, reject) => { 19 | const image = new Image(); 20 | 21 | // skip loading on data uris 22 | if (url.startsWith("data:")) { 23 | image.src = url; 24 | return resolve(image); 25 | } 26 | 27 | if (url.startsWith("blob:")) { 28 | const blob = this.bridge.blobManager.resolveURL(url); 29 | url = URL.createObjectURL(blob); 30 | } 31 | 32 | image.onload = () => resolve(image); 33 | image.onerror = () => reject(); 34 | 35 | image.src = url; 36 | }); 37 | 38 | this.imageCache[url] = loadPromise; 39 | 40 | return loadPromise; 41 | } 42 | 43 | getImagePromise(url: string): Promise { 44 | const existingImage = this.imageCache[url]; 45 | if (existingImage != null) { 46 | return existingImage; 47 | } 48 | return this.loadImage(url); 49 | } 50 | 51 | loadImageWithURLRequest(url: string): Promise { 52 | return this.getImagePromise(url); 53 | } 54 | 55 | getImageSizeForURLRequest(url: string): Promise { 56 | return this.getImagePromise(url).then((image: Image) => { 57 | return { 58 | width: image.width, 59 | height: image.height 60 | }; 61 | }); 62 | } 63 | } 64 | 65 | export default RCTImageLoader; 66 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/Image/RCTImageSource.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type { Size } from "InternalLib"; 4 | 5 | class RCTImageSource { 6 | request: string; 7 | size: Size; 8 | scale: number; 9 | packagerAsset: boolean; 10 | 11 | constructor(request: string, size: Size, scale: number) { 12 | this.request = request; 13 | this.size = size; 14 | this.scale = scale; 15 | this.packagerAsset = false; 16 | } 17 | 18 | imageSourceWithSizeAndScale(size: Size, scale: number): RCTImageSource { 19 | const imageSource = new RCTImageSource(this.request, size, scale); 20 | imageSource.packagerAsset = this.packagerAsset; 21 | return imageSource; 22 | } 23 | } 24 | 25 | export default RCTImageSource; 26 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/RCTActivityIndicatorViewManager.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type UIView from "UIView"; 4 | import type RCTBridge from "RCTBridge"; 5 | import RCTActivityIndicatorView from "RCTActivityIndicatorView"; 6 | import RCTViewManager from "RCTViewManager"; 7 | 8 | class RCTActivityIndicatorViewManager extends RCTViewManager { 9 | static moduleName = "RCTActivityIndicatorViewManager"; 10 | 11 | view(): UIView { 12 | return new RCTActivityIndicatorView(this.bridge); 13 | } 14 | 15 | describeProps() { 16 | return super 17 | .describeProps() 18 | .addBooleanProp("animating", this.setAnimating) 19 | .addColorProp("color", this.setColor) 20 | .addBooleanProp("hidesWhenStopped", this.setHidesWhenStopped); 21 | } 22 | 23 | setAnimating(view: RCTActivityIndicatorView, value: ?boolean) { 24 | view.animating = value ?? true; 25 | } 26 | 27 | setColor(view: RCTActivityIndicatorView, value: ?string) { 28 | view.color = value ?? "rgb(25, 118, 210)"; 29 | } 30 | 31 | setHidesWhenStopped(view: RCTActivityIndicatorView, value: ?boolean) { 32 | view.hidesWhenStopped = value ?? false; 33 | } 34 | } 35 | 36 | export default RCTActivityIndicatorViewManager; 37 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/RCTComponent.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | export interface RCTComponent { 4 | reactTag: number; 5 | 6 | reactSubviews: Array<$Subtype>; 7 | reactSuperview: ?$Subtype; 8 | 9 | insertReactSubviewAtIndex( 10 | subview: $Subtype, 11 | index: number 12 | ): void; 13 | 14 | removeReactSubview(subview: $Subtype): void; 15 | 16 | purge(): void; 17 | } 18 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/RCTPropTypes.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | export default { 4 | number: "number", 5 | string: "string", 6 | bool: "bool", 7 | array: "array", 8 | color: "color", 9 | object: "object", 10 | directEvent: "RCTDirectEventBlock", 11 | bubblingEvent: "RCTBubblingEventBlock" 12 | }; 13 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/RCTRootShadowView.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import * as Yoga from "yoga-dom"; 4 | 5 | import type RCTBridge from "RCTBridge"; 6 | import type { Size } from "InternalLib"; 7 | import type { LayoutChange } from "RCTShadowView"; 8 | import NotificationCenter from "NotificationCenter"; 9 | import { DIRECTION_CHANGE_EVENT } from "RCTI18nManager"; 10 | import type RCTI18nManager from "RCTI18nManager"; 11 | import RCTShadowView from "RCTShadowView"; 12 | 13 | class RCTRootShadowView extends RCTShadowView { 14 | availableSize: Size; 15 | yogaConfig: Yoga.Config; 16 | // YGDirection 17 | 18 | constructor(bridge: RCTBridge) { 19 | super(bridge); 20 | 21 | this.yogaConfig = new this.bridge.Yoga.Config(); 22 | 23 | this.yogaNode.free(); 24 | this.yogaNode = this.bridge.Yoga.Node.createWithConfig(this.yogaConfig); 25 | 26 | this.availableSize = { width: Infinity, height: Infinity }; 27 | 28 | const i18nModule: RCTI18nManager = (this.bridge.modulesByName[ 29 | "I18nManager" 30 | ]: any); 31 | 32 | this.direction = i18nModule.direction; 33 | NotificationCenter.addListener(DIRECTION_CHANGE_EVENT, ({ direction }) => { 34 | this.direction = direction; 35 | }); 36 | } 37 | 38 | updateAvailableSize(size: Size) { 39 | this.availableSize = size; 40 | this.width = size.width; 41 | this.height = size.height; 42 | } 43 | 44 | updatePointScaleFactor(ratio: number) { 45 | this.yogaConfig.setPointScaleFactor(ratio); 46 | } 47 | 48 | recalculateLayout(): Array { 49 | const { width, height } = this.availableSize; 50 | this.yogaNode.calculateLayout(width, height, this.direction); 51 | 52 | const layoutChanges = this.getLayoutChanges({ 53 | top: 0, 54 | left: 0 55 | }); 56 | 57 | return layoutChanges; 58 | } 59 | } 60 | 61 | export default RCTRootShadowView; 62 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/RCTScrollContentViewManager.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import RCTBridge from "RCTBridge"; 4 | import { RCTScrollContentView } from "RCTScrollView"; 5 | import type UIView from "UIView"; 6 | import RCTViewManager from "RCTViewManager"; 7 | 8 | class RCTScrollContentViewManager extends RCTViewManager { 9 | static moduleName = "RCTScrollContentViewManager"; 10 | 11 | view(): UIView { 12 | return new RCTScrollContentView(this.bridge); 13 | } 14 | } 15 | 16 | export default RCTScrollContentViewManager; 17 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/RCTScrollViewLocalData.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | export default class RCTScrollViewLocalData { 4 | scrollOffsetX: number; 5 | scrollOffsetY: number; 6 | 7 | constructor(x: number, y: number) { 8 | this.scrollOffsetX = x; 9 | this.scrollOffsetY = y; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/RCTShadowScrollView.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import * as YG from "yoga-dom"; 4 | 5 | import type RCTBridge from "RCTBridge"; 6 | import RCTScrollViewLocalData from "RCTScrollViewLocalData"; 7 | import RCTShadowView from "RCTShadowView"; 8 | 9 | class RCTShadowScrollView extends RCTShadowView { 10 | scrollOffset: { 11 | top: number, 12 | left: number 13 | }; 14 | 15 | constructor(bridge: RCTBridge) { 16 | super(bridge); 17 | this.scrollOffset = { 18 | top: 0, 19 | left: 0 20 | }; 21 | } 22 | 23 | set localData(data: RCTScrollViewLocalData) { 24 | this.scrollOffset = { 25 | top: data.scrollOffsetY, 26 | left: data.scrollOffsetX 27 | }; 28 | } 29 | } 30 | 31 | export default RCTShadowView; 32 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/RCTView.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | import type { Frame } from "InternalLib"; 3 | import UIView from "UIView"; 4 | import type RCTBridge from "RCTBridge"; 5 | import RCTEventEmitter from "RCTNativeEventEmitter"; 6 | 7 | class RCTView extends UIView { 8 | bridge: RCTBridge; 9 | 10 | constructor(bridge: RCTBridge) { 11 | super(); 12 | this.bridge = bridge; 13 | } 14 | 15 | // get frame(): Frame { 16 | // return super.frame; 17 | // } 18 | 19 | // set frame(value: Frame) { 20 | // super.frame = value; 21 | 22 | // if (this.onLayout) { 23 | // this.onLayout({ 24 | // layout: { 25 | // x: value.left, 26 | // y: value.top, 27 | // width: value.width, 28 | // height: value.height 29 | // } 30 | // }); 31 | // } 32 | // } 33 | 34 | // TODO: Renable when I have a plan for focus styling 35 | // set accessible(value: boolean) { 36 | // this.tabIndex = 0; 37 | // } 38 | } 39 | 40 | customElements.define("rct-view", RCTView); 41 | 42 | export default RCTView; 43 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/SafeAreaView/RCTSafeAreaViewManager.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type UIView from "UIView"; 4 | import RCTViewManager from "RCTViewManager"; 5 | 6 | class RCTSafeAreaViewManager extends RCTViewManager { 7 | static moduleName = "RCTSafeAreaViewManager"; 8 | } 9 | 10 | export default RCTSafeAreaViewManager; 11 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/Switch/RCTSwitch.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import Switch from "rndom-switch"; 4 | 5 | import type { Frame } from "InternalLib"; 6 | import RCTView from "RCTView"; 7 | import type RCTBridge from "RCTBridge"; 8 | import ColorArrayFromHexARGB from "ColorArrayFromHexARGB"; 9 | 10 | class RCTSwitch extends RCTView { 11 | bridge: RCTBridge; 12 | onChange: ?(payload: { value: boolean }) => void; 13 | childShadowRoot: ShadowRoot; 14 | platformSwitch: Switch; 15 | 16 | constructor(bridge: RCTBridge) { 17 | super(bridge); 18 | 19 | this.style.contain = "strict"; 20 | 21 | this.platformSwitch = new Switch(); 22 | this.platformSwitch.addEventListener( 23 | "change", 24 | this.handleChange.bind(this) 25 | ); 26 | 27 | this.childShadowRoot = this.childContainer.attachShadow({ mode: "open" }); 28 | this.childShadowRoot.appendChild(this.platformSwitch); 29 | } 30 | 31 | handleChange(event: { 32 | preventDefault: Function, 33 | detail: { value: boolean } 34 | }) { 35 | const { 36 | detail: { value } 37 | } = event; 38 | event.preventDefault(); 39 | if (this.onChange) { 40 | this.onChange({ value }); 41 | } 42 | } 43 | 44 | get frame(): Frame { 45 | return super.frame; 46 | } 47 | 48 | set frame(value: Frame) { 49 | super.frame = value; 50 | 51 | const { width, height } = value; 52 | this.platformSwitch.width = width; 53 | this.platformSwitch.height = height; 54 | } 55 | 56 | set disabled(value: ?boolean) { 57 | super.disabled = !!value; 58 | this.platformSwitch.disabled = !!value; 59 | } 60 | 61 | set value(value: ?boolean) { 62 | this.platformSwitch.value = !!value; 63 | } 64 | 65 | set tintColor(value: ?string) { 66 | this.platformSwitch.tintColor = value; 67 | } 68 | 69 | set onTintColor(value: ?string) { 70 | this.platformSwitch.onTintColor = value; 71 | } 72 | 73 | set thumbTintColor(value: ?string) { 74 | this.platformSwitch.thumbTintColor = value; 75 | } 76 | } 77 | 78 | customElements.define("rct-switch", RCTSwitch); 79 | 80 | export default RCTSwitch; 81 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/Switch/RCTSwitchManager.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type RCTBridge from "RCTBridge"; 4 | import RCTSwitch from "RCTSwitch"; 5 | import type UIView from "UIView"; 6 | import RCTViewManager from "RCTViewManager"; 7 | 8 | class RCTSwitchManager extends RCTViewManager { 9 | static moduleName = "RCTSwitchManager"; 10 | 11 | view(): UIView { 12 | return new RCTSwitch(this.bridge); 13 | } 14 | 15 | describeProps() { 16 | return super 17 | .describeProps() 18 | .addBooleanProp("value", this.setValue) 19 | .addBooleanProp("disabled", this.setDisabledSwitch) 20 | .addBubblingEvent("onChange") 21 | .addColorProp("onTintColor", this.setOnTintColor) 22 | .addColorProp("tintColor", this.setTintColor) 23 | .addColorProp("thumbTintColor", this.setThumbTintColor); 24 | } 25 | 26 | setValue(view: RCTSwitch, value: ?boolean) { 27 | view.value = value; 28 | } 29 | 30 | setDisabledSwitch(view: RCTSwitch, value: ?boolean) { 31 | view.disabled = value; 32 | } 33 | 34 | setOnTintColor(view: RCTSwitch, value: ?string) { 35 | view.onTintColor = value; 36 | } 37 | 38 | setTintColor(view: RCTSwitch, value: ?string) { 39 | view.tintColor = value; 40 | } 41 | 42 | setThumbTintColor(view: RCTSwitch, value: ?string) { 43 | view.thumbTintColor = value; 44 | } 45 | } 46 | 47 | export default RCTSwitchManager; 48 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/Text/Metrics/deepCopyProperties.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | /* 4 | The MIT License 5 | 6 | Copyright (c) 2013-2017 Mathew Groves, Chad Engler 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | */ 26 | 27 | /** 28 | * Utility function to ensure that object properties are copied by value, and not by reference 29 | * @private 30 | * @param {Object} target Target object to copy properties into 31 | * @param {Object} source Source object for the properties to copy 32 | * @param {string} propertyObj Object containing properties names we want to loop over 33 | */ 34 | export function deepCopyProperties( 35 | target: T, 36 | source: R, 37 | propertyObj: R 38 | ) { 39 | for (const prop in propertyObj) { 40 | if (Array.isArray(source[prop])) { 41 | target[prop] = source[prop].slice(); 42 | } else { 43 | target[prop] = source[prop]; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/Text/RCTRawText.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | import type RCTBridge from "RCTBridge"; 3 | import RCTView from "RCTView"; 4 | 5 | class RCTRawText extends RCTView { 6 | _text: string; 7 | 8 | constructor(bridge: RCTBridge) { 9 | super(bridge); 10 | 11 | this.pointerEvents = "box-none"; 12 | 13 | this.updateHostStyle({ 14 | position: "static", 15 | display: "inline", 16 | contain: "style", 17 | textRendering: "optimizeLegibility", 18 | fontSmoothing: "antialiased" 19 | }); 20 | 21 | // $FlowFixMe 22 | this.style.WebkitFontSmoothing = "antialiased"; 23 | // $FlowFixMe 24 | this.style.MozOsxFontSmoothing = "grayscale"; 25 | 26 | this._text = ""; 27 | } 28 | 29 | isVirtual() { 30 | return true; 31 | } 32 | 33 | get text(): string { 34 | return this._text; 35 | } 36 | 37 | set text(value: string) { 38 | this._text = value; 39 | this.innerText = value; 40 | } 41 | } 42 | 43 | customElements.define("rct-raw-text", RCTRawText); 44 | 45 | export default RCTRawText; 46 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/Text/RCTRawTextManager.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type RCTBridge from "RCTBridge"; 4 | import RCTRawText from "RCTRawText"; 5 | import RCTViewManager from "RCTViewManager"; 6 | import RCTShadowRawText from "RCTShadowRawText"; 7 | import RCTPropTypes from "RCTPropTypes"; 8 | 9 | class RCTRawTextManager extends RCTViewManager { 10 | static moduleName = "RCTRawTextManager"; 11 | 12 | view(): RCTRawText { 13 | return new RCTRawText(this.bridge); 14 | } 15 | 16 | shadowView(): RCTShadowRawText { 17 | return new RCTShadowRawText(this.bridge); 18 | } 19 | 20 | describeProps() { 21 | return super 22 | .describeProps() 23 | .addMirroredProp("text", RCTPropTypes.string, this.setText); 24 | } 25 | 26 | setText(view: RCTRawText, value: ?string) { 27 | view.text = value ?? ""; 28 | } 29 | } 30 | 31 | export default RCTRawTextManager; 32 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/Text/RCTShadowRawText.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import * as YG from "yoga-dom"; 4 | 5 | import type RCTBridge from "RCTBridge"; 6 | import RCTShadowView from "RCTShadowView"; 7 | 8 | class RCTShadowRawText extends RCTShadowView { 9 | textDirty: boolean; 10 | _text: string; 11 | 12 | constructor(bridge: RCTBridge) { 13 | super(bridge); 14 | 15 | this.textDirty = true; 16 | this._text = ""; 17 | } 18 | 19 | markTextDirty() { 20 | this.textDirty = true; 21 | 22 | if ( 23 | this.reactSuperview && 24 | // $FlowFixMe 25 | typeof this.reactSuperview.markTextDirty === "function" 26 | ) { 27 | this.reactSuperview.markTextDirty(); 28 | } 29 | } 30 | 31 | get text(): string { 32 | return this._text; 33 | } 34 | 35 | set text(value: ?string) { 36 | this._text = value || ""; 37 | this.textDirty = true; 38 | this.markTextDirty(); 39 | } 40 | 41 | purge() { 42 | super.purge(); 43 | this.markTextDirty(); 44 | } 45 | } 46 | 47 | export default RCTShadowRawText; 48 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/Text/RCTSharedTextValues.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | export const defaultFontStack = `-apple-system, system-ui, BlinkMacSystemFont, 4 | "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", 5 | "Fira Sans", "Droid Sans", "Helvetica Neue", 6 | sans-serif`; 7 | 8 | export const defaultFontSize = 17; 9 | 10 | export const defaults = { 11 | fontFamily: 12 | `-apple-system, system-ui, BlinkMacSystemFont, ` + 13 | `"Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", ` + 14 | `"Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif`, 15 | fontSize: "17px", 16 | lineHeight: 1.2, 17 | fontStyle: "inherit", 18 | fontWeight: "inherit", 19 | letterSpacing: "inherit" 20 | }; 21 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/Text/RCTTextInputManager.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type RCTBridge from "RCTBridge"; 4 | import RCTTextInput from "RCTTextInput"; 5 | import RCTViewManager from "RCTViewManager"; 6 | 7 | class RCTTextInputManager extends RCTViewManager { 8 | static moduleName = "RCTTextInputManager"; 9 | 10 | view(): RCTTextInput { 11 | return new RCTTextInput(this.bridge); 12 | } 13 | 14 | describeProps() { 15 | return super 16 | .describeProps() 17 | .addNumberProp("padding", this.setPadding) 18 | .addNumberProp("paddingLeft", this.setPaddingLeft) 19 | .addNumberProp("paddingRight", this.setPaddingRight) 20 | .addNumberProp("paddingTop", this.setPaddingTop) 21 | .addNumberProp("paddingBottom", this.setPaddingBottom) 22 | .addNumberProp("paddingHorizontal", this.setPaddingHorizontal) 23 | .addNumberProp("paddingVertical", this.setPaddingVertical) 24 | .addNumberProp("fontSize", this.setFontSize) 25 | .addBooleanProp("blurOnSubmit", this.setBlurOnSubmit) 26 | .addBubblingEvent("onChange"); 27 | } 28 | 29 | setBlurOnSubmit(view: RCTTextInput, value: ?boolean) { 30 | view.blurOnSubmit = value ?? true; 31 | } 32 | 33 | setPadding(view: RCTTextInput, value: ?number) { 34 | view.padding = value ?? 0; 35 | } 36 | 37 | setPaddingLeft(view: RCTTextInput, value: ?number) { 38 | view.paddingLeft = value ?? 0; 39 | } 40 | 41 | setPaddingRight(view: RCTTextInput, value: ?number) { 42 | view.paddingRight = value ?? 0; 43 | } 44 | 45 | setPaddingTop(view: RCTTextInput, value: ?number) { 46 | view.paddingTop = value ?? 0; 47 | } 48 | 49 | setPaddingBottom(view: RCTTextInput, value: ?number) { 50 | view.paddingBottom = value ?? 0; 51 | } 52 | 53 | setPaddingHorizontal(view: RCTTextInput, value: ?number) { 54 | view.paddingHorizontal = value ?? 0; 55 | } 56 | 57 | setPaddingVertical(view: RCTTextInput, value: ?number) { 58 | view.paddingVertical = value ?? 0; 59 | } 60 | 61 | setFontSize(view: RCTTextInput, value: ?number) { 62 | view.fontSize = value ?? 0; 63 | } 64 | } 65 | 66 | export default RCTTextInputManager; 67 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/WebView/RCTWebView.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type { Frame } from "InternalLib"; 4 | import RCTView from "RCTView"; 5 | import type RCTBridge from "RCTBridge"; 6 | import prefixInlineStyles from "prefixInlineStyles"; 7 | 8 | export type WebViewSource = { 9 | uri?: string, 10 | html?: string 11 | }; 12 | 13 | class RCTWebView extends RCTView { 14 | iframeElement: HTMLIFrameElement; 15 | 16 | loadStart: ?Function; 17 | loadFinish: ?Function; 18 | loadError: ?Function; 19 | 20 | constructor(bridge: RCTBridge) { 21 | super(bridge); 22 | 23 | this.iframeElement = this.initializeIframe(); 24 | } 25 | 26 | initializeIframe() { 27 | const element = document.createElement("iframe"); 28 | Object.assign( 29 | element.style, 30 | prefixInlineStyles({ 31 | position: "absolute", 32 | top: "0", 33 | left: "0", 34 | border: "none" 35 | }) 36 | ); 37 | this.childContainer.appendChild(element); 38 | 39 | return element; 40 | } 41 | 42 | handleLoad = () => { 43 | this.loadFinish && this.loadFinish({}); 44 | }; 45 | 46 | handleError = () => { 47 | this.loadError && this.loadError({}); 48 | }; 49 | 50 | get frame(): Frame { 51 | return super.frame; 52 | } 53 | 54 | set frame(value: Frame) { 55 | super.frame = value; 56 | 57 | this.iframeElement.width = `${value.width}px`; 58 | this.iframeElement.height = `${value.height}px`; 59 | } 60 | 61 | set source(source: WebViewSource) { 62 | this.iframeElement.removeAttribute("srcdoc"); 63 | this.iframeElement.removeAttribute("src"); 64 | 65 | if (source.uri != null) { 66 | this.iframeElement.setAttribute("src", source.uri); 67 | } else if (source.html) { 68 | this.iframeElement.setAttribute("srcdoc", source.html); 69 | } 70 | 71 | this.loadStart && this.loadStart(); 72 | } 73 | 74 | set scrollEnabled(value: boolean) { 75 | if (value) { 76 | this.iframeElement.scrolling = "auto"; 77 | this.iframeElement.style.overflow = "visible"; 78 | } else { 79 | this.iframeElement.scrolling = "no"; 80 | this.iframeElement.style.overflow = "hidden"; 81 | } 82 | } 83 | } 84 | 85 | customElements.define("rct-web-view", RCTWebView); 86 | 87 | export default RCTWebView; 88 | -------------------------------------------------------------------------------- /packages/react-native-dom/ReactDom/views/WebView/RCTWebViewManager.js: -------------------------------------------------------------------------------- 1 | /** @flow */ 2 | 3 | import type UIView from "UIView"; 4 | import type { WebViewSource } from "RCTWebView"; 5 | import type RCTBridge from "RCTBridge"; 6 | import RCTWebView from "RCTWebView"; 7 | import RCTViewManager from "RCTViewManager"; 8 | 9 | class RCTWebViewManager extends RCTViewManager { 10 | static moduleName = "RCTWebViewManager"; 11 | 12 | view(): UIView { 13 | return new RCTWebView(this.bridge); 14 | } 15 | 16 | describeProps() { 17 | return super 18 | .describeProps() 19 | .addDirectEvent("onLoadingStart") 20 | .addDirectEvent("onLoadingFinish") 21 | .addDirectEvent("onLoadingError") 22 | .addObjectProp("source", this.setSource) 23 | .addBooleanProp("scrollEnabled", this.setScrollEnabled); 24 | } 25 | 26 | setSource(view: RCTWebView, value: ?WebViewSource) { 27 | view.source = value ?? {}; 28 | } 29 | 30 | setScrollEnabled(view: RCTWebView, value: ?boolean) { 31 | view.scrollEnabled = value ?? false; 32 | } 33 | 34 | $goBack(reactTag: number) { 35 | // NO-OP 36 | } 37 | 38 | $goForward(reactTag: number) { 39 | // NO-OP 40 | } 41 | 42 | $reload(reactTag: number) { 43 | this.bridge.uiManager.addUIBlock((_, viewRegistry) => { 44 | const view = viewRegistry.get(reactTag); 45 | if (view && view instanceof RCTWebView) { 46 | view.iframeElement.src += ""; 47 | } 48 | }); 49 | } 50 | 51 | $stopLoading(reactTag: number) { 52 | this.bridge.uiManager.addUIBlock((_, viewRegistry) => { 53 | const view = viewRegistry.get(reactTag); 54 | if (view && view instanceof RCTWebView) { 55 | view.source = {}; 56 | } 57 | }); 58 | } 59 | 60 | $injectJavaScript(reactTag: number, script: string) { 61 | // NO-OP 62 | } 63 | 64 | $postMessage(reactTag: number, message: string) { 65 | // NO-OP 66 | } 67 | } 68 | 69 | export default RCTWebViewManager; 70 | -------------------------------------------------------------------------------- /packages/react-native-dom/flow-typed/local/flow-utils.js: -------------------------------------------------------------------------------- 1 | declare type _ExtractReturn B> = B; 2 | declare type ExtractReturn = _ExtractReturn<*, F>; 3 | 4 | declare type _ExtractPromise> = B; 5 | declare type ExtractPromise

= _ExtractPromise<*, P>; 6 | 7 | type ExtractAsyncModule = $Call<(() => Promise>) => T, R>; 8 | -------------------------------------------------------------------------------- /packages/react-native-dom/flow-typed/local/pointer-events.js: -------------------------------------------------------------------------------- 1 | declare module "pepjs" { 2 | } 3 | 4 | declare class PointerEvent extends MouseEvent { 5 | +pointerId: number; 6 | +width: number; 7 | +height: number; 8 | +pressure: number; 9 | +tangentialPressure: number; 10 | +tiltX: number; 11 | +tiltY: number; 12 | +twist: number; 13 | +pointerType: "mouse" | "pen" | "touch"; 14 | +isPrimary: boolean; 15 | +which: number; 16 | getCoalescedEvents(): PointerEvent[]; 17 | } 18 | -------------------------------------------------------------------------------- /packages/react-native-dom/flow-typed/local/waapi.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | declare type AnimationEasing = 4 | | "linear" 5 | | "ease" 6 | | "ease-in" 7 | | "ease-out" 8 | | "ease-in-out" 9 | | string; 10 | 11 | declare type AnimationFill = "none" | "backwards" | "forwards"; 12 | 13 | declare type KeyframeOptions = { 14 | delay?: number, 15 | direction?: number, 16 | duration?: number, 17 | easing?: AnimationEasing, 18 | endDelay?: number, 19 | fill?: AnimationFill, 20 | iterationStart?: number, 21 | iterations?: number 22 | }; 23 | 24 | declare class KeyframeEffect { 25 | constructor( 26 | element: HTMLElement, 27 | keyframes: any[], 28 | config: KeyframeOptions 29 | ): KeyframeEffect; 30 | } 31 | 32 | declare class GroupEffect { 33 | constructor(kEffects: KeyframeEffect[]): GroupEffect; 34 | } 35 | -------------------------------------------------------------------------------- /packages/react-native-dom/flow-typed/npm/detect-it_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: fbda683ea8c301543ab7d65d3d98a017 2 | // flow-typed version: <>/detect-it_v3.x.x/flow_v0.47.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'detect-it' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module "detect-it" { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module "detect-it/lib/index" { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module "detect-it/src/index" { 30 | declare module.exports: any; 31 | } 32 | 33 | // Filename aliases 34 | declare module "detect-it/lib/index.js" { 35 | declare module.exports: $Exports<"detect-it/lib/index">; 36 | } 37 | declare module "detect-it/src/index.js" { 38 | declare module.exports: $Exports<"detect-it/src/index">; 39 | } 40 | -------------------------------------------------------------------------------- /packages/react-native-dom/flow-typed/npm/idb-keyval_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: fed14d51bc7e904a1b604588cd47b4fe 2 | // flow-typed version: <>/idb-keyval_v3.0.5/flow_v0.75.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'idb-keyval' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'idb-keyval' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'idb-keyval/dist/idb-keyval-cjs' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'idb-keyval/dist/idb-keyval-iife-compat.min' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'idb-keyval/dist/idb-keyval-iife' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'idb-keyval/dist/idb-keyval-iife.min' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'idb-keyval/rollup.config' { 42 | declare module.exports: any; 43 | } 44 | 45 | // Filename aliases 46 | declare module 'idb-keyval/dist/idb-keyval-cjs.js' { 47 | declare module.exports: $Exports<'idb-keyval/dist/idb-keyval-cjs'>; 48 | } 49 | declare module 'idb-keyval/dist/idb-keyval-iife-compat.min.js' { 50 | declare module.exports: $Exports<'idb-keyval/dist/idb-keyval-iife-compat.min'>; 51 | } 52 | declare module 'idb-keyval/dist/idb-keyval-iife.js' { 53 | declare module.exports: $Exports<'idb-keyval/dist/idb-keyval-iife'>; 54 | } 55 | declare module 'idb-keyval/dist/idb-keyval-iife.min.js' { 56 | declare module.exports: $Exports<'idb-keyval/dist/idb-keyval-iife.min'>; 57 | } 58 | declare module 'idb-keyval/rollup.config.js' { 59 | declare module.exports: $Exports<'idb-keyval/rollup.config'>; 60 | } 61 | -------------------------------------------------------------------------------- /packages/react-native-dom/flow-typed/npm/rndom-redbox.js: -------------------------------------------------------------------------------- 1 | declare module "rndom-redbox" { 2 | declare type RNDomRedboxEventListener = { handleEvent: Function } | Function; 3 | 4 | declare class Redbox extends HTMLElement { 5 | message: string; 6 | stack: any[]; 7 | 8 | addEventListener( 9 | type: string, 10 | listener: RNDomRedboxEventListener, 11 | optionsOrUseCapture?: EventListenerOptionsOrUseCapture 12 | ): void; 13 | } 14 | 15 | declare export default typeof Redbox; 16 | } 17 | -------------------------------------------------------------------------------- /packages/react-native-dom/flow-typed/npm/rndom-switch.js: -------------------------------------------------------------------------------- 1 | declare module "rndom-switch" { 2 | declare type RNDomSwitchEventListener = { handleEvent: Function } | Function; 3 | 4 | declare class RNDomSwitch extends HTMLElement { 5 | disabled: boolean; 6 | value: boolean; 7 | width: number; 8 | height: number; 9 | tintColor: ?string; 10 | onTintColor: ?string; 11 | thumbTintColor: ?string; 12 | 13 | addEventListener( 14 | type: string, 15 | listener: RNDomSwitchEventListener, 16 | optionsOrUseCapture?: EventListenerOptionsOrUseCapture 17 | ): void; 18 | } 19 | 20 | declare export default typeof RNDomSwitch; 21 | } 22 | -------------------------------------------------------------------------------- /packages/react-native-dom/jest/hasteImpl.js: -------------------------------------------------------------------------------- 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 | * @flow 8 | */ 9 | 10 | "use strict"; 11 | 12 | const path = require("path"); 13 | 14 | const ROOTS = [ 15 | path.join(__dirname, "..", "node_modules/react-native") + path.sep, 16 | path.join(__dirname, "..") + path.sep 17 | ]; 18 | 19 | const BLACKLISTED_PATTERNS /*: Array*/ = [ 20 | /.*[\\\/]__(mocks|tests)__[\\\/].*/, 21 | /^Libraries[\\\/]Animated[\\\/]src[\\\/]polyfills[\\\/].*/, 22 | /^Libraries[\\\/]Renderer[\\\/]fb[\\\/].*/ 23 | ]; 24 | 25 | const WHITELISTED_PREFIXES /*: Array*/ = [ 26 | "IntegrationTests", 27 | "Libraries", 28 | "ReactAndroid", 29 | "RNTester", 30 | "ReactDom" 31 | ]; 32 | 33 | const NAME_REDUCERS /*: Array<[RegExp, string]>*/ = [ 34 | // extract basename 35 | [/^(?:.*[\\\/])?([a-zA-Z0-9$_.-]+)$/, "$1"], 36 | // strip .js/.js.flow suffix 37 | [/^(.*)\.js(\.flow)?$/, "$1"], 38 | // strip platform suffix 39 | [/^(.*)\.(android|ios|native|dom)$/, "$1"] 40 | ]; 41 | 42 | const haste = { 43 | /* 44 | * @return {string|void} hasteName for module at filePath; or undefined if 45 | * filePath is not a haste module 46 | */ 47 | getHasteName( 48 | filePath /*: string */, 49 | sourceCode /*: ?string */ 50 | ) /*: string | void */ { 51 | if (!isHastePath(filePath)) { 52 | return undefined; 53 | } 54 | 55 | const hasteName = NAME_REDUCERS.reduce( 56 | (name, [pattern, replacement]) => name.replace(pattern, replacement), 57 | filePath 58 | ); 59 | 60 | return hasteName; 61 | } 62 | }; 63 | 64 | function isHastePath(filePath /*: string */) /*: boolean */ { 65 | if (!filePath.endsWith(".js") && !filePath.endsWith(".js.flow")) { 66 | return false; 67 | } 68 | 69 | const root = ROOTS.find((r) => filePath.startsWith(r)); 70 | if (!root) { 71 | return false; 72 | } 73 | 74 | filePath = filePath.substr(root.length); 75 | console.log(filePath); 76 | if (BLACKLISTED_PATTERNS.some((pattern) => pattern.test(filePath))) { 77 | return false; 78 | } 79 | return WHITELISTED_PREFIXES.some((prefix) => filePath.startsWith(prefix)); 80 | } 81 | 82 | module.exports = haste; 83 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/.npmignore: -------------------------------------------------------------------------------- 1 | # make sure rnpm folder is not published 2 | rnpm/ -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/constants.js: -------------------------------------------------------------------------------- 1 | exports.NATIVE_MODULE_IDENT = "RN_DOM_VENDOR_NATIVE_MODULES"; 2 | exports.RN_MAIN_PJSON_NAME = "rn:main"; 3 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/core/dom/findDepConfigPath.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const glob = require("glob"); 3 | const path = require("path"); 4 | 5 | const DEP_CONFIG_FILENAME = "domDependencyConfig.json"; 6 | 7 | module.exports = function findDependencyConfigPath(folder) { 8 | const depConfigPaths = glob.sync(path.join("**", DEP_CONFIG_FILENAME), { 9 | cwd: folder, 10 | ignore: [ 11 | "node_modules/**", 12 | "**/build/**", 13 | "Examples/**", 14 | "examples/**", 15 | "**/bin/**", 16 | "**/obj/**", 17 | "**/dist/**" 18 | ] 19 | }); 20 | 21 | if (depConfigPaths.length === 0) { 22 | throw new Error( 23 | `Could not find ${DEP_CONFIG_FILENAME} in your project, please add it.` 24 | ); 25 | } 26 | 27 | if (depConfigPaths.length > 1) { 28 | throw new Error( 29 | `Multiple ${DEP_CONFIG_FILENAME} files found: [${depConfigPaths.join( 30 | ", " 31 | )}]` 32 | ); 33 | } 34 | 35 | return path.join(folder, depConfigPaths[0]); 36 | }; 37 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/core/dom/findVendorModulePath.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const glob = require("glob"); 3 | const path = require("path"); 4 | 5 | const { NATIVE_MODULE_IDENT } = require("../../constants"); 6 | 7 | module.exports = function findVendorModulePath(folder) { 8 | const jsPaths = glob.sync(path.join("**", "*.js"), { 9 | cwd: folder, 10 | ignore: [ 11 | "node_modules/**", 12 | "**/build/**", 13 | "Examples/**", 14 | "examples/**", 15 | "**/bin/**", 16 | "**/obj/**", 17 | "**/dist/**" 18 | ] 19 | }); 20 | 21 | // Search for file that contains usage of `new RNDomInstance` 22 | for (var filePath of jsPaths) { 23 | const file = fs.readFileSync(path.join(folder, filePath), "utf8"); 24 | if (file.includes(NATIVE_MODULE_IDENT)) { 25 | return path.join(folder, filePath); 26 | } 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/core/dom/getDomRequirePath.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const fs = require("fs"); 3 | const glob = require("glob"); 4 | 5 | const { RN_MAIN_PJSON_NAME } = require("../../constants"); 6 | 7 | module.exports = function getDomRequirePath(folder) { 8 | const packageName = path.basename(folder); 9 | 10 | const pJsons = glob.sync(path.join("**", "package.json"), { 11 | cwd: folder, 12 | ignore: ["node_modules/**", "ios/**", "android/**"] 13 | }); 14 | 15 | for (pJsonPath of pJsons) { 16 | const fullPath = path.join(folder, pJsonPath); 17 | const pJson = JSON.parse(fs.readFileSync(fullPath, "utf8")); 18 | 19 | if (pJson.hasOwnProperty(RN_MAIN_PJSON_NAME)) { 20 | return path.join(packageName, path.dirname(pJsonPath)); 21 | } 22 | } 23 | 24 | const defaultDomLocation = path.join(packageName, "dom"); 25 | 26 | try { 27 | require.resolve(defaultDomLocation); 28 | return defaultDomLocation; 29 | } catch (err) { 30 | /* NO OP */ 31 | } 32 | 33 | return null; 34 | }; 35 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/core/dom/index.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | 3 | const findDependencyConfigPath = require("./findDepConfigPath"); 4 | const findVendorModulePath = require("./findVendorModulePath"); 5 | const getDomRequirePath = require("./getDomRequirePath"); 6 | 7 | exports.projectConfig = function projectConfigDom(folder, userConfig) { 8 | const depConfigPath = 9 | userConfig.depConfigPath || findDependencyConfigPath(folder); 10 | 11 | const vendorModulePath = 12 | userConfig.bootstrapPath || findVendorModulePath(folder); 13 | 14 | const nodeModulesFolder = path.join(folder, "node_modules"); 15 | 16 | return { 17 | depConfigPath, 18 | vendorModulePath, 19 | nodeModulesFolder 20 | }; 21 | }; 22 | 23 | exports.dependencyConfig = function dependencyConfigDom(folder, userConfig) { 24 | const requirePath = getDomRequirePath(folder); 25 | 26 | if (requirePath == null) return null; 27 | 28 | return { requirePath: requirePath }; 29 | }; 30 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/generate-dom.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const fs = require("fs"); 4 | const path = require("path"); 5 | const yeoman = require("yeoman-environment"); 6 | 7 | function generateDom(projectDir, name, verbose) { 8 | const oldCwd = process.cwd(); 9 | 10 | if (!fs.existsSync(projectDir)) { 11 | fs.mkdirSync(projectDir); 12 | } 13 | 14 | const env = yeoman.createEnv(); 15 | const generatorPath = path.join(__dirname, "generator-dom"); 16 | env.register(generatorPath, "react:dom"); 17 | const args = ["react:dom", name].concat(process.argv.slice(4)); 18 | env.run(args, { verbose: verbose }, function() { 19 | process.chdir(oldCwd); 20 | }); 21 | } 22 | 23 | module.exports = generateDom; 24 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/generator-dom/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const path = require("path"); 4 | const fs = require("fs"); 5 | const Generator = require("yeoman-generator"); 6 | 7 | const utils = require("../generator-utils"); 8 | 9 | const REACT_NATIVE_PACKAGE_JSON_PATH = () => { 10 | return path.resolve( 11 | process.cwd(), 12 | "node_modules", 13 | "react-native", 14 | "package.json" 15 | ); 16 | }; 17 | 18 | module.exports = class extends Generator { 19 | constructor(args, opts) { 20 | super(args, opts); 21 | 22 | this.argument("name", { type: String, required: true }); 23 | 24 | this.option("verbose", { 25 | desc: "Enables logging", 26 | type: Boolean, 27 | defaults: false 28 | }); 29 | } 30 | 31 | configuring() { 32 | this.fs.copy( 33 | this.templatePath("_gitignore"), 34 | this.destinationPath(path.join("dom", ".gitignore")) 35 | ); 36 | } 37 | 38 | writting() { 39 | const templateVars = { name: this.name }; 40 | 41 | this.fs.copyTpl( 42 | this.templatePath("bootstrap.js"), 43 | this.destinationPath(path.join("dom", "bootstrap.js")), 44 | templateVars 45 | ); 46 | 47 | this.fs.copyTpl( 48 | this.templatePath("entry.js"), 49 | this.destinationPath(path.join("dom", "entry.js")), 50 | templateVars 51 | ); 52 | 53 | this.fs.copyTpl( 54 | this.templatePath("index.html"), 55 | this.destinationPath(path.join("dom", "index.html")), 56 | templateVars 57 | ); 58 | } 59 | 60 | end() { 61 | this.log("To run your app on the browser:"); 62 | this.log(" react-native run-dom"); 63 | } 64 | }; 65 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/generator-dom/templates/App.dom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import React, { Component } from "react"; 8 | import { Platform, StyleSheet, Text, View } from "react-native"; 9 | 10 | const instructions = "Press Ctrl/Cmd+R to reload,\n" + "Shift+F10 for dev menu"; 11 | 12 | export default class App extends Component<{}> { 13 | render() { 14 | return ( 15 | 16 | Welcome to React Native! 17 | To get started, edit App.dom.js 18 | {instructions} 19 | 20 | ); 21 | } 22 | } 23 | 24 | const styles = StyleSheet.create({ 25 | container: { 26 | flex: 1, 27 | justifyContent: "center", 28 | alignItems: "center", 29 | backgroundColor: "#F5FCFF" 30 | }, 31 | welcome: { 32 | fontSize: 20, 33 | textAlign: "center", 34 | margin: 10 35 | }, 36 | instructions: { 37 | textAlign: "center", 38 | color: "#333333", 39 | marginBottom: 5 40 | } 41 | }); 42 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/generator-dom/templates/_gitignore: -------------------------------------------------------------------------------- 1 | # react-native-dom build artifacts 2 | dist -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/generator-dom/templates/bootstrap.js: -------------------------------------------------------------------------------- 1 | import { RNDomInstance } from "react-native-dom"; 2 | import { name as appName } from "../app.json"; 3 | 4 | // Path to RN Bundle Entrypoint ================================================ 5 | const rnBundlePath = "./entry.bundle?platform=dom&dev=true"; 6 | 7 | // React Native DOM Runtime Options ============================================= 8 | const ReactNativeDomOptions = { 9 | enableHotReload: false, 10 | nativeModules: [] 11 | }; 12 | 13 | // App Initialization ============================================================ 14 | const app = new RNDomInstance( 15 | rnBundlePath, 16 | appName, 17 | document.body, 18 | ReactNativeDomOptions 19 | ); 20 | 21 | app.start(); 22 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/generator-dom/templates/entry.js: -------------------------------------------------------------------------------- 1 | // Just import and run the top-level app 2 | import "../index"; 3 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/generator-dom/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%= name %> 6 | 7 | 8 | 9 | 10 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/generator-utils.js: -------------------------------------------------------------------------------- 1 | "use-strict"; 2 | 3 | const path = require("path"); 4 | const fs = require("fs"); 5 | 6 | function validatePackageName(name) { 7 | if (!name.match(/^[$A-Z_][0-9A-Z_$]*$/i)) { 8 | console.error( 9 | '"%s" is not a valid name for a project. Please use a valid identifier ' + 10 | "name (alphanumeric).", 11 | name 12 | ); 13 | process.exit(1); 14 | } 15 | } 16 | 17 | function getPackageJson() { 18 | const packagePath = path.resolve(process.cwd(), "package.json"); 19 | 20 | if (!fs.existsSync(packagePath)) { 21 | console.error("package.json file could not be found in %s", process.cwd()); 22 | process.exit(1); 23 | } 24 | 25 | let pkg; 26 | try { 27 | pkg = JSON.parse(fs.readFileSync(packagePath, "utf8")); 28 | } catch (err) { 29 | console.error("Could not parse project package.json"); 30 | console.error(err.message); 31 | process.exit(1); 32 | } 33 | 34 | return pkg; 35 | } 36 | 37 | function getExistingProjectName() { 38 | const pkg = getPackageJson(); 39 | 40 | if (pkg.name == null) { 41 | console.error("project does not have a name in its package.json"); 42 | process.exit(1); 43 | } 44 | 45 | return pkg.name; 46 | } 47 | 48 | module.exports = { 49 | validatePackageName: validatePackageName, 50 | getPackageJson: getPackageJson, 51 | getExistingProjectName: getExistingProjectName 52 | }; 53 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = [require("./runDom/runDom")]; 4 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/link/dom/getDependencyConfig.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | 3 | module.exports = function getDependencyConfig(depConfigPath) { 4 | const rawConfig = fs.readFileSync(depConfigPath, "utf8"); 5 | return JSON.parse(rawConfig); 6 | }; 7 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/link/dom/isInstalled.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const path = require("path"); 3 | 4 | const getDependencyConfig = require("./getDependencyConfig"); 5 | 6 | function isDependencyIncluded(requirePath, vendorModulePath) { 7 | const vendorModuleContents = fs.readFileSync(vendorModulePath, "utf8"); 8 | return vendorModuleContents.includes(requirePath); 9 | } 10 | 11 | module.exports = function isInstalled(config, dependencyConfig) { 12 | const { depConfigPath, vendorModulePath } = config; 13 | 14 | const depConfig = getDependencyConfig(depConfigPath); 15 | 16 | if (depConfig.hasOwnProperty(dependencyConfig)) { 17 | const requirePath = depConfig[dependencyConfig]; 18 | return isDependencyIncluded(requirePath, vendorModulePath); 19 | } 20 | 21 | return false; 22 | }; 23 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/link/dom/registerNativeModule.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const path = require("path"); 3 | const glob = require("glob"); 4 | 5 | const getDependencyConfig = require("./getDependencyConfig"); 6 | const updateDependencyConfig = require("./updateDependencyConfig"); 7 | const updateVendorModule = require("./updateVendorModuleFile"); 8 | 9 | module.exports = function registerNativeDomModule( 10 | name, 11 | domConfig, 12 | params, 13 | projectConfig 14 | ) { 15 | if (!name.startsWith("react-native") || name === "react-native-dom") return; 16 | 17 | const requirePath = domConfig.requirePath; 18 | 19 | // Add to domDependencyConfig.json 20 | const depConfig = getDependencyConfig(projectConfig.depConfigPath); 21 | depConfig[name] = requirePath; 22 | updateDependencyConfig(depConfig, projectConfig.depConfigPath); 23 | 24 | // Re-generate vendor module file 25 | updateVendorModule(depConfig, projectConfig.vendorModulePath); 26 | }; 27 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/link/dom/unregisterNativeModule.js: -------------------------------------------------------------------------------- 1 | const getDependencyConfig = require("./getDependencyConfig"); 2 | const updateVendorModule = require("./updateVendorModuleFile"); 3 | const updateDependencyConfig = require("./updateDependencyConfig"); 4 | 5 | module.exports = function unregisterNativeDomModule( 6 | name, 7 | domConfig, 8 | projectConfig 9 | ) { 10 | const depConfig = getDependencyConfig(projectConfig.depConfigPath); 11 | delete depConfig[name]; 12 | 13 | updateDependencyConfig(depConfig, projectConfig.depConfigPath); 14 | updateVendorModule(depConfig, projectConfig.vendorModulePath); 15 | }; 16 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/link/dom/updateDependencyConfig.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | 3 | module.exports = function updateDependencyConfig(config, path) { 4 | fs.writeFileSync(path, JSON.stringify(config, null, " ")); 5 | }; 6 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/link/dom/updateVendorModuleFile.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const template = require("@babel/template").default; 3 | const generate = require("@babel/generator").default; 4 | const t = require("@babel/types"); 5 | 6 | const { NATIVE_MODULE_IDENT } = require("../../constants"); 7 | 8 | const buildModule = template( 9 | ` 10 | const ${NATIVE_MODULE_IDENT} = SOURCE_ARRAY; 11 | export default ${NATIVE_MODULE_IDENT}; 12 | `, 13 | { 14 | placeholderPattern: /^SOURCE_ARRAY$/ 15 | } 16 | ); 17 | 18 | function buildSourceArray(dependencyConfig) { 19 | const elements = []; 20 | for (let depName in dependencyConfig) { 21 | const requirePath = dependencyConfig[depName]; 22 | elements.push(template.expression(`require("${requirePath}")`)()); 23 | } 24 | return t.arrayExpression(elements); 25 | } 26 | 27 | module.exports = function updateVendorModule( 28 | dependencyConfig, 29 | vendorModulePath 30 | ) { 31 | const sourceArray = buildSourceArray(dependencyConfig); 32 | 33 | const ast = buildModule({ 34 | SOURCE_ARRAY: sourceArray 35 | }); 36 | const code = generate(t.program(ast)).code; 37 | 38 | fs.writeFileSync(vendorModulePath, code); 39 | }; 40 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/link/index.js: -------------------------------------------------------------------------------- 1 | exports.linkConfig = function() { 2 | return { 3 | isInstalled: require("./dom/isInstalled"), 4 | register: require("./dom/registerNativeModule"), 5 | unregister: require("./dom/unregisterNativeModule") 6 | }; 7 | }; 8 | -------------------------------------------------------------------------------- /packages/react-native-dom/local-cli/platform.js: -------------------------------------------------------------------------------- 1 | let config = {}; 2 | 3 | Object.assign(config, require("./core/dom")); 4 | Object.assign(config, require("./link")); 5 | 6 | module.exports = { dom: config }; 7 | -------------------------------------------------------------------------------- /packages/react-native-dom/metro.config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var path = require("path"); 4 | 5 | var config = { 6 | projectRoot: path.resolve(__dirname, "../.."), 7 | resolver: { 8 | hasteImplModulePath: require.resolve("./jest/hasteImpl"), 9 | platforms: ["dom"], 10 | providesModuleNodeModules: ["react-native-dom"], 11 | extraNodeModules: { 12 | "react-native-dom": __dirname, 13 | "react-native": path.resolve(__dirname, "./node_modules/react-native") 14 | } 15 | } 16 | }; 17 | 18 | module.exports = config; 19 | -------------------------------------------------------------------------------- /packages/react-native-dom/now.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rntester", 3 | "type": "static", 4 | "files": ["dist"], 5 | "static": { 6 | "public": "dist", 7 | "headers": [ 8 | { 9 | "source": "**/*.@(jpg|jpeg|gif|png|bundle)", 10 | "headers": [{ "key": "Cache-Control", "value": "max-age=7200" }] 11 | }, 12 | { 13 | "source": "**/*.@(bundle)", 14 | "headers": [{ "key": "Content-Type", "value": "text/javascript" }] 15 | } 16 | ] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/react-native-dom/scripts/eslint-module-resolver-haste.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const fs = require("fs"); 3 | 4 | const opts = { 5 | include: [path.resolve(__dirname, "..", "ReactDom")], 6 | extensions: [".js"] 7 | }; 8 | 9 | function buildModuleMap(opts) { 10 | const hasteMap = {}; 11 | const walk = function(file) { 12 | const stat = fs.statSync(file); 13 | if (stat.isDirectory()) { 14 | fs.readdirSync(file).forEach(function(file0) { 15 | if ( 16 | file0.indexOf([ 17 | // blacklist 18 | "node_modules", 19 | "__tests__", 20 | "__mocks__", 21 | "__fixtures__" 22 | ]) >= 0 23 | ) { 24 | return; 25 | } 26 | walk(file + "/" + file0); 27 | }); 28 | return; 29 | } 30 | if (stat.isFile()) { 31 | let fileName = (/^(.*)\.js$/.exec(file) || [])[1]; 32 | if (!fileName) { 33 | return; 34 | } 35 | const m = /^(.*)\.(\w+)$/.exec(fileName); 36 | if (m && ["ios", "android", "native", "dom"].indexOf(m[2]) >= 0) { 37 | fileName = m[1]; 38 | } 39 | const content = fs.readFileSync(file, "utf-8"); 40 | const moduleName = fileName.replace(/^.*[\\\/]/, ""); 41 | if (hasteMap[moduleName] && hasteMap[moduleName] !== fileName) { 42 | throw new Error( 43 | "Duplicate haste module: " + 44 | moduleName + 45 | " in files: " + 46 | fileName + 47 | " & " + 48 | hasteMap[moduleName] 49 | ); 50 | } 51 | hasteMap[moduleName] = file; 52 | } 53 | }; 54 | 55 | opts.include.forEach((root) => { 56 | const dir = root.replace(/\/\*\*$/, ""); 57 | walk(dir); 58 | }); 59 | 60 | return hasteMap; 61 | } 62 | 63 | const moduleMap = buildModuleMap(opts); 64 | 65 | function mapModule(state, module) { 66 | if (moduleMap.hasOwnProperty(module)) { 67 | const currentDir = path.dirname( 68 | path.resolve(__dirname, "..", state.file.opts.filename) 69 | ); 70 | const relativePath = path.relative(currentDir, moduleMap[module]); 71 | return "./" + relativePath; 72 | } 73 | return null; 74 | } 75 | 76 | module.exports = { 77 | interfaceVersion: 2, 78 | resolve(source, file, config) { 79 | if (moduleMap.hasOwnProperty(source)) { 80 | return { found: true, path: moduleMap[source] }; 81 | } else { 82 | return { found: false }; 83 | } 84 | } 85 | }; 86 | -------------------------------------------------------------------------------- /packages/rndom-redbox/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | public/bundle.* 4 | lib 5 | package-lock.json 6 | yarn.lock -------------------------------------------------------------------------------- /packages/rndom-redbox/.npmignore: -------------------------------------------------------------------------------- 1 | .babelrc -------------------------------------------------------------------------------- /packages/rndom-redbox/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | # [0.3.0](https://github.com/vincentriemer/react-native-dom/compare/v0.2.0...v0.3.0) (2018-09-13) 8 | 9 | 10 | ### Features 11 | 12 | * Add support for RN 0.57 ([#73](https://github.com/vincentriemer/react-native-dom/issues/73)) ([313b00e](https://github.com/vincentriemer/react-native-dom/commit/313b00e)) 13 | -------------------------------------------------------------------------------- /packages/rndom-redbox/README.md: -------------------------------------------------------------------------------- 1 | # React Native DOM Redbox 2 | -------------------------------------------------------------------------------- /packages/rndom-redbox/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rndom-redbox", 3 | "version": "0.5.0", 4 | "license": "MIT", 5 | "author": { 6 | "name": "Vincent Riemer", 7 | "email": "vincentriemer+rndom@gmail.com", 8 | "url": "https://vincentriemer.com" 9 | }, 10 | "files": [ 11 | "lib" 12 | ], 13 | "main": "lib/rndom-redbox.js", 14 | "module": "lib/rndom-redbox.m.js", 15 | "scripts": { 16 | "precompile": "shx rm -rf lib", 17 | "compile": "rollup -c", 18 | "dev": "serve public & rollup -c -w", 19 | "prepublishOnly": "yarn compile", 20 | "start": "serve public", 21 | "test": "shx echo 'no tests written :('" 22 | }, 23 | "dependencies": { 24 | "@babel/runtime": "^7.0.0" 25 | }, 26 | "devDependencies": { 27 | "@babel/core": "^7.0.0", 28 | "@babel/plugin-transform-runtime": "^7.0.0", 29 | "metro-react-native-babel-preset": "^0.49.0", 30 | "rollup": "^0.65.2", 31 | "rollup-plugin-babel": "^4.0.3", 32 | "rollup-plugin-commonjs": "^9.1.0", 33 | "rollup-plugin-node-resolve": "^3.0.3", 34 | "rollup-plugin-svelte": "^4.3.0", 35 | "rollup-plugin-terser": "^2.0.2", 36 | "serve": "^7.0.0", 37 | "svelte": "^2.13.4" 38 | }, 39 | "umd:main": "lib/rndom-redbox.umd.js" 40 | } 41 | -------------------------------------------------------------------------------- /packages/rndom-redbox/public/global.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | position: relative; 4 | width: 100%; 5 | height: 100%; 6 | } 7 | 8 | body { 9 | color: #333; 10 | margin: 0; 11 | padding: 8px; 12 | box-sizing: border-box; 13 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 14 | Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; 15 | } 16 | 17 | a { 18 | color: rgb(0, 100, 200); 19 | text-decoration: none; 20 | } 21 | 22 | a:hover { 23 | text-decoration: underline; 24 | } 25 | 26 | a:visited { 27 | color: rgb(0, 80, 160); 28 | } 29 | 30 | label { 31 | display: block; 32 | } 33 | 34 | input, 35 | button, 36 | select, 37 | textarea { 38 | font-family: inherit; 39 | font-size: inherit; 40 | padding: 0.4em; 41 | margin: 0 0 0.5em 0; 42 | box-sizing: border-box; 43 | border: 1px solid #ccc; 44 | border-radius: 2px; 45 | } 46 | 47 | input:disabled { 48 | color: #ccc; 49 | } 50 | 51 | input[type="range"] { 52 | height: 0; 53 | } 54 | 55 | button { 56 | background-color: #f4f4f4; 57 | outline: none; 58 | } 59 | 60 | button:active { 61 | background-color: #ddd; 62 | } 63 | 64 | button:focus { 65 | border-color: #666; 66 | } 67 | -------------------------------------------------------------------------------- /packages/rndom-redbox/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | RNDom Switch 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/rndom-redbox/rollup.config.js: -------------------------------------------------------------------------------- 1 | import svelte from "rollup-plugin-svelte"; 2 | import resolve from "rollup-plugin-node-resolve"; 3 | import commonjs from "rollup-plugin-commonjs"; 4 | import babel from "rollup-plugin-babel"; 5 | import { terser } from "rollup-plugin-terser"; 6 | 7 | import pjson from "./package.json"; 8 | 9 | const production = !process.env.ROLLUP_WATCH; 10 | 11 | const baseConfig = { 12 | input: "src/index.svelte", 13 | plugins: [ 14 | svelte({ 15 | // enable run-time checks when not in production 16 | dev: !production, 17 | customElement: true 18 | }), 19 | 20 | // If you have external dependencies installed from 21 | // npm, you'll most likely need these plugins. In 22 | // some cases you'll need additional configuration — 23 | // consult the documentation for details: 24 | // https://github.com/rollup/rollup-plugin-commonjs 25 | resolve(), 26 | commonjs(), 27 | 28 | // If we're building for production (npm run build 29 | // instead of npm run dev), transpile and minify 30 | production && 31 | babel({ 32 | exclude: "node_modules/**", 33 | runtimeHelpers: true, 34 | presets: [ 35 | [ 36 | "module:metro-react-native-babel-preset", 37 | { disableImportExportTransform: true } 38 | ] 39 | ], 40 | plugins: ["@babel/transform-runtime"] 41 | }), 42 | production && terser() 43 | ] 44 | }; 45 | 46 | const baseOutput = { 47 | sourcemap: true, 48 | name: "RNDomRedbox" 49 | }; 50 | 51 | const entryPoints = ["main", "umd:main", "module"]; 52 | 53 | const formats = { 54 | main: "cjs", 55 | "umd:main": "umd", 56 | module: "es" 57 | }; 58 | 59 | const createConfig = (format, file) => ({ 60 | ...baseConfig, 61 | output: { 62 | ...baseOutput, 63 | format, 64 | file 65 | } 66 | }); 67 | 68 | export default entryPoints 69 | .map((entry) => { 70 | const path = pjson[entry]; 71 | if (path) { 72 | return createConfig(formats[entry], path); 73 | } 74 | return null; 75 | }) 76 | .concat([createConfig("iife", "public/bundle.js")]); 77 | -------------------------------------------------------------------------------- /packages/rndom-switch/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | public/bundle.* 4 | lib 5 | package-lock.json 6 | yarn.lock -------------------------------------------------------------------------------- /packages/rndom-switch/.npmignore: -------------------------------------------------------------------------------- 1 | .babelrc -------------------------------------------------------------------------------- /packages/rndom-switch/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | # [0.3.0](https://github.com/vincentriemer/react-native-dom/compare/v0.2.0...v0.3.0) (2018-09-13) 8 | 9 | 10 | ### Features 11 | 12 | * Add support for RN 0.57 ([#73](https://github.com/vincentriemer/react-native-dom/issues/73)) ([313b00e](https://github.com/vincentriemer/react-native-dom/commit/313b00e)) 13 | -------------------------------------------------------------------------------- /packages/rndom-switch/README.md: -------------------------------------------------------------------------------- 1 | # React Native DOM Switch 2 | -------------------------------------------------------------------------------- /packages/rndom-switch/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rndom-switch", 3 | "version": "0.5.0", 4 | "license": "MIT", 5 | "author": { 6 | "name": "Vincent Riemer", 7 | "email": "vincentriemer+rndom@gmail.com", 8 | "url": "https://vincentriemer.com" 9 | }, 10 | "files": [ 11 | "lib" 12 | ], 13 | "main": "lib/rndom-switch.js", 14 | "module": "lib/rndom-switch.m.js", 15 | "scripts": { 16 | "precompile": "shx rm -rf lib", 17 | "compile": "rollup -c", 18 | "dev": "serve public & rollup -c -w", 19 | "prepublishOnly": "yarn compile", 20 | "start": "serve public", 21 | "test": "shx echo 'no tests written :('" 22 | }, 23 | "dependencies": { 24 | "@babel/runtime": "^7.0.0" 25 | }, 26 | "devDependencies": { 27 | "@babel/core": "^7.0.0", 28 | "@babel/plugin-transform-runtime": "^7.0.0", 29 | "metro-react-native-babel-preset": "^0.49.0", 30 | "rollup": "^0.65.2", 31 | "rollup-plugin-babel": "^4.0.3", 32 | "rollup-plugin-commonjs": "^9.1.0", 33 | "rollup-plugin-node-resolve": "^3.0.3", 34 | "rollup-plugin-svelte": "^4.3.0", 35 | "rollup-plugin-terser": "^2.0.2", 36 | "serve": "^7.0.0", 37 | "svelte": "^2.13.4" 38 | }, 39 | "umd:main": "lib/rndom-switch.umd.js" 40 | } 41 | -------------------------------------------------------------------------------- /packages/rndom-switch/public/global.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | position: relative; 4 | width: 100%; 5 | height: 100%; 6 | } 7 | 8 | body { 9 | color: #333; 10 | margin: 0; 11 | padding: 8px; 12 | box-sizing: border-box; 13 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 14 | Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; 15 | } 16 | 17 | a { 18 | color: rgb(0, 100, 200); 19 | text-decoration: none; 20 | } 21 | 22 | a:hover { 23 | text-decoration: underline; 24 | } 25 | 26 | a:visited { 27 | color: rgb(0, 80, 160); 28 | } 29 | 30 | label { 31 | display: block; 32 | } 33 | 34 | input, 35 | button, 36 | select, 37 | textarea { 38 | font-family: inherit; 39 | font-size: inherit; 40 | padding: 0.4em; 41 | margin: 0 0 0.5em 0; 42 | box-sizing: border-box; 43 | border: 1px solid #ccc; 44 | border-radius: 2px; 45 | } 46 | 47 | input:disabled { 48 | color: #ccc; 49 | } 50 | 51 | input[type="range"] { 52 | height: 0; 53 | } 54 | 55 | button { 56 | background-color: #f4f4f4; 57 | outline: none; 58 | } 59 | 60 | button:active { 61 | background-color: #ddd; 62 | } 63 | 64 | button:focus { 65 | border-color: #666; 66 | } 67 | -------------------------------------------------------------------------------- /packages/rndom-switch/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | RNDom Switch 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/rndom-switch/rollup.config.js: -------------------------------------------------------------------------------- 1 | import svelte from "rollup-plugin-svelte"; 2 | import resolve from "rollup-plugin-node-resolve"; 3 | import commonjs from "rollup-plugin-commonjs"; 4 | import babel from "rollup-plugin-babel"; 5 | import { terser } from "rollup-plugin-terser"; 6 | 7 | import pjson from "./package.json"; 8 | 9 | const production = !process.env.ROLLUP_WATCH; 10 | 11 | const baseConfig = { 12 | input: "src/index.svelte", 13 | plugins: [ 14 | svelte({ 15 | // enable run-time checks when not in production 16 | dev: !production, 17 | customElement: true 18 | }), 19 | 20 | // If you have external dependencies installed from 21 | // npm, you'll most likely need these plugins. In 22 | // some cases you'll need additional configuration — 23 | // consult the documentation for details: 24 | // https://github.com/rollup/rollup-plugin-commonjs 25 | resolve(), 26 | commonjs(), 27 | 28 | // If we're building for production (npm run build 29 | // instead of npm run dev), transpile and minify 30 | production && 31 | babel({ 32 | exclude: "node_modules/**", 33 | runtimeHelpers: true, 34 | presets: [ 35 | [ 36 | "module:metro-react-native-babel-preset", 37 | { disableImportExportTransform: true } 38 | ] 39 | ], 40 | plugins: ["@babel/transform-runtime"] 41 | }), 42 | production && terser() 43 | ] 44 | }; 45 | 46 | const baseOutput = { 47 | sourcemap: true, 48 | name: "RNDomSwitch" 49 | }; 50 | 51 | const entryPoints = ["main", "umd:main", "module"]; 52 | 53 | const formats = { 54 | main: "cjs", 55 | "umd:main": "umd", 56 | module: "es" 57 | }; 58 | 59 | const createConfig = (format, file) => ({ 60 | ...baseConfig, 61 | output: { 62 | ...baseOutput, 63 | format, 64 | file 65 | } 66 | }); 67 | 68 | export default entryPoints 69 | .map((entry) => { 70 | const path = pjson[entry]; 71 | if (path) { 72 | return createConfig(formats[entry], path); 73 | } 74 | return null; 75 | }) 76 | .concat([createConfig("iife", "public/bundle.js")]); 77 | -------------------------------------------------------------------------------- /packages/rnpm-plugin-dom/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | 7 | # [0.3.0](https://github.com/vincentriemer/react-native-dom/compare/v0.2.0...v0.3.0) (2018-09-13) 8 | 9 | 10 | ### Features 11 | 12 | * **generator:** Add --exact option in preparation for smoke tests ([3e018d7](https://github.com/vincentriemer/react-native-dom/commit/3e018d7)) 13 | -------------------------------------------------------------------------------- /packages/rnpm-plugin-dom/README.md: -------------------------------------------------------------------------------- 1 | # RNPM Plugin for React Native DOM 2 | 3 | ## Project Initialization 4 | 5 | First, ensure you have the react-native CLI installed globally. 6 | 7 | ``` 8 | npm install -g react-native-cli 9 | # or 10 | yarn global add react-native-cli 11 | ``` 12 | 13 | Next, initialize your React Native project the way you typically do. 14 | 15 | ``` 16 | react-native init [project name] 17 | ``` 18 | 19 | Then, `cd` into your project and install `rnpm-plugin-dom` into your 20 | `devDependencies`, after which you can initialize your React Native DOM 21 | scaffolding with the `react-native dom` command. 22 | 23 | ``` 24 | npm install --save-dev rnpm-plugin-dom 25 | # or 26 | yarn add --dev rnpm-plugin-dom 27 | 28 | # Add DOM support to your React Native project 29 | react-native dom 30 | ``` 31 | 32 | ### Usage 33 | 34 | ``` 35 | react-native dom [name] [--domVersion ] [--includeCanary ] 36 | ``` 37 | -------------------------------------------------------------------------------- /packages/rnpm-plugin-dom/index.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | { 3 | func: require("./src/dom"), 4 | description: "Generate React Native DOM template project", 5 | name: "dom", 6 | options: [ 7 | { 8 | command: "--domVersion [version]", 9 | description: "The version of react-native-dom to use" 10 | }, 11 | { 12 | command: "--exact", 13 | description: "Install react-native-dom at an exact version" 14 | }, 15 | { 16 | command: "--verbose", 17 | description: "Enables logging", 18 | default: false 19 | }, 20 | { 21 | command: "--include-canary", 22 | description: 23 | "When resolving compatible react-native-dom versions, if canary releases should be considered", 24 | default: false 25 | } 26 | ] 27 | } 28 | ]; 29 | -------------------------------------------------------------------------------- /packages/rnpm-plugin-dom/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rnpm-plugin-dom", 3 | "version": "0.5.0", 4 | "description": "rnpm plugin that generates a DOM template project", 5 | "keywords": [ 6 | "react-native", 7 | "react-native-dom", 8 | "rnpm", 9 | "rnpm dom" 10 | ], 11 | "homepage": "https://github.com/vincentriemer/react-native-dom", 12 | "bugs": { 13 | "url": "https://github.com/vincentriemer/react-native-dom/issues" 14 | }, 15 | "license": "MIT", 16 | "main": "index.js", 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/vincentriemer/react-native-dom.git" 20 | }, 21 | "scripts": { 22 | "compile": "shx echo 'no compilation needed'", 23 | "test": "shx echo 'no tests written :('" 24 | }, 25 | "dependencies": { 26 | "npm-registry": "^0.1.13", 27 | "semver": "^5.5.0", 28 | "valid-url": "^1.0.9" 29 | }, 30 | "peerDependencies": { 31 | "react-native": ">=0.52.0" 32 | }, 33 | "engines": { 34 | "node": ">= 7.0.0" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /scripts/smoke.js: -------------------------------------------------------------------------------- 1 | const shell = require("shelljs"); 2 | const waitPort = require("wait-port"); 3 | 4 | const APP_NAME = "SmokeTest"; 5 | 6 | function throwError(message) { 7 | shell.echo(message); 8 | shell.exit(1); 9 | } 10 | 11 | function guardedExec(command, message) { 12 | if (shell.exec(command).code !== 0) { 13 | throwError(message); 14 | } 15 | } 16 | 17 | shell.rm("-rf", `/tmp/${APP_NAME}`); 18 | shell.cd("/tmp"); 19 | 20 | // Install React Native CLI 21 | guardedExec( 22 | "yarn global add react-native-cli", 23 | "Error: Failed to install React Native CLI" 24 | ); 25 | 26 | // Initialize new React Native Project 27 | guardedExec( 28 | `react-native init ${APP_NAME}`, 29 | "Error: Failed to initialize new React Native project" 30 | ); 31 | 32 | shell.cd(`/tmp/${APP_NAME}`); 33 | 34 | // Install RNDom's RNPM Plugin 35 | guardedExec( 36 | "yarn add --dev --exact rnpm-plugin-dom@canary", 37 | "Error: Failed to install rnpm-plugin-dom" 38 | ); 39 | 40 | // Bootstrap React Native DOM 41 | guardedExec( 42 | "react-native dom --exact --domVersion canary", 43 | "Error: Failed to bootstrap react-native-dom into new React Native project" 44 | ); 45 | 46 | // Start React Native Packager 47 | const packagerProcess = shell.exec("yarn start --reset-cache", { async: true }); 48 | 49 | // Wait for packager to be ready 50 | waitPort({ host: "localhost", port: 8081 }) 51 | .then((open) => { 52 | if (!open) throwError("Error: Waiting for RN Packager timed out"); 53 | 54 | guardedExec( 55 | "curl http://localhost:8081/dom/bootstrap.bundle?platform=dom -o temp.bundle", 56 | "Error: Failed to bundle main thread" 57 | ); 58 | shell.rm("-f", "temp.bundle"); 59 | 60 | guardedExec( 61 | "curl http://localhost:8081/dom/entry.bundle?platform=dom -o temp.bundle", 62 | "Error: Failed to bundle JS thread" 63 | ); 64 | shell.rm("-f", "temp.bundle"); 65 | 66 | packagerProcess.kill(); 67 | 68 | shell.echo("Sucesfully passed smoke test!"); 69 | shell.exit(0); 70 | }) 71 | .catch((err) => { 72 | console.error(err); 73 | throwError("Error: Waiting for RN Packager failed"); 74 | }); 75 | -------------------------------------------------------------------------------- /website/blog/2017-09-25-testing-rss.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Adding RSS Support - RSS Truncation Test 3 | author: Eric Nakagawa 4 | authorURL: http://twitter.com/ericnakagawa 5 | authorFBID: 661277173 6 | --- 7 | 8 | 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 9 | 10 | This should be truncated. 11 | 12 | 13 | 14 | This line should never render in XML. 15 | -------------------------------------------------------------------------------- /website/blog/2017-09-26-adding-rss.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Adding RSS Support 3 | author: Eric Nakagawa 4 | authorURL: http://twitter.com/ericnakagawa 5 | authorFBID: 661277173 6 | --- 7 | 8 | This is a test post. 9 | 10 | A whole bunch of other information. 11 | -------------------------------------------------------------------------------- /website/blog/2017-10-24-new-version-1.0.0.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: New Version 1.0.0 3 | author: Eric Nakagawa 4 | authorURL: http://twitter.com/ericnakagawa 5 | authorFBID: 661277173 6 | --- 7 | 8 | This blog post will test file name parsing issues when periods are present. 9 | -------------------------------------------------------------------------------- /website/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "examples": "docusaurus-examples", 4 | "start": "docusaurus-start", 5 | "build": "docusaurus-build", 6 | "publish-gh-pages": "docusaurus-publish", 7 | "write-translations": "docusaurus-write-translations", 8 | "version": "docusaurus-version", 9 | "rename-version": "docusaurus-rename-version" 10 | }, 11 | "dependencies": { 12 | "react-iframe": "^1.2.0" 13 | }, 14 | "devDependencies": { 15 | "docusaurus": "^1.3.2" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /website/pages/en/help.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 | 8 | const React = require("react"); 9 | 10 | const CompLibrary = require("../../core/CompLibrary.js"); 11 | const Container = CompLibrary.Container; 12 | const GridBlock = CompLibrary.GridBlock; 13 | 14 | const siteConfig = require(process.cwd() + "/siteConfig.js"); 15 | 16 | function docUrl(doc, language) { 17 | return siteConfig.baseUrl + "docs/" + (language ? language + "/" : "") + doc; 18 | } 19 | 20 | class Help extends React.Component { 21 | render() { 22 | let language = this.props.language || ""; 23 | const supportLinks = [ 24 | { 25 | content: `Learn more using the [documentation on this site.](${docUrl( 26 | "doc1.html", 27 | language 28 | )})`, 29 | title: "Browse Docs" 30 | }, 31 | // { 32 | // content: 'Ask questions about the documentation and project', 33 | // title: 'Join the community', 34 | // }, 35 | { 36 | content: "Find out what's new with this project", 37 | title: "Stay up to date" 38 | } 39 | ]; 40 | 41 | return ( 42 |

43 | 44 |
45 |
46 |

Need help?

47 |
48 |

This project is maintained by a dedicated group of people.

49 | 50 |
51 |
52 |
53 | ); 54 | } 55 | } 56 | 57 | module.exports = Help; 58 | -------------------------------------------------------------------------------- /website/pages/en/users.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 | 8 | const React = require("react"); 9 | 10 | const CompLibrary = require("../../core/CompLibrary.js"); 11 | const Container = CompLibrary.Container; 12 | 13 | const siteConfig = require(process.cwd() + "/siteConfig.js"); 14 | 15 | class Users extends React.Component { 16 | render() { 17 | if ((siteConfig.users || []).length === 0) { 18 | return null; 19 | } 20 | const editUrl = siteConfig.repoUrl + "/edit/master/website/siteConfig.js"; 21 | const showcase = siteConfig.users.map((user, i) => { 22 | return ( 23 | 24 | {user.caption} 25 | 26 | ); 27 | }); 28 | 29 | return ( 30 |
31 | 32 |
33 |
34 |

Who's Using This?

35 |

This project is used by many folks

36 |
37 |
{showcase}
38 |

Are you using this project?

39 | 40 | Add your company 41 | 42 |
43 |
44 |
45 | ); 46 | } 47 | } 48 | 49 | module.exports = Users; 50 | -------------------------------------------------------------------------------- /website/sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "Docusaurus": ["doc1"], 4 | "First Category": ["doc2"], 5 | "Second Category": ["doc3"] 6 | }, 7 | "docs-other": { 8 | "First Category": ["doc4", "doc5"] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /website/static/img/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon.png -------------------------------------------------------------------------------- /website/static/img/favicon/apple-touch-icon-114x114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/apple-touch-icon-114x114.png -------------------------------------------------------------------------------- /website/static/img/favicon/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /website/static/img/favicon/apple-touch-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/apple-touch-icon-144x144.png -------------------------------------------------------------------------------- /website/static/img/favicon/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /website/static/img/favicon/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /website/static/img/favicon/apple-touch-icon-57x57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/apple-touch-icon-57x57.png -------------------------------------------------------------------------------- /website/static/img/favicon/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /website/static/img/favicon/apple-touch-icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/apple-touch-icon-72x72.png -------------------------------------------------------------------------------- /website/static/img/favicon/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /website/static/img/favicon/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/apple-touch-icon.png -------------------------------------------------------------------------------- /website/static/img/favicon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/favicon-16x16.png -------------------------------------------------------------------------------- /website/static/img/favicon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/favicon-32x32.png -------------------------------------------------------------------------------- /website/static/img/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/favicon.ico -------------------------------------------------------------------------------- /website/static/img/favicon/launcher-icon-0-75x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/launcher-icon-0-75x.png -------------------------------------------------------------------------------- /website/static/img/favicon/launcher-icon-1-5x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/launcher-icon-1-5x.png -------------------------------------------------------------------------------- /website/static/img/favicon/launcher-icon-1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/launcher-icon-1x.png -------------------------------------------------------------------------------- /website/static/img/favicon/launcher-icon-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/launcher-icon-2x.png -------------------------------------------------------------------------------- /website/static/img/favicon/launcher-icon-3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/launcher-icon-3x.png -------------------------------------------------------------------------------- /website/static/img/favicon/launcher-icon-4x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/favicon/launcher-icon-4x.png -------------------------------------------------------------------------------- /website/static/img/favicon/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "", 3 | "icons": [ 4 | { 5 | "src": "launcher-icon-0-75x.png", 6 | "sizes": "36x36", 7 | "type": "image/png", 8 | "density": 0.75 9 | }, 10 | { 11 | "src": "launcher-icon-1x.png", 12 | "sizes": "48x48", 13 | "type": "image/png", 14 | "density": 1.0 15 | }, 16 | { 17 | "src": "launcher-icon-1-5x.png", 18 | "sizes": "72x72", 19 | "type": "image/png", 20 | "density": 1.5 21 | }, 22 | { 23 | "src": "launcher-icon-2x.png", 24 | "sizes": "96x96", 25 | "type": "image/png", 26 | "density": 2.0 27 | }, 28 | { 29 | "src": "launcher-icon-3x.png", 30 | "sizes": "144x144", 31 | "type": "image/png", 32 | "density": 3.0 33 | }, 34 | { 35 | "src": "launcher-icon-4x.png", 36 | "sizes": "192x192", 37 | "type": "image/png", 38 | "density": 4.0 39 | } 40 | ], 41 | "display": "standalone" 42 | } 43 | -------------------------------------------------------------------------------- /website/static/img/favicon/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /website/static/img/oss_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/oss_logo.png -------------------------------------------------------------------------------- /website/static/img/react-native-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/react-native-logo.png -------------------------------------------------------------------------------- /website/static/img/react-native-logo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/react-native-logo@2x.png -------------------------------------------------------------------------------- /website/static/img/react-native-logo@svg.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | react-native-logo@svg 5 | Created with Sketch. 6 | 7 | 16 | -------------------------------------------------------------------------------- /website/static/img/react.svg: -------------------------------------------------------------------------------- 1 | 2 | React Logo 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /website/static/img/rn-dom-logo-favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/rn-dom-logo-favicon.png -------------------------------------------------------------------------------- /website/static/img/rn-dom-logo.sketch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vincentriemer/react-native-dom/235cae7e628fe1e4d89f662153e90da5ac5d0a9b/website/static/img/rn-dom-logo.sketch -------------------------------------------------------------------------------- /website/static/img/yoga.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | yoga 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | --------------------------------------------------------------------------------