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

[Mobile] Add react-native-fast-image #42009

Merged
merged 8 commits into from
Jul 11, 2022
Merged
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
10 changes: 8 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import {
Dimensions,
Animated,
Easing,
Image,
} from 'react-native';
import FastImage from 'react-native-fast-image';

/**
* WordPress dependencies
*/
Expand Down Expand Up @@ -90,7 +91,7 @@ function StylePreview( { onPress, isActive, style, url } ) {
<View style={ styles.imageWrapper }>
{ isActive &&
getOutline( [ styles.outline, innerOutlineStyle ] ) }
<Image
<FastImage
style={ [ styles.image, styles[ name ] ] }
source={ { uri: url } }
/>
Expand Down
5 changes: 3 additions & 2 deletions packages/components/src/mobile/image/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* External dependencies
*/
import { Image, Text, View } from 'react-native';
import FastImage from 'react-native-fast-image';

/**
* WordPress dependencies
Expand Down Expand Up @@ -210,7 +211,7 @@ const ImageComponent = ( {
</View>
) : (
<View style={ focalPoint && styles.focalPointContent }>
<Image
<FastImage
{ ...( ! resizeMode && {
aspectRatio: imageData?.aspectRatio,
} ) }
Expand All @@ -219,7 +220,7 @@ const ImageComponent = ( {
{ ...( ! focalPoint && {
resizeMethod: 'scale',
} ) }
resizeMode={ resizeMode }
resizeMode={ FastImage.resizeMode[ resizeMode ] }
/>
</View>
) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ dependencies {
implementation "com.github.wordpress-mobile:react-native-prompt-android:${extractPackageVersion(packageJson, 'react-native-prompt-android', 'dependencies')}"
implementation "org.wordpress-mobile:react-native-webview:${extractPackageVersion(packageJson, 'react-native-webview', 'dependencies')}"
implementation "org.wordpress-mobile:react-native-clipboard:${extractPackageVersion(packageJson, '@react-native-clipboard/clipboard', 'dependencies')}"
implementation "org.wordpress-mobile:react-native-fast-image:${extractPackageVersion(packageJson, 'react-native-fast-image', 'dependencies')}"

implementation("com.github.wordpress-mobile:react-native-gesture-handler:${extractPackageVersion(packageJson, 'react-native-gesture-handler', 'dependencies')}", {
// Remove Reanimated transitive dependency as it's already defined here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import com.swmansion.rnscreens.RNScreensPackage;
import com.th3rdwave.safeareacontext.SafeAreaContextPackage;
import org.reactnative.maskedview.RNCMaskedViewPackage;
import com.dylanvann.fastimage.FastImageViewPackage;

import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.AppLog.T;
Expand Down Expand Up @@ -585,6 +586,7 @@ public ReactInstanceManager getReactInstanceManager(ReactApplicationContext reac
new RNPromptPackage(),
new RNCWebViewPackage(),
new ClipboardPackage(),
new FastImageViewPackage(),
mRnReactNativeGutenbergBridgePackage);
}

Expand Down
2 changes: 2 additions & 0 deletions packages/react-native-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ For each user feature we should also add a importance categorization label to i

## Unreleased

- [*] Add React Native FastImage [#42009]

## 1.79.0
- [*] Add 'Insert from URL' option to Video block [#41493]
- [*] Image block copies the alt text from the media library when selecting an item [#41839]
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-editor/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ dependencies {
implementation "com.github.wordpress-mobile:react-native-prompt-android:${extractPackageVersion(packageJson, 'react-native-prompt-android', 'dependencies')}"
implementation "org.wordpress-mobile:react-native-webview:${extractPackageVersion(packageJson, 'react-native-webview', 'dependencies')}"
implementation "org.wordpress-mobile:react-native-clipboard:${extractPackageVersion(packageJson, '@react-native-clipboard/clipboard', 'dependencies')}"
implementation "org.wordpress-mobile:react-native-fast-image:${extractPackageVersion(packageJson, 'react-native-fast-image', 'dependencies')}"

implementation("com.github.wordpress-mobile:react-native-gesture-handler:${extractPackageVersion(packageJson, 'react-native-gesture-handler', 'dependencies')}", {
// Remove Reanimated transitive dependency as it's already defined here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.facebook.react.devsupport.interfaces.DevSupportManager;
import com.horcrux.svg.SvgPackage;
import org.linusu.RNGetRandomValuesPackage;
import com.dylanvann.fastimage.FastImageViewPackage;

import org.wordpress.mobile.ReactNativeAztec.ReactAztecPackage;
import org.wordpress.mobile.ReactNativeGutenbergBridge.GutenbergBridgeInterface;
Expand Down Expand Up @@ -305,6 +306,7 @@ protected List<ReactPackage> getPackages() {
new RNPromptPackage(),
new RNCWebViewPackage(),
new ClipboardPackage(),
new FastImageViewPackage(),
mRnReactNativeGutenbergBridgePackage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@
"${BUILT_PRODUCTS_DIR}/RCTTypeSafety/RCTTypeSafety.framework",
"${BUILT_PRODUCTS_DIR}/RNCClipboard/RNCClipboard.framework",
"${BUILT_PRODUCTS_DIR}/RNCMaskedView/RNCMaskedView.framework",
"${BUILT_PRODUCTS_DIR}/RNFastImage/RNFastImage.framework",
"${BUILT_PRODUCTS_DIR}/RNGestureHandler/RNGestureHandler.framework",
"${BUILT_PRODUCTS_DIR}/RNReanimated/RNReanimated.framework",
"${BUILT_PRODUCTS_DIR}/RNSVG/RNSVG.framework",
Expand All @@ -359,10 +360,13 @@
"${BUILT_PRODUCTS_DIR}/React-logger/logger.framework",
"${BUILT_PRODUCTS_DIR}/React-perflogger/reactperflogger.framework",
"${BUILT_PRODUCTS_DIR}/ReactCommon/ReactCommon.framework",
"${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework",
"${BUILT_PRODUCTS_DIR}/SDWebImageWebPCoder/SDWebImageWebPCoder.framework",
"${BUILT_PRODUCTS_DIR}/WordPress-Aztec-iOS/Aztec.framework",
"${BUILT_PRODUCTS_DIR}/Yoga/yoga.framework",
"${BUILT_PRODUCTS_DIR}/fmt/fmt.framework",
"${BUILT_PRODUCTS_DIR}/glog/glog.framework",
"${BUILT_PRODUCTS_DIR}/libwebp/libwebp.framework",
"${BUILT_PRODUCTS_DIR}/react-native-blur/react_native_blur.framework",
"${BUILT_PRODUCTS_DIR}/react-native-get-random-values/react_native_get_random_values.framework",
"${BUILT_PRODUCTS_DIR}/react-native-keyboard-aware-scroll-view/react_native_keyboard_aware_scroll_view.framework",
Expand All @@ -381,6 +385,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTTypeSafety.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNCClipboard.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNCMaskedView.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNFastImage.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNGestureHandler.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNReanimated.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNSVG.framework",
Expand All @@ -403,10 +408,13 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/logger.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/reactperflogger.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReactCommon.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageWebPCoder.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Aztec.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/yoga.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/fmt.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libwebp.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_blur.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_get_random_values.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_keyboard_aware_scroll_view.framework",
Expand Down Expand Up @@ -457,6 +465,7 @@
"${BUILT_PRODUCTS_DIR}/RCTTypeSafety/RCTTypeSafety.framework",
"${BUILT_PRODUCTS_DIR}/RNCClipboard/RNCClipboard.framework",
"${BUILT_PRODUCTS_DIR}/RNCMaskedView/RNCMaskedView.framework",
"${BUILT_PRODUCTS_DIR}/RNFastImage/RNFastImage.framework",
"${BUILT_PRODUCTS_DIR}/RNGestureHandler/RNGestureHandler.framework",
"${BUILT_PRODUCTS_DIR}/RNReanimated/RNReanimated.framework",
"${BUILT_PRODUCTS_DIR}/RNSVG/RNSVG.framework",
Expand All @@ -479,10 +488,13 @@
"${BUILT_PRODUCTS_DIR}/React-logger/logger.framework",
"${BUILT_PRODUCTS_DIR}/React-perflogger/reactperflogger.framework",
"${BUILT_PRODUCTS_DIR}/ReactCommon/ReactCommon.framework",
"${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework",
"${BUILT_PRODUCTS_DIR}/SDWebImageWebPCoder/SDWebImageWebPCoder.framework",
"${BUILT_PRODUCTS_DIR}/WordPress-Aztec-iOS/Aztec.framework",
"${BUILT_PRODUCTS_DIR}/Yoga/yoga.framework",
"${BUILT_PRODUCTS_DIR}/fmt/fmt.framework",
"${BUILT_PRODUCTS_DIR}/glog/glog.framework",
"${BUILT_PRODUCTS_DIR}/libwebp/libwebp.framework",
"${BUILT_PRODUCTS_DIR}/react-native-blur/react_native_blur.framework",
"${BUILT_PRODUCTS_DIR}/react-native-get-random-values/react_native_get_random_values.framework",
"${BUILT_PRODUCTS_DIR}/react-native-keyboard-aware-scroll-view/react_native_keyboard_aware_scroll_view.framework",
Expand All @@ -501,6 +513,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTTypeSafety.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNCClipboard.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNCMaskedView.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNFastImage.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNGestureHandler.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNReanimated.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RNSVG.framework",
Expand All @@ -523,10 +536,13 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/logger.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/reactperflogger.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReactCommon.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageWebPCoder.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Aztec.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/yoga.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/fmt.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libwebp.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_blur.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_get_random_values.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_keyboard_aware_scroll_view.framework",
Expand Down
41 changes: 35 additions & 6 deletions packages/react-native-editor/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ PODS:
- React-CoreModules (= 0.66.2)
- React-RCTImage (= 0.66.2)
- RNTAztecView
- libwebp (1.2.1):
- libwebp/demux (= 1.2.1)
- libwebp/mux (= 1.2.1)
- libwebp/webp (= 1.2.1)
- libwebp/demux (1.2.1):
- libwebp/webp
- libwebp/mux (1.2.1):
- libwebp/demux
- libwebp/webp (1.2.1)
- RCT-Folly (2021.06.28.00-v2):
- boost
- DoubleConversion
Expand Down Expand Up @@ -304,6 +313,10 @@ PODS:
- React-Core
- RNCMaskedView (0.2.6):
- React-Core
- RNFastImage (8.5.11):
- React-Core
- SDWebImage (~> 5.11.1)
- SDWebImageWebPCoder (~> 0.8.4)
- RNGestureHandler (2.3.2-wp-1):
- React-Core
- RNReanimated (2.4.1-wp-3):
Expand Down Expand Up @@ -340,6 +353,12 @@ PODS:
- RNTAztecView (1.79.0):
- React-Core
- WordPress-Aztec-iOS (~> 1.19.8)
- SDWebImage (5.11.1):
- SDWebImage/Core (= 5.11.1)
- SDWebImage/Core (5.11.1)
- SDWebImageWebPCoder (0.8.5):
- libwebp (~> 1.0)
- SDWebImage/Core (~> 5.10)
- WordPress-Aztec-iOS (1.19.8)
- Yoga (1.14.0)

Expand Down Expand Up @@ -387,6 +406,7 @@ DEPENDENCIES:
- ReactCommon/turbomodule/core (from `../../../node_modules/react-native/ReactCommon`)
- "RNCClipboard (from `../../../node_modules/@react-native-clipboard/clipboard`)"
- "RNCMaskedView (from `../../../node_modules/@react-native-masked-view/masked-view`)"
- RNFastImage (from `../../../node_modules/react-native-fast-image`)
- RNGestureHandler (from `../../../node_modules/react-native-gesture-handler`)
- RNReanimated (from `../../../node_modules/react-native-reanimated`)
- RNScreens (from `../../../node_modules/react-native-screens`)
Expand All @@ -397,6 +417,9 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- fmt
- libwebp
- SDWebImage
- SDWebImageWebPCoder
- WordPress-Aztec-iOS

EXTERNAL SOURCES:
Expand Down Expand Up @@ -482,6 +505,8 @@ EXTERNAL SOURCES:
:path: "../../../node_modules/@react-native-clipboard/clipboard"
RNCMaskedView:
:path: "../../../node_modules/@react-native-masked-view/masked-view"
RNFastImage:
:path: "../../../node_modules/react-native-fast-image"
RNGestureHandler:
:path: "../../../node_modules/react-native-gesture-handler"
RNReanimated:
Expand All @@ -504,6 +529,7 @@ SPEC CHECKSUMS:
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 5337263514dd6f09803962437687240c5dc39aa4
Gutenberg: 03d969bd5acf0f2787b81fd83a9af36efecaaee9
libwebp: 98a37e597e40bfdb4c911fc98f2c53d0b12d05fc
RCT-Folly: a21c126816d8025b547704b777a2ba552f3d9fa9
RCTRequired: 5e9e85f48da8dd447f5834ce14c6799ea8c7f41a
RCTTypeSafety: aba333d04d88d1f954e93666a08d7ae57a87ab30
Expand All @@ -518,12 +544,12 @@ SPEC CHECKSUMS:
React-logger: faee236598b0f7e1a5e3b68577016ac451f1f993
react-native-blur: ef741a08d020010ba65e411be0ab82d1d325e7ad
react-native-get-random-values: b6fb85e7169b9822976793e467458c151c3e8b69
react-native-keyboard-aware-scroll-view: 374b637c8684d7de50bd930df1a2d2b8fd49daa5
react-native-keyboard-aware-scroll-view: 0bc6c2dfe9056935a40dc1a70e764b7a1bbf6568
react-native-safe-area: c9cf765aa2dd96159476a99633e7d462ce5bb94f
react-native-safe-area-context: e471852c5ed67eea4b10c5d9d43c1cebae3b231d
react-native-safe-area-context: f0906bf8bc9835ac9a9d3f97e8bde2a997d8da79
react-native-slider: d4c3367c5db5d2bec3ac0ab9d15ebb73d896034c
react-native-video: 2ad952d1a9ce83e058dcb4a1800af3a99cb7edee
react-native-webview: 1f56115845c98f0a59dfbbac685797c014a821be
react-native-video: 0b09cc469df0249509def5dc1484e0419342de9b
react-native-webview: 193d233c29eacce1f42ca2637dab7ba79c25a6de
React-perflogger: 5ab487cacfe6ec19bfe3d3f8072bf71eb07d63da
React-RCTActionSheet: 03f25695e095fb5aa003828620943c74cc281fec
React-RCTAnimation: eaf82da39f0c36fb0ef2a28df797c5f73a2a98ea
Expand All @@ -536,13 +562,16 @@ SPEC CHECKSUMS:
React-RCTVibration: 3e815c3d2dd2e0e931b68595b5b92d23ba38b3fb
React-runtimeexecutor: 393e26602c1b248683372051e34db63e359e3b01
ReactCommon: c0263c1a41509aeb94be3214fa7bc3b71eae5ef6
RNCClipboard: f49f3de56b40d0f4104680dabadc7a1f063f4fd4
RNCMaskedView: d367b2a8df3992114e31b32b091a0c00dc800827
RNCClipboard: 99fc8ad669a376b756fbc8098ae2fd05c0ed0668
RNCMaskedView: c298b644a10c0c142055b3ae24d83879ecb13ccd
RNFastImage: 1f2cab428712a4baaf78d6169eaec7f622556dd7
RNGestureHandler: 3b13cc25407d1cdbee33b6ae65790a55c032d2a9
RNReanimated: b413cc7aa3e2a740d9804cda3a9396a68f9eea7f
RNScreens: 953633729a42e23ad0c93574d676b361e3335e8b
RNSVG: 36a7359c428dcb7c6bce1cc546fbfebe069809b0
RNTAztecView: 48124f42ccc72c4b00a5aa4982ee3a816860b7c3
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
WordPress-Aztec-iOS: 7d11d598f14c82c727c08b56bd35fbeb7dafb504
Yoga: 9a08effa851c1d8cc1647691895540bc168ea65f

Expand Down
1 change: 1 addition & 0 deletions packages/react-native-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"jsdom-jscore-rn": "git+https://github.com/iamcco/jsdom-jscore-rn.git#a562f3d57c27c13e5bfc8cf82d496e69a3ba2800",
"node-fetch": "^2.6.0",
"react-native": "0.66.2",
"react-native-fast-image": "8.5.11",
"react-native-gesture-handler": "https://raw.githubusercontent.com/wordpress-mobile/react-native-gesture-handler/2.3.2-wp-1/react-native-gesture-handler-2.3.2-wp-1.tgz",
"react-native-get-random-values": "1.4.0",
"react-native-hr": "git+https://github.com/Riglerr/react-native-hr.git#2d01a5cf77212d100e8b99e0310cce5234f977b3",
Expand Down