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 5 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
1 change: 1 addition & 0 deletions packages/react-native-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ For each user feature we should also add a importance categorization label to i
- [*] Add 'Insert from URL' option to Video block [#41493]
- [*] Image block copies the alt text from the media library when selecting an item [#41839]
- [*] Introduce "block recovery" option for invalid blocks [#41988]
- [*] Add React Native FastImage [#42009]

## 1.78.1

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
29 changes: 29 additions & 0 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.78.1):
- 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: 214a8fe3bb352b754d9909d2bef764cd8289d1be
libwebp: 98a37e597e40bfdb4c911fc98f2c53d0b12d05fc
RCT-Folly: a21c126816d8025b547704b777a2ba552f3d9fa9
RCTRequired: 5e9e85f48da8dd447f5834ce14c6799ea8c7f41a
RCTTypeSafety: aba333d04d88d1f954e93666a08d7ae57a87ab30
Expand Down Expand Up @@ -538,11 +564,14 @@ SPEC CHECKSUMS:
ReactCommon: c0263c1a41509aeb94be3214fa7bc3b71eae5ef6
RNCClipboard: 99fc8ad669a376b756fbc8098ae2fd05c0ed0668
RNCMaskedView: c298b644a10c0c142055b3ae24d83879ecb13ccd
RNFastImage: 1f2cab428712a4baaf78d6169eaec7f622556dd7
RNGestureHandler: 3b13cc25407d1cdbee33b6ae65790a55c032d2a9
RNReanimated: b413cc7aa3e2a740d9804cda3a9396a68f9eea7f
RNScreens: 953633729a42e23ad0c93574d676b361e3335e8b
RNSVG: 36a7359c428dcb7c6bce1cc546fbfebe069809b0
RNTAztecView: 57ebf9512a9318d4dfd9099dc290b11ad4b5ece6
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