Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live Markdown Preview POC #22464

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
297 changes: 222 additions & 75 deletions android/app/build.gradle

Large diffs are not rendered by default.

941 changes: 941 additions & 0 deletions debug-react-native-config.txt

Large diffs are not rendered by default.

250 changes: 122 additions & 128 deletions ios/NewExpensify.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ target 'NewExpensify' do
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"

config = use_native_modules!
pod 'RNTAztecView', :path => '../src/components/Composer/LiveMarkdownPreview/vendor/react-native-aztec/react-native-aztec'


# Flags change depending on the env values.
flags = get_default_flags()
Expand Down
6 changes: 3 additions & 3 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Airship: c70eed50e429f97f5adb285423c7291fb7a032ae
AirshipFrameworkProxy: 7bc4130c668c6c98e2d4c60fe4c9eb61a999be99
boost: a7c83b31436843459a1961bfd74b96033dc77234
boost: 57d2868c099736d80fcd648bf211b4431e51a558
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: ff54429f0110d3c722630a98096ba689c39f6d5f
Expand Down Expand Up @@ -1062,7 +1062,7 @@ SPEC CHECKSUMS:
Permission-LocationWhenInUse: 3ba99e45c852763f730eabecec2870c2382b7bd4
Plaid: 7d340abeadb46c7aa1a91f896c5b22395a31fcf2
PromisesObjC: 09985d6d70fbe7878040aa746d78236e6946d2ef
RCT-Folly: 0080d0a6ebf2577475bda044aa59e2ca1f909cda
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
RCTRequired: e9e7b8b45aa9bedb2fdad71740adf07a7265b9be
RCTTypeSafety: 9ae0e9206625e995f0df4d5b9ddc94411929fb30
React: a71c8e1380f07e01de721ccd52bcf9c03e81867d
Expand Down Expand Up @@ -1135,4 +1135,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 4ed1c7b099741c82e2b0411b95f6468e72be6c76

COCOAPODS: 1.12.0
COCOAPODS: 1.12.1
112 changes: 45 additions & 67 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.3.24-5",
"version": "1.2.77-4",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand All @@ -10,30 +10,26 @@
"postinstall": "npx patch-package && cd desktop && npm install",
"clean": "npx react-native clean-project-auto",
"android": "scripts/set-pusher-suffix.sh && npx react-native run-android --port=8083",
"ios": "scripts/set-pusher-suffix.sh && npx react-native run-ios --port=8082",
"ipad": "concurrently \"npx react-native run-ios --port=8082 --simulator=\"iPad Pro (12.9-inch) (4th generation)\"\"",
"ipad-sm": "concurrently \"npx react-native run-ios --port=8082 --simulator=\"iPad Pro (9.7-inch)\"\"",
"ios": "scripts/set-pusher-suffix.sh && npx react-native run-ios",
"ipad": "npx react-native run-ios --port=8082 --simulator=\"iPad Pro (12.9-inch) (4th generation)\"",
"ipad-sm": "npx react-native run-ios --port=8082 --simulator=\"iPad Pro (9.7-inch)\"",
"start": "npx react-native start",
"web": "scripts/set-pusher-suffix.sh && concurrently npm:web-proxy npm:web-server",
"web-proxy": "node web/proxy.js",
"web-server": "webpack-dev-server --open --config config/webpack/webpack.dev.js",
"build": "webpack --config config/webpack/webpack.common.js --env envFile=.env.production",
"build-staging": "webpack --config config/webpack/webpack.common.js --env envFile=.env.staging",
"build-adhoc": "webpack --config config/webpack/webpack.common.js --env envFile=.env.adhoc",
"desktop": "scripts/set-pusher-suffix.sh && node desktop/start.js",
"desktop-build": "scripts/build-desktop.sh production",
"desktop-build-staging": "scripts/build-desktop.sh staging",
"createDocsRoutes": "node .github/scripts/createDocsRoutes.js",
"desktop-build-adhoc": "scripts/build-desktop.sh adhoc",
"desktop-build-internal": "scripts/build-desktop.sh internal",
"ios-build": "fastlane ios build",
"android-build": "fastlane android build",
"android-build-e2e": "bundle exec fastlane android build_e2e",
"test": "TZ=utc jest",
"lint": "eslint . --max-warnings=0 --cache --cache-location=node_modules/.cache/eslint",
"test": "jest",
"lint": "eslint . --max-warnings=0",
"lint-watch": "npx eslint-watch --watch --changed",
"shellcheck": "./scripts/shellCheck.sh",
"prettier": "prettier --write .",
"prettier-watch": "onchange \"**/*.js\" -- prettier --write --ignore-unknown {{changed}}",
"print-version": "echo $npm_package_version",
"storybook": "start-storybook -p 6006",
"storybook-build": "build-storybook -o dist/docs",
Expand All @@ -45,20 +41,19 @@
"test:e2e": "node tests/e2e/testRunner.js --development"
},
"dependencies": {
"@expensify/react-native-web": "0.18.15",
"@formatjs/intl-getcanonicallocales": "^2.2.0",
"@formatjs/intl-listformat": "^7.2.2",
"@formatjs/intl-locale": "^3.3.0",
"@formatjs/intl-numberformat": "^8.5.0",
"@formatjs/intl-pluralrules": "^5.2.2",
"@expensify/react-native-web": "0.18.12",
"@formatjs/intl-getcanonicallocales": "^1.5.8",
"@formatjs/intl-locale": "^2.4.21",
"@formatjs/intl-numberformat": "^6.2.5",
"@formatjs/intl-pluralrules": "^4.0.13",
"@gorhom/portal": "^1.0.14",
"@oguzhnatly/react-native-image-manipulator": "github:Expensify/react-native-image-manipulator#5cdae3d4455b03a04c57f50be3863e2fe6c92c52",
"@onfido/react-native-sdk": "7.4.0",
"@onfido/react-native-sdk": "7.0.1",
"@react-native-async-storage/async-storage": "^1.17.10",
"@react-native-camera-roll/camera-roll": "5.4.0",
"@react-native-community/cameraroll": "git+https://github.com/react-native-cameraroll/react-native-cameraroll.git#3f0aed96db68e134f199171c7b06c1b4d6cb382b",
"@react-native-community/clipboard": "^1.5.1",
"@react-native-community/datetimepicker": "^3.5.2",
"@react-native-community/netinfo": "^9.3.10",
"@react-native-community/netinfo": "^8.3.0",
"@react-native-community/progress-bar-android": "^1.0.4",
"@react-native-community/progress-view": "^1.2.3",
"@react-native-firebase/analytics": "^12.3.0",
Expand All @@ -69,64 +64,56 @@
"@react-navigation/drawer": "github:Expensify/react-navigation#react-navigation-drawer-v6.5.0-alpha1-gitpkg",
"@react-navigation/native": "6.0.13",
"@react-navigation/stack": "6.3.1",
"@react-ng/bounds-observer": "^0.2.1",
"@ua/react-native-airship": "^15.2.6",
"awesome-phonenumber": "^5.4.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"babel-polyfill": "^6.26.0",
"dom-serializer": "^0.2.2",
"domhandler": "^4.3.0",
"expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#c898563fe851d9a4d594fa9afbdd1ddab5971636",
"expensify-common": "git+https://github.com/Expensify/expensify-common.git#69e32de34d28098c7316a66e28061d8df50f86c5",
"fbjs": "^3.0.2",
"html-entities": "^1.3.1",
"htmlparser2": "^7.2.0",
"jest-when": "^3.5.2",
"localforage": "^1.10.0",
"localforage-removeitems": "^1.4.0",
"lodash": "4.17.21",
"lottie-react-native": "^5.1.5",
"lottie-react-native": "^5.1.4",
"metro-config": "^0.71.3",
"moment": "^2.29.4",
"moment-timezone": "^0.5.31",
"onfido-sdk-ui": "12.2.1",
"onfido-sdk-ui": "10.3.0",
"process": "^0.11.10",
"prop-types": "^15.7.2",
"pusher-js": "7.4.0",
"react": "18.2.0",
"pusher-js": "^7.0.6",
"react": "18.1.0",
"react-collapse": "^5.1.0",
"react-content-loader": "^6.1.0",
"react-dom": "18.1.0",
"react-native": "https://github.com/Expensify/react-native/releases/download/v0.71.2-alpha.3/expensify-react-native-0.71.2-alpha.3.tgz",
"react-native-blob-util": "^0.17.3",
"react-native": "npm:@expensify/react-native@0.70.4-alpha.2",
"react-native-blob-util": "^0.16.2",
"react-native-collapsible": "^1.6.0",
"react-native-config": "^1.4.5",
"react-native-dev-menu": "^4.1.1",
"react-native-device-info": "^10.3.0",
"react-native-document-picker": "^8.0.0",
"react-native-fast-image": "^8.6.3",
"react-native-gesture-handler": "2.9.0",
"react-native-google-places-autocomplete": "git+https://github.com/Expensify/react-native-google-places-autocomplete.git#6f436a06a3018cb49750bb110b89df75f6a865d5",
"react-native-google-places-autocomplete": "git+https://github.com/Expensify/react-native-google-places-autocomplete.git#e12768f1542e7982d90f6449798f0d6b7f18f192",
"react-native-haptic-feedback": "^1.13.0",
"react-native-image-pan-zoom": "^2.1.12",
"react-native-image-picker": "^5.1.0",
"react-native-image-picker": "^5.0.2",
"react-native-image-size": "git+https://github.com/Expensify/react-native-image-size#6b5ab5110dc3ed554f8eafbc38d7d87c17147972",
"react-native-key-command": "^1.0.1",
"react-native-localize": "^2.2.6",
"react-native-masked-text": "^1.13.0",
"react-native-modal": "^13.0.0",
"react-native-onyx": "1.0.43",
"react-native-onyx": "1.0.36",
"react-native-pdf": "^6.6.2",
"react-native-performance": "^4.0.0",
"react-native-permissions": "^3.0.1",
"react-native-picker-select": "git+https://github.com/Expensify/react-native-picker-select.git#107b3786ae6bc155dec05c7fc5ee525d3421dc21",
"react-native-plaid-link-sdk": "^10.0.0",
"react-native-qrcode-svg": "^6.2.0",
"react-native-quick-sqlite": "^8.0.0-beta.2",
"react-native-reanimated": "3.1.0",
"react-native-picker-select": "git+https://github.com/Expensify/react-native-picker-select.git#77cc9d42c474a693755941b10ee4c2d6f50e5346",
"react-native-plaid-link-sdk": "^7.2.0",
"react-native-quick-sqlite": "^5.0.3",
"react-native-reanimated": "3.0.0-rc.10",
"react-native-render-html": "6.3.1",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "3.17.0",
"react-native-svg": "^13.9.0",
"react-native-view-shot": "^3.6.0",
"react-native-svg": "^13.5.0",
"react-native-web-lottie": "^1.4.4",
"react-native-webview": "^11.17.2",
"react-pdf": "5.7.2",
Expand All @@ -135,7 +122,8 @@
"save": "^2.4.0",
"semver": "^7.3.8",
"shim-keyboard-event-key": "^1.0.3",
"underscore": "^1.13.1"
"underscore": "^1.13.1",
"urbanairship-react-native": "^14.6.1"
},
"devDependencies": {
"@actions/core": "1.10.0",
Expand All @@ -147,7 +135,6 @@
"@babel/preset-flow": "^7.12.13",
"@babel/preset-react": "^7.10.4",
"@babel/runtime": "^7.11.2",
"@electron/notarize": "^1.2.3",
"@octokit/core": "4.0.4",
"@octokit/plugin-paginate-rest": "3.1.0",
"@octokit/plugin-throttling": "4.1.0",
Expand Down Expand Up @@ -180,39 +167,35 @@
"css-loader": "^6.7.2",
"diff-so-fancy": "^1.3.0",
"dotenv": "^16.0.3",
"electron": "22.3.7",
"electron-builder": "24.4.0",
"electron": "22.2.0",
"electron-builder": "23.5.0",
"electron-notarize": "^1.2.1",
"eslint": "^7.6.0",
"eslint-config-expensify": "^2.0.36",
"eslint-config-prettier": "^8.8.0",
"eslint-config-expensify": "2.0.30",
"eslint-plugin-jest": "^24.1.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-storybook": "^0.5.13",
"flipper-plugin-bridgespy-client": "^0.1.9",
"html-inline-script-webpack-plugin": "^3.1.0",
"html-webpack-plugin": "^5.5.0",
"jest": "29.4.1",
"jest-circus": "29.4.1",
"jest-cli": "29.4.1",
"jest-environment-jsdom": "^29.4.1",
"metro-react-native-babel-preset": "^0.73.3",
"mock-fs": "^4.13.0",
"onchange": "^7.1.0",
"portfinder": "^1.0.28",
"prettier": "^2.8.8",
"pusher-js-mock": "^0.3.3",
"react-native-clean-project": "^4.0.0-alpha4.0",
"react-native-flipper": "https://gitpkg.now.sh/facebook/flipper/react-native/react-native-flipper?9cacc9b59402550eae866e0e81e5f0c2f8203e6b",
"react-native-performance-flipper-reporter": "^2.0.0",
"react-native-svg-transformer": "^1.0.0",
"react-test-renderer": "18.1.0",
"reassure": "^0.9.0",
"setimmediate": "^1.0.5",
"shellcheck": "^1.1.0",
"style-loader": "^2.0.0",
"time-analytics-webpack-plugin": "^0.1.17",
"wait-port": "^0.2.9",
"webpack": "^5.76.0",
"webpack": "^5.74.0",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.9.3",
Expand All @@ -222,19 +205,14 @@
"overrides": {
"react-native": "$react-native"
},
"electronmon": {
"patterns": [
"!node_modules",
"!node_modules/**/*",
"!**/*.map",
"!ios/**",
"!android/**",
"*.test.*",
"*.spec.*"
]
},
"engines": {
"node": "16.15.1",
"npm": "8.11.0"
},
"prettier": {
"bracketSpacing": false,
"jsxBracketSameLine": true,
"singleQuote": true,
"trailingComma": "all"
}
}
114 changes: 0 additions & 114 deletions src/components/Banner.js
Original file line number Diff line number Diff line change
@@ -1,114 +0,0 @@
import React, {memo} from 'react';
import PropTypes from 'prop-types';
import {View, Pressable} from 'react-native';
import compose from '../libs/compose';
import Hoverable from './Hoverable';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import RenderHTML from './RenderHTML';
import Text from './Text';
import styles from '../styles/styles';
import * as StyleUtils from '../styles/StyleUtils';
import getButtonState from '../libs/getButtonState';
import Tooltip from './Tooltip';
import withLocalize, {withLocalizePropTypes} from './withLocalize';

const propTypes = {
/** Text to display in the banner. */
text: PropTypes.string.isRequired,

/** Should this component render the left-aligned exclamation icon? */
shouldShowIcon: PropTypes.bool,

/** Should this component render a close button? */
shouldShowCloseButton: PropTypes.bool,

/** Should this component render the text as HTML? */
shouldRenderHTML: PropTypes.bool,

/** Callback called when the close button is pressed */
onClose: PropTypes.func,

/** Callback called when the message is pressed */
onPress: PropTypes.func,

/** Styles to be assigned to the Banner container */
// eslint-disable-next-line react/forbid-prop-types
containerStyles: PropTypes.arrayOf(PropTypes.object),

/** Styles to be assigned to the Banner text */
// eslint-disable-next-line react/forbid-prop-types
textStyles: PropTypes.arrayOf(PropTypes.object),

...withLocalizePropTypes,
};

const defaultProps = {
shouldRenderHTML: false,
shouldShowIcon: false,
shouldShowCloseButton: false,
onClose: undefined,
onPress: undefined,
containerStyles: [],
textStyles: [],
};

const Banner = (props) => (
<Hoverable>
{(isHovered) => {
const isClickable = props.onClose || props.onPress;
const shouldHighlight = isClickable && isHovered;
return (
<View
style={[
styles.flexRow,
styles.alignItemsCenter,
styles.p5,
styles.borderRadiusNormal,
shouldHighlight ? styles.activeComponentBG : styles.hoveredComponentBG,
styles.breakAll,
...props.containerStyles,
]}
>
<View style={[styles.flexRow, styles.flexGrow1, styles.mw100, styles.alignItemsCenter]}>
{props.shouldShowIcon && (
<View style={[styles.mr3]}>
<Icon
src={Expensicons.Exclamation}
fill={StyleUtils.getIconFillColor(getButtonState(shouldHighlight))}
/>
</View>
)}
{props.shouldRenderHTML ? (
<RenderHTML html={props.text} />
) : (
<Text
style={[...props.textStyles]}
onPress={props.onPress}
>
{props.text}
</Text>
)}
</View>
{props.shouldShowCloseButton && (
<Tooltip text={props.translate('common.close')}>
<Pressable
onPress={props.onClose}
accessibilityRole="button"
accessibilityLabel={props.translate('common.close')}
>
<Icon src={Expensicons.Close} />
</Pressable>
</Tooltip>
)}
</View>
);
}}
</Hoverable>
);

Banner.propTypes = propTypes;
Banner.defaultProps = defaultProps;
Banner.displayName = 'Banner';

export default compose(withLocalize, memo)(Banner);
Loading