Commit e68fe53f authored by Dylan Vann's avatar Dylan Vann

Replace with clean examples.

parent c2aa88dd
{
"presets": ["react-native"]
"presets": ["module:metro-react-native-babel-preset"]
}
......@@ -29,7 +29,23 @@ node_modules/react-native/flow-github/
[options]
emoji=true
esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable
module.system=haste
module.system.haste.use_name_reducers=true
# get basename
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
# strip .js or .js.flow suffix
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
# strip .ios suffix
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
munge_underscores=true
......@@ -51,4 +67,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
[version]
^0.67.0
^0.78.0
......@@ -54,8 +54,3 @@ buck-out/
# Bundle artifact
*.jsbundle
# CocoaPods
ios/Pods
src
\ No newline at end of file
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});
type Props = {};
export default class App extends Component<Props> {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text style={styles.instructions}>{instructions}</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
......@@ -45,12 +45,12 @@ android_library(
android_build_config(
name = "build_config",
package = "com.reactnativefastimagecocoapodsexample",
package = "com.reactnativefastimageexamplecocoapods",
)
android_resource(
name = "res",
package = "com.reactnativefastimagecocoapodsexample",
package = "com.reactnativefastimageexamplecocoapods",
res = "src/main/res",
)
......
......@@ -94,13 +94,13 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.reactnativefastimagecocoapodsexample"
minSdkVersion 16
targetSdkVersion 22
applicationId "com.reactnativefastimageexamplecocoapods"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
ndk {
......@@ -137,9 +137,9 @@ android {
}
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
}
// Run this once to be able to run the application with BUCK
......
......@@ -15,56 +15,3 @@
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Disabling obfuscation is useful if you collect stack traces from production crashes
# (unless you are using a system that supports de-obfuscate the stack traces).
-dontobfuscate
# React Native
# Keep our interfaces so they can be used by other ProGuard rules.
# See http://sourceforge.net/p/proguard/bugs/466/
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
# Do not strip any method/class that is annotated with @DoNotStrip
-keep @com.facebook.proguard.annotations.DoNotStrip class *
-keep @com.facebook.common.internal.DoNotStrip class *
-keepclassmembers class * {
@com.facebook.proguard.annotations.DoNotStrip *;
@com.facebook.common.internal.DoNotStrip *;
}
-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
void set*(***);
*** get*();
}
-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
-keepclassmembers,includedescriptorclasses class * { native <methods>; }
-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
-dontwarn com.facebook.react.**
# TextLayoutBuilder uses a non-public Android constructor within StaticLayout.
# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details.
-dontwarn android.text.StaticLayout
# okhttp
-keepattributes Signature
-keepattributes *Annotation*
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
# okio
-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.reactnativefastimagecocoapodsexample">
package="com.reactnativefastimageexamplecocoapods">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
......
package com.reactnativefastimagecocoapodsexample;
package com.reactnativefastimageexamplecocoapods;
import com.facebook.react.ReactActivity;
......@@ -10,6 +10,6 @@ public class MainActivity extends ReactActivity {
*/
@Override
protected String getMainComponentName() {
return "ReactNativeFastImageCocoaPodsExample";
return "ReactNativeFastImageExampleCocoaPods";
}
}
<resources>
<string name="app_name">ReactNativeFastImageCocoaPodsExample</string>
<string name="app_name">ReactNativeFastImageExampleCocoaPods</string>
</resources>
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
}
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
......@@ -16,12 +24,16 @@ allprojects {
repositories {
mavenLocal()
jcenter()
maven {
url "https://maven.google.com"
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
google()
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}
......@@ -16,5 +16,3 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useDeprecatedNdk=true
......@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
#!/usr/bin/env bash
#!/usr/bin/env sh
##############################################################################
##
......@@ -6,20 +6,38 @@
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
warn () {
echo "$*"
}
die ( ) {
die () {
echo
echo "$*"
echo
......@@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
......@@ -40,31 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
......@@ -90,7 +89,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
......@@ -114,6 +113,7 @@ fi
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
......@@ -154,11 +154,19 @@ if $cygwin ; then
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
exec "$JAVACMD" "$@"
......@@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
......@@ -46,10 +46,9 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
......@@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
......
rootProject.name = 'ReactNativeFastImageCocoaPodsExample'
rootProject.name = 'ReactNativeFastImageExampleCocoaPods'
include ':app'
{
"name": "ReactNativeFastImageCocoaPodsExample",
"displayName": "ReactNativeFastImageCocoaPodsExample"
"name": "ReactNativeFastImageExampleCocoaPods",
"displayName": "ReactNativeFastImageExampleCocoaPods"
}
\ No newline at end of file
import { AppRegistry } from 'react-native'
import App from './src/App'
/** @format */
AppRegistry.registerComponent('ReactNativeFastImageCocoaPodsExample', () => App)
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName, () => App);
platform :ios, '9.0'
target 'ReactNativeFastImageCocoaPodsExample' do
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge',
'DevSupport',
'RCTText',
'RCTNetwork',
'RCTWebSocket',
'RCTImage',
]
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'react-native-vector-icons', :path => '../node_modules/react-native-vector-icons'
pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'
pod 'react-native-fast-image', :path => '../node_modules/react-native-fast-image'
end
\ No newline at end of file
PODS:
- boost-for-react-native (1.63.0)
- DoubleConversion (1.1.5)
- FLAnimatedImage (1.0.12)
- Folly (2016.09.26.00):
- boost-for-react-native
- DoubleConversion
- glog
- glog (0.3.4)
- React (0.55.3):
- React/Core (= 0.55.3)
- react-native-fast-image (4.0.6):
- FLAnimatedImage
- React
- SDWebImage/Core
- SDWebImage/GIF
- React/Core (0.55.3):
- yoga (= 0.55.3.React)
- React/CxxBridge (0.55.3):
- Folly (= 2016.09.26.00)
- React/Core
- React/cxxreact
- React/cxxreact (0.55.3):
- boost-for-react-native (= 1.63.0)
- Folly (= 2016.09.26.00)
- React/jschelpers
- React/jsinspector
- React/DevSupport (0.55.3):
- React/Core
- React/RCTWebSocket
- React/fishhook (0.55.3)
- React/jschelpers (0.55.3):
- Folly (= 2016.09.26.00)
- React/PrivateDatabase
- React/jsinspector (0.55.3)
- React/PrivateDatabase (0.55.3)
- React/RCTBlob (0.55.3):
- React/Core
- React/RCTImage (0.55.3):
- React/Core
- React/RCTNetwork
- React/RCTNetwork (0.55.3):
- React/Core
- React/RCTText (0.55.3):
- React/Core
- React/RCTWebSocket (0.55.3):
- React/Core
- React/fishhook
- React/RCTBlob
- RNVectorIcons (4.5.0):
- React
- SDWebImage/Core (4.3.3)
- SDWebImage/GIF (4.3.3):
- FLAnimatedImage (~> 1.0)
- SDWebImage/Core
- yoga (0.55.3.React)
DEPENDENCIES:
- react-native-fast-image (from `../node_modules/react-native-fast-image`)
- React/Core (from `../node_modules/react-native`)
- React/CxxBridge (from `../node_modules/react-native`)
- React/DevSupport (from `../node_modules/react-native`)
- React/RCTImage (from `../node_modules/react-native`)
- React/RCTNetwork (from `../node_modules/react-native`)
- React/RCTText (from `../node_modules/react-native`)
- React/RCTWebSocket (from `../node_modules/react-native`)
- RNVectorIcons (from `../node_modules/react-native-vector-icons`)
- yoga (from `../node_modules/react-native/ReactCommon/yoga`)
SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
- boost-for-react-native
- DoubleConversion
- FLAnimatedImage
- Folly
- glog
- SDWebImage
EXTERNAL SOURCES:
React:
:path: "../node_modules/react-native"
react-native-fast-image:
:path: "../node_modules/react-native-fast-image"
RNVectorIcons:
:path: "../node_modules/react-native-vector-icons"
yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"
SPEC CHECKSUMS:
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
DoubleConversion: e22e0762848812a87afd67ffda3998d9ef29170c
FLAnimatedImage: 4a0b56255d9b05f18b6dd7ee06871be5d3b89e31
Folly: 211775e49d8da0ca658aebc8eab89d642935755c
glog: 1de0bb937dccdc981596d3b5825ebfb765017ded
React: aa2040dbb6f317b95314968021bd2888816e03d5
react-native-fast-image: cba3d9bf9c2cf8ddb643d887a686c53a5dd90a2c
RNVectorIcons: c0dbfbf6068fefa240c37b0f71bd03b45dddac44
SDWebImage: de4d90b5bff3571eae7bd16202b1f43135409fa5
yoga: a23273df0088bf7f2bb7e5d7b00044ea57a2a54a
PODFILE CHECKSUM: ee9eca64053ac06cb269faee8f128dfd0a4c1de4
COCOAPODS: 1.5.0
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:ReactNativeFastImageCocoaPodsExample.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0940"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
......@@ -29,9 +29,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "ReactNativeFastImageCocoaPodsExample-tvOS.app"
BlueprintName = "ReactNativeFastImageCocoaPodsExample-tvOS"
ReferencedContainer = "container:ReactNativeFastImageCocoaPodsExample.xcodeproj">
BuildableName = "ReactNativeFastImageExampleCocoaPods-tvOS.app"
BlueprintName = "ReactNativeFastImageExampleCocoaPods-tvOS"
ReferencedContainer = "container:ReactNativeFastImageExampleCocoaPods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
......@@ -43,9 +43,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
BuildableName = "ReactNativeFastImageCocoaPodsExample-tvOSTests.xctest"
BlueprintName = "ReactNativeFastImageCocoaPodsExample-tvOSTests"
ReferencedContainer = "container:ReactNativeFastImageCocoaPodsExample.xcodeproj">
BuildableName = "ReactNativeFastImageExampleCocoaPods-tvOSTests.xctest"
BlueprintName = "ReactNativeFastImageExampleCocoaPods-tvOSTests"
ReferencedContainer = "container:ReactNativeFastImageExampleCocoaPods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
......@@ -61,9 +61,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
BuildableName = "ReactNativeFastImageCocoaPodsExample-tvOSTests.xctest"
BlueprintName = "ReactNativeFastImageCocoaPodsExample-tvOSTests"
ReferencedContainer = "container:ReactNativeFastImageCocoaPodsExample.xcodeproj">
BuildableName = "ReactNativeFastImageExampleCocoaPods-tvOSTests.xctest"
BlueprintName = "ReactNativeFastImageExampleCocoaPods-tvOSTests"
ReferencedContainer = "container:ReactNativeFastImageExampleCocoaPods.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
......@@ -71,9 +71,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "ReactNativeFastImageCocoaPodsExample-tvOS.app"
BlueprintName = "ReactNativeFastImageCocoaPodsExample-tvOS"
ReferencedContainer = "container:ReactNativeFastImageCocoaPodsExample.xcodeproj">
BuildableName = "ReactNativeFastImageExampleCocoaPods-tvOS.app"
BlueprintName = "ReactNativeFastImageExampleCocoaPods-tvOS"
ReferencedContainer = "container:ReactNativeFastImageExampleCocoaPods.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
......@@ -94,9 +94,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "ReactNativeFastImageCocoaPodsExample-tvOS.app"
BlueprintName = "ReactNativeFastImageCocoaPodsExample-tvOS"
ReferencedContainer = "container:ReactNativeFastImageCocoaPodsExample.xcodeproj">
BuildableName = "ReactNativeFastImageExampleCocoaPods-tvOS.app"
BlueprintName = "ReactNativeFastImageExampleCocoaPods-tvOS"
ReferencedContainer = "container:ReactNativeFastImageExampleCocoaPods.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
......@@ -113,9 +113,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "ReactNativeFastImageCocoaPodsExample-tvOS.app"
BlueprintName = "ReactNativeFastImageCocoaPodsExample-tvOS"
ReferencedContainer = "container:ReactNativeFastImageCocoaPodsExample.xcodeproj">
BuildableName = "ReactNativeFastImageExampleCocoaPods-tvOS.app"
BlueprintName = "ReactNativeFastImageExampleCocoaPods-tvOS"
ReferencedContainer = "container:ReactNativeFastImageExampleCocoaPods.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
......
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0620"
LastUpgradeVersion = "0940"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
......@@ -29,9 +29,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "ReactNativeFastImageCocoaPodsExample.app"
BlueprintName = "ReactNativeFastImageCocoaPodsExample"
ReferencedContainer = "container:ReactNativeFastImageCocoaPodsExample.xcodeproj">
BuildableName = "ReactNativeFastImageExampleCocoaPods.app"
BlueprintName = "ReactNativeFastImageExampleCocoaPods"
ReferencedContainer = "container:ReactNativeFastImageExampleCocoaPods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
......@@ -43,9 +43,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "ReactNativeFastImageCocoaPodsExampleTests.xctest"
BlueprintName = "ReactNativeFastImageCocoaPodsExampleTests"
ReferencedContainer = "container:ReactNativeFastImageCocoaPodsExample.xcodeproj">
BuildableName = "ReactNativeFastImageExampleCocoaPodsTests.xctest"
BlueprintName = "ReactNativeFastImageExampleCocoaPodsTests"
ReferencedContainer = "container:ReactNativeFastImageExampleCocoaPods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
......@@ -61,9 +61,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "ReactNativeFastImageCocoaPodsExampleTests.xctest"
BlueprintName = "ReactNativeFastImageCocoaPodsExampleTests"
ReferencedContainer = "container:ReactNativeFastImageCocoaPodsExample.xcodeproj">
BuildableName = "ReactNativeFastImageExampleCocoaPodsTests.xctest"
BlueprintName = "ReactNativeFastImageExampleCocoaPodsTests"
ReferencedContainer = "container:ReactNativeFastImageExampleCocoaPods.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
......@@ -71,9 +71,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "ReactNativeFastImageCocoaPodsExample.app"
BlueprintName = "ReactNativeFastImageCocoaPodsExample"
ReferencedContainer = "container:ReactNativeFastImageCocoaPodsExample.xcodeproj">
BuildableName = "ReactNativeFastImageExampleCocoaPods.app"
BlueprintName = "ReactNativeFastImageExampleCocoaPods"
ReferencedContainer = "container:ReactNativeFastImageExampleCocoaPods.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
......@@ -94,9 +94,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "ReactNativeFastImageCocoaPodsExample.app"
BlueprintName = "ReactNativeFastImageCocoaPodsExample"
ReferencedContainer = "container:ReactNativeFastImageCocoaPodsExample.xcodeproj">
BuildableName = "ReactNativeFastImageExampleCocoaPods.app"
BlueprintName = "ReactNativeFastImageExampleCocoaPods"
ReferencedContainer = "container:ReactNativeFastImageExampleCocoaPods.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
......@@ -113,9 +113,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "ReactNativeFastImageCocoaPodsExample.app"
BlueprintName = "ReactNativeFastImageCocoaPodsExample"
ReferencedContainer = "container:ReactNativeFastImageCocoaPodsExample.xcodeproj">
BuildableName = "ReactNativeFastImageExampleCocoaPods.app"
BlueprintName = "ReactNativeFastImageExampleCocoaPods"
ReferencedContainer = "container:ReactNativeFastImageExampleCocoaPods.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
......
......@@ -19,7 +19,7 @@
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"ReactNativeFastImageCocoaPodsExample"
moduleName:@"ReactNativeFastImageExampleCocoaPods"
initialProperties:nil
launchOptions:launchOptions];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
......
......@@ -18,7 +18,7 @@
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ReactNativeFastImageCocoaPodsExample" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ReactNativeFastImageExampleCocoaPods" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
......
......@@ -5,11 +5,11 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>ReactNativeFastImageCocoaPodsExample</string>
<string>ReactNativeFastImageExampleCocoaPods</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
......@@ -24,33 +24,8 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UIAppFonts</key>
<array>
<string>Entypo.ttf</string>
<string>EvilIcons.ttf</string>
<string>Feather.ttf</string>
<string>FontAwesome.ttf</string>
<string>Foundation.ttf</string>
<string>Ionicons.ttf</string>
<string>MaterialCommunityIcons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>Octicons.ttf</string>
<string>SimpleLineIcons.ttf</string>
<string>Zocial.ttf</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
......@@ -65,5 +40,21 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSAppTransportSecurity</key>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>
......@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
......
......@@ -14,11 +14,11 @@
#define TIMEOUT_SECONDS 600
#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
@interface ReactNativeFastImageCocoaPodsExampleTests : XCTestCase
@interface ReactNativeFastImageExampleCocoaPodsTests : XCTestCase
@end
@implementation ReactNativeFastImageCocoaPodsExampleTests
@implementation ReactNativeFastImageExampleCocoaPodsTests
- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
{
......
{
"name": "ReactNativeFastImageCocoaPodsExample",
"name": "ReactNativeFastImageExampleCocoaPods",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"postinstall": "cp -r ./../react-native-fast-image-example/src ./src",
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.3.1",
"react-native": "0.55.3",
"react-native-fast-image": "../",
"react-native-image-progress": "^1.1.0",
"react-native-vector-icons": "^4.5.0",
"react-navigation": "^1.5.7",
"react-timeout": "^1.1.1",
"uuid": "3.0.1"
"react": "16.5.0",
"react-native": "0.57.1"
},
"devDependencies": {
"babel-jest": "23.0.0-alpha.0",
"babel-preset-react-native": "4.0.0",
"jest": "22.4.2",
"react-test-renderer": "^16.3.0-alpha.1"
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.45.6",
"react-test-renderer": "16.5.0"
},
"jest": {
"preset": "react-native"
}
}
}
\ No newline at end of file
{
"presets": ["react-native"]
"presets": ["module:metro-react-native-babel-preset"]
}
......@@ -29,6 +29,9 @@ node_modules/react-native/flow-github/
[options]
emoji=true
esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable
module.system=haste
module.system.haste.use_name_reducers=true
# get basename
......@@ -64,4 +67,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
[version]
^0.75.0
^0.78.0
......@@ -54,6 +54,3 @@ buck-out/
# Bundle artifact
*.jsbundle
rn-cli.config.js
metro.config.js
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});
type Props = {};
export default class App extends Component<Props> {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text style={styles.instructions}>{instructions}</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
......@@ -73,8 +73,7 @@ import com.android.build.OutputFile
*/
project.ext.react = [
entryFile: "index.js",
bundleConfig: "./metro.config.js",
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
......@@ -138,12 +137,9 @@ android {
}
dependencies {
compile project(':react-native-image-picker')
compile project(':react-native-vector-icons')
compile project(':react-native-fast-image')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
compile "com.facebook.react:react-native:+" // From node_modules
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
}
// Run this once to be able to run the application with BUCK
......
......@@ -3,8 +3,6 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:name=".MainApplication"
......
......@@ -3,9 +3,6 @@ package com.reactnativefastimageexample;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.imagepicker.ImagePickerPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.dylanvann.fastimage.FastImageViewPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
......@@ -26,9 +23,6 @@ public class MainApplication extends Application implements ReactApplication {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
,new ImagePickerPackage()
,new VectorIconsPackage()
,new FastImageViewPackage()
);
}
......
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
}
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
......@@ -24,28 +28,12 @@ allprojects {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
}
subprojects {
afterEvaluate {
project -> if (project.hasProperty("android")) {
android {
compileSdkVersion 26
buildToolsVersion '26.0.3'
}
}
}
}
ext {
buildToolsVersion = "26.0.3"
minSdkVersion = 16
compileSdkVersion = 26
targetSdkVersion = 26
supportLibVersion = "27.1.1"
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}
......@@ -16,5 +16,3 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useDeprecatedNdk=true
......@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
#!/usr/bin/env bash
#!/usr/bin/env sh
##############################################################################
##
......@@ -6,20 +6,38 @@
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
warn () {
echo "$*"
}
die ( ) {
die () {
echo
echo "$*"
echo
......@@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
......@@ -40,31 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
......@@ -90,7 +89,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
......@@ -114,6 +113,7 @@ fi
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
......@@ -154,11 +154,19 @@ if $cygwin ; then
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
exec "$JAVACMD" "$@"
......@@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
......@@ -46,10 +46,9 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
......@@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
......
rootProject.name = 'ReactNativeFastImageExample'
include ':react-native-image-picker'
project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-fast-image'
project(':react-native-fast-image').projectDir = new File(rootProject.projectDir, '../../android')
include ':app'
import { AppRegistry } from 'react-native'
import App from './src/App'
/** @format */
AppRegistry.registerComponent('ReactNativeFastImageExample', () => App)
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName, () => App);
......@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
......@@ -22,19 +22,6 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
......@@ -49,5 +36,19 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSAppTransportSecurity</key>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0940"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
......
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0620"
LastUpgradeVersion = "0940"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
......
......@@ -24,35 +24,8 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSPhotoLibraryUsageDescription</key>
<string>We gotta see them pics.</string>
<key>UIAppFonts</key>
<array>
<string>Entypo.ttf</string>
<string>EvilIcons.ttf</string>
<string>Feather.ttf</string>
<string>FontAwesome.ttf</string>
<string>Foundation.ttf</string>
<string>Ionicons.ttf</string>
<string>MaterialCommunityIcons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>Octicons.ttf</string>
<string>SimpleLineIcons.ttf</string>
<string>Zocial.ttf</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
......@@ -67,5 +40,21 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSAppTransportSecurity</key>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>
......@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
......
......@@ -3,29 +3,20 @@
"version": "0.0.1",
"private": true,
"scripts": {
"start": "metro-with-symlinks start",
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.4.2",
"react-native": "^0.56.0",
"react-native-fast-image": "../",
"react-native-image-picker": "^0.26.10",
"react-native-image-progress": "^1.1.1",
"react-native-status-bar-height": "^2.0.0",
"react-native-vector-icons": "^5.0.0",
"react-navigation": "^2.12.0",
"react-timeout": "^1.1.1",
"uuid": "3.3.2"
"react": "16.5.0",
"react-native": "0.57.1"
},
"devDependencies": {
"babel-jest": "23.4.2",
"babel-preset-react-native": "^5.0.2",
"jest": "23.5.0",
"metro-with-symlinks": "^1.2.0",
"react-test-renderer": "^16.4.2"
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.45.6",
"react-test-renderer": "16.5.0"
},
"jest": {
"preset": "react-native"
}
}
}
\ No newline at end of file
import React from 'react'
import { YellowBox } from 'react-native'
import { createBottomTabNavigator } from 'react-navigation'
import FastImageExamples from './FastImageExamples'
import FastImageGrid from './FastImageGrid'
import DefaultImageGrid from './DefaultImageGrid'
YellowBox.ignoreWarnings([
'Warning: isMounted(...) is deprecated',
'Module RCTImageLoader',
])
const App = createBottomTabNavigator({
fastImageExample: {
screen: FastImageExamples,
},
image: {
screen: DefaultImageGrid,
},
fastImage: {
screen: FastImageGrid,
},
})
export default App
import React, { Component } from 'react'
import { StyleSheet, View } from 'react-native'
import withCacheBust from './withCacheBust'
import SectionFlex from './SectionFlex'
import FastImage from 'react-native-fast-image'
import Section from './Section'
import FeatureText from './FeatureText'
const GIF_URL =
'https://cdn-images-1.medium.com/max/1600/1*-CY5bU4OqiJRox7G00sftw.gif'
class AutoSizingImage extends Component {
state = {
height: 0,
width: 0,
}
onLoad = e => {
const {
nativeEvent: { width, height },
} = e
this.setState({ width, height })
if (this.props.onLoad) this.props.onLoad(e)
}
getHeight = () => {
if (!this.state.height) return this.props.defaultHeight
const ratio = this.state.height / this.state.width
const height = this.props.width * ratio
return height
}
render() {
const height = this.getHeight()
return (
<FastImage
{...this.props}
onLoad={this.onLoad}
style={[{ width: this.props.width, height }, this.props.style]}
/>
)
}
}
AutoSizingImage.defaultProps = {
defaultHeight: 300,
}
const AutoSizeExample = ({ onPressReload, bust }) => (
<View>
<Section>
<FeatureText text="• AutoSize." />
</Section>
<SectionFlex onPress={onPressReload}>
<AutoSizingImage
style={styles.image}
width={200}
source={{ uri: GIF_URL + bust }}
/>
</SectionFlex>
</View>
)
const styles = StyleSheet.create({
image: {
backgroundColor: '#ddd',
margin: 20,
flex: 0,
},
})
export default withCacheBust(AutoSizeExample)
import React from 'react'
import { StyleSheet, View } from 'react-native'
import withCacheBust from './withCacheBust'
import SectionFlex from './SectionFlex'
import FastImage from 'react-native-fast-image'
import Section from './Section'
import FeatureText from './FeatureText'
const IMAGE_URL = 'https://media.giphy.com/media/GEsoqZDGVoisw/giphy.gif'
const BorderRadiusExample = ({ onPressReload, bust }) => (
<View>
<Section>
<FeatureText text="• Border radius." />
</Section>
<SectionFlex onPress={onPressReload}>
<FastImage
style={styles.imageSquare}
source={{
uri: IMAGE_URL + bust,
}}
/>
<FastImage
style={styles.imageRectangular}
source={{
uri: IMAGE_URL + bust,
}}
/>
</SectionFlex>
</View>
)
const styles = StyleSheet.create({
imageSquare: {
borderRadius: 50,
height: 100,
backgroundColor: '#ddd',
margin: 20,
width: 100,
flex: 0,
},
imageRectangular: {
borderRadius: 50,
borderTopLeftRadius: 10,
borderBottomRightRadius: 10,
height: 100,
backgroundColor: '#ddd',
margin: 20,
flex: 1,
},
plus: {
width: 30,
height: 30,
position: 'absolute',
bottom: 0,
right: 0,
},
})
export default withCacheBust(BorderRadiusExample)
import React from 'react'
import FeatureText from './FeatureText'
const BulletText = ({ text, children }) => (
<FeatureText text={`• ${text || children} •`} />
)
export default BulletText
import React from 'react'
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'
const Button = ({ text, onPress }) => (
<TouchableOpacity onPress={onPress}>
<View style={styles.button}>
<Text style={styles.text}>{text}</Text>
</View>
</TouchableOpacity>
)
const styles = StyleSheet.create({
button: {
backgroundColor: 'black',
margin: 10,
height: 44,
paddingLeft: 10,
paddingRight: 10,
borderRadius: 10,
alignItems: 'center',
justifyContent: 'center',
},
text: {
color: 'white',
},
})
export default Button
// @flow
import React from 'react'
import { Image } from 'react-native'
import Icon from './Icons/Icon'
import ImageGrid from './ImageGrid'
const DefaultImageGrid = () => <ImageGrid ImageComponent={Image} />
DefaultImageGrid.navigationOptions = {
tabBarLabel: 'Image Grid',
tabBarIcon: props => (
<Icon name="ios-image" {...props} />
),
}
export default DefaultImageGrid
import React from 'react'
import { ScrollView, StatusBar, StyleSheet, Text, View } from 'react-native'
import Icon from './Icons/Icon'
import Section from './Section'
import PriorityExample from './PriorityExample'
import GifExample from './GifExample'
import BorderRadiusExample from './BorderRadiusExample'
import FeatureText from './FeatureText'
import ProgressExample from './ProgressExample'
import PreloadExample from './PreloadExample'
import ResizeModeExample from './ResizeModeExample'
import LocalImagesExample from './LocalImagesExample'
import StatusBarUnderlay, { STATUS_BAR_HEIGHT } from './StatusBarUnderlay'
import AutoSizeExample from './AutoSizeExample'
const FastImageExample = () => (
<View style={styles.container}>
<StatusBar
translucent
barStyle="dark-content"
backgroundColor="transparent"
/>
<ScrollView
style={styles.scrollContainer}
contentContainerStyle={styles.scrollContentContainer}
>
<View style={styles.contentContainer}>
<Section>
<Text style={styles.titleText}>🚩 FastImage</Text>
<FeatureText text="Tap images to reload examples." />
</Section>
<PriorityExample />
<GifExample />
<BorderRadiusExample />
<ProgressExample />
<PreloadExample />
<ResizeModeExample />
<LocalImagesExample />
<AutoSizeExample />
</View>
</ScrollView>
<StatusBarUnderlay />
</View>
)
FastImageExample.navigationOptions = {
tabBarLabel: 'FastImage Example',
tabBarIcon: props => (
<Icon
name="ios-information-circle"
{...props}
/>
),
}
const styles = StyleSheet.create({
titleText: {
fontWeight: '900',
marginBottom: 20,
color: '#222',
},
contentContainer: {
marginTop: 20,
},
image: {
flex: 1,
height: 100,
backgroundColor: '#ddd',
margin: 10,
},
container: {
flex: 1,
alignItems: 'stretch',
backgroundColor: '#fff',
},
scrollContainer: {
marginTop: STATUS_BAR_HEIGHT,
},
scrollContentContainer: {
alignItems: 'stretch',
flex: 0,
},
})
export default FastImageExample
import React from 'react'
import FastImage from 'react-native-fast-image'
import Icon from './Icons/Icon'
import ImageGrid from './ImageGrid'
const FastImageGrid = () => <ImageGrid ImageComponent={FastImage} />
FastImageGrid.navigationOptions = {
tabBarLabel: 'FastImage Grid',
tabBarIcon: props => (
<Icon name="ios-photos" {...props} />
),
}
export default FastImageGrid
import React from 'react'
import { StyleSheet, Text } from 'react-native'
export default ({ text, style, children }) => (
<Text style={[styles.style, style]}>{text || children}</Text>
)
const styles = StyleSheet.create({
style: {
color: '#222',
},
})
import React from 'react'
import { StyleSheet, View } from 'react-native'
import withCacheBust from './withCacheBust'
import SectionFlex from './SectionFlex'
import FastImage from 'react-native-fast-image'
import Section from './Section'
import FeatureText from './FeatureText'
const GIF_URL =
'https://cdn-images-1.medium.com/max/1600/1*-CY5bU4OqiJRox7G00sftw.gif'
const GifExample = ({ onPressReload, bust }) => (
<View>
<Section>
<FeatureText text="• GIF support." />
</Section>
<SectionFlex onPress={onPressReload}>
<FastImage style={styles.image} source={{ uri: GIF_URL + bust }} />
</SectionFlex>
</View>
)
const styles = StyleSheet.create({
image: {
backgroundColor: '#ddd',
margin: 20,
height: 100,
width: 100,
flex: 0,
},
})
export default withCacheBust(GifExample)
import React from 'react'
import Base from 'react-native-vector-icons/Ionicons'
const Icon = ({ size, name, tintColor }) => (
<Base
name={name}
size={size}
style={{ width: size, height: size }}
color={tintColor}
/>
)
Icon.defaultProps = {
size: 26,
}
export default Icon
import React, { Component } from 'react'
import { FlatList, StyleSheet, Text, View } from 'react-native'
import StatusBarUnderlay, { STATUS_BAR_HEIGHT } from './StatusBarUnderlay'
const getImageUrl = (id, width, height) =>
`https://unsplash.it/${width}/${height}?image=${id}`
class ImageGrid extends Component {
constructor(props) {
super(props)
fetch('https://unsplash.it/list')
.then(res => res.json())
.then(this._onFetchImagesSuccess)
.catch(this._onFetchImagesError)
}
state = {
images: [],
itemHeight: 0,
}
_onLayout = e => {
const width = e.nativeEvent.layout.width
this.setState({
itemHeight: width / 4,
})
}
_onFetchImagesError = () => {
this.setState({
error: true,
})
}
_onFetchImagesSuccess = images => {
this.setState({
images,
})
}
_getItemLayout = (data, index) => {
const { itemHeight } = this.state
return { length: itemHeight, offset: itemHeight * index, index }
}
_renderItem = ({ item }) => {
const ImageComponent = this.props.ImageComponent
const uri = getImageUrl(item.id, 100, 100)
return (
<View style={styles.imageContainer}>
<ImageComponent source={{ uri }} style={styles.image} />
</View>
)
}
_extractKey = item => {
return item.id
}
render() {
if (this.state.error) {
return (
<View style={styles.container}>
<Text style={styles.text}>Error fetching images.</Text>
</View>
)
}
return (
<View style={styles.container}>
<FlatList
onLayout={this._onLayout}
style={styles.list}
columnWrapperStyle={[
styles.columnWrapper,
{ height: this.state.itemHeight },
]}
data={this.state.images}
renderItem={this._renderItem}
numColumns={4}
keyExtractor={this._extractKey}
getItemLayout={this._getItemLayout}
/>
<StatusBarUnderlay />
</View>
)
}
}
const MARGIN = 2
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'stretch',
justifyContent: 'center',
backgroundColor: 'white',
},
text: {
textAlign: 'center',
},
list: {
marginTop: STATUS_BAR_HEIGHT,
flex: 1,
},
columnWrapper: {
flex: 1,
flexDirection: 'row',
marginLeft: -MARGIN,
marginRight: -MARGIN,
},
image: {
flex: 1,
width: null,
height: null,
margin: MARGIN,
backgroundColor: '#eee',
},
imageContainer: {
flex: 1,
alignItems: 'stretch',
},
})
export default ImageGrid
import React, { Component } from 'react'
import { StyleSheet, View, Text, TouchableOpacity } from 'react-native'
import withCacheBust from './withCacheBust'
import FastImage from 'react-native-fast-image'
import Section from './Section'
import FeatureText from './FeatureText'
import FieldsImage from './images/fields.jpg'
import FieldsBase64 from './images/fields.js'
import JellyfishImage from './images/jellyfish.gif'
import ImagePicker from 'react-native-image-picker'
import BulletText from './BulletText'
var options = {
title: 'Select Avatar',
customButtons: [{ name: 'fb', title: 'Choose Photo from Facebook' }],
storageOptions: {
skipBackup: true,
path: 'images',
},
}
const Image = ({ source, ...p }) => (
<FastImage style={styles.imageSquare} source={source} {...p} />
)
const Row = p => <View style={styles.row} {...p} />
class PhotoExample extends Component {
state = {}
pick = () => {
ImagePicker.showImagePicker(options, response => {
console.log('Response = ', response)
if (response.didCancel) {
console.log('User cancelled image picker')
} else if (response.error) {
console.log('ImagePicker Error: ', response.error)
} else if (response.customButton) {
console.log(
'User tapped custom button: ',
response.customButton,
)
} else {
const fileUri = `file://${response.path}`
const uri = response.uri
this.setState({
image: { uri: uri },
})
}
})
}
render() {
return (
<Row>
<BulletText>photo library</BulletText>
<TouchableOpacity onPress={this.pick}>
<Image style={styles.imageSquare} source={this.state.image}>
<Text style={{ color: 'white', fontWeight: '900' }}>
Pick Photo
</Text>
</Image>
</TouchableOpacity>
</Row>
)
}
}
const Require = () => (
<React.Fragment>
<BulletText>require</BulletText>
<Image source={require('./images/fields.jpg')} />
</React.Fragment>
)
const Import = () => (
<React.Fragment>
<BulletText>import</BulletText>
<Image source={FieldsImage} />
</React.Fragment>
)
const GIF = () => (
<React.Fragment>
<BulletText>gif</BulletText>
<Image source={JellyfishImage} />
</React.Fragment>
)
const Base64 = () => (
<React.Fragment>
<BulletText>base64</BulletText>
<Image source={{ uri: FieldsBase64 }} />
</React.Fragment>
)
const LocalImagesExample = ({ onPressReload, bust }) => (
<View>
<Section>
<FeatureText> Local images.</FeatureText>
</Section>
<View style={styles.container}>
<Row>
<Require />
</Row>
<Row>
<Import />
</Row>
<Row>
<GIF />
</Row>
<Row>
<Base64 />
</Row>
<PhotoExample />
</View>
</View>
)
const styles = StyleSheet.create({
row: {
justifyContent: 'center',
alignItems: 'center',
marginBottom: 20,
},
container: {
backgroundColor: '#eee',
justifyContent: 'center',
alignItems: 'center',
paddingTop: 10,
paddingBottom: 10,
},
imageSquare: {
alignItems: 'center',
justifyContent: 'center',
height: 100,
backgroundColor: '#ddd',
margin: 20,
marginTop: 10,
width: 100,
flex: 0,
},
plus: {
width: 30,
height: 30,
position: 'absolute',
bottom: 0,
right: 0,
},
})
export default withCacheBust(LocalImagesExample)
import React, { Component } from 'react'
import { StyleSheet, View } from 'react-native'
import SectionFlex from './SectionFlex'
import FastImage from 'react-native-fast-image'
import Section from './Section'
import FeatureText from './FeatureText'
import uuid from 'uuid/v4'
import Button from './Button'
import { createImageProgress } from 'react-native-image-progress'
const IMAGE_URL =
'https://cdn-images-1.medium.com/max/1600/1*-CY5bU4OqiJRox7G00sftw.gif'
const Image = createImageProgress(FastImage)
class PreloadExample extends Component {
state = {
show: false,
url: IMAGE_URL,
}
bustCache = () => {
const key = uuid()
const bust = `?bust=${key}`
// Preload images. This can be called anywhere.
const url = IMAGE_URL + bust
this.setState({
url,
show: false,
})
}
preload = () => {
FastImage.preload([{ uri: this.state.url }])
}
showImage = () => {
this.setState({ show: true })
}
render() {
return (
<View>
<Section>
<FeatureText text="• Preloading." />
<FeatureText text="• Progress indication using react-native-image-progress." />
</Section>
<SectionFlex
style={styles.section}
onPress={this.props.onPressReload}
>
{this.state.show ? (
<Image
style={styles.image}
source={{ uri: this.state.url }}
/>
) : (
<View style={styles.image} />
)}
<View style={styles.buttons}>
<View style={{ flex: 1 }}>
<Button text="Bust" onPress={this.bustCache} />
</View>
<View style={{ flex: 1 }}>
<Button text="Preload" onPress={this.preload} />
</View>
<View style={{ flex: 1 }}>
<Button text="Render" onPress={this.showImage} />
</View>
</View>
</SectionFlex>
</View>
)
}
}
const styles = StyleSheet.create({
section: {
flexDirection: 'column',
alignItems: 'center',
},
buttons: {
flexDirection: 'row',
marginHorizontal: 20,
marginBottom: 10,
},
image: {
backgroundColor: '#ddd',
margin: 20,
marginBottom: 10,
height: 100,
width: 100,
},
})
export default PreloadExample
import React from 'react'
import { PixelRatio, StyleSheet, View } from 'react-native'
import withCacheBust from './withCacheBust'
import FastImage from 'react-native-fast-image'
import Section from './Section'
import SectionFlex from './SectionFlex'
import FeatureText from './FeatureText'
const getImageUrl = (id, width, height) =>
`https://source.unsplash.com/${id}/${width}x${height}`
const IMAGE_SIZE = 1024
const IMAGE_SIZE_PX = PixelRatio.getPixelSizeForLayoutSize(IMAGE_SIZE)
const IMAGE_URLS = [
getImageUrl('x58soEovG_M', IMAGE_SIZE_PX, IMAGE_SIZE_PX),
getImageUrl('yPI7myL5eWY', IMAGE_SIZE_PX, IMAGE_SIZE_PX),
getImageUrl('S7VCcp6KCKE', IMAGE_SIZE, IMAGE_SIZE),
]
const PriorityExample = ({ onPressReload, bust }) => (
<View>
<Section>
<FeatureText text="• Prioritize images (low, normal, high)." />
</Section>
<SectionFlex onPress={onPressReload}>
<FastImage
style={styles.image}
source={{
uri: IMAGE_URLS[0] + bust,
priority: FastImage.priority.low,
}}
/>
<FastImage
style={styles.image}
source={{
uri: IMAGE_URLS[1] + bust,
priority: FastImage.priority.normal,
}}
/>
<FastImage
style={styles.image}
source={{
uri: IMAGE_URLS[2] + bust,
priority: FastImage.priority.high,
}}
/>
</SectionFlex>
</View>
)
const styles = StyleSheet.create({
image: {
flex: 1,
height: 100,
backgroundColor: '#ddd',
margin: 10,
marginVertical: 20,
},
})
export default withCacheBust(PriorityExample)
import React, { Component } from 'react'
import { StyleSheet, View, Text } from 'react-native'
import withCacheBust from './withCacheBust'
import SectionFlex from './SectionFlex'
import FastImage from 'react-native-fast-image'
import Section from './Section'
import FeatureText from './FeatureText'
const IMAGE_URL = 'https://media.giphy.com/media/GEsoqZDGVoisw/giphy.gif'
class ProgressExample extends Component {
state = {
mount: new Date(),
start: undefined,
progress: undefined,
end: undefined,
}
render() {
const { onPressReload, bust } = this.props
const { mount, start, progress, end } = this.state
return (
<View>
<Section>
<FeatureText text="• Progress callbacks." />
</Section>
<SectionFlex
onPress={onPressReload}
style={{
flexDirection: 'column',
alignItems: 'center',
paddingBottom: 20,
}}
>
<FastImage
style={styles.image}
source={{
uri: IMAGE_URL + bust,
}}
onLoadStart={() => this.setState({ start: Date.now() })}
onProgress={e =>
this.setState({
progress: Math.round(
100 *
(e.nativeEvent.loaded /
e.nativeEvent.total),
),
})
}
onLoad={() => this.setState({ end: Date.now() })}
onLoadEnd={() => {}}
/>
<Text>
onLoadStart
{start !== undefined && ` - ${start - mount} ms`}
</Text>
<Text>
onProgress
{progress !== undefined && ` - ${progress} %`}
</Text>
<Text>
onLoad
{end !== undefined && ` - ${end - mount} ms`}
</Text>
</SectionFlex>
</View>
)
}
}
const styles = StyleSheet.create({
image: {
height: 100,
backgroundColor: '#ddd',
margin: 20,
width: 100,
flex: 0,
},
})
export default withCacheBust(ProgressExample)
import React from 'react'
import { StyleSheet, View, Text } from 'react-native'
import SectionFlex from './SectionFlex'
import FastImage from 'react-native-fast-image'
import Section from './Section'
import FeatureText from './FeatureText'
import BulletText from './BulletText'
const IMAGE_URL = 'https://media.giphy.com/media/GEsoqZDGVoisw/giphy.gif'
const Col = p => <View style={styles.col} {...p} />
const ResizeModeExample = () => (
<View>
<Section>
<FeatureText text="• resizeMode." />
</Section>
<SectionFlex style={styles.container}>
<Col>
<FastImage
style={styles.image}
resizeMode={FastImage.resizeMode.contain}
source={{ uri: IMAGE_URL }}
/>
<BulletText>contain</BulletText>
</Col>
<Col>
<FastImage
style={styles.image}
resizeMode={FastImage.resizeMode.center}
source={{ uri: IMAGE_URL }}
/>
<BulletText>center</BulletText>
</Col>
<Col>
<FastImage
style={styles.image}
resizeMode={FastImage.resizeMode.stretch}
source={{ uri: IMAGE_URL }}
/>
<BulletText>stretch</BulletText>
</Col>
<Col>
<FastImage
style={styles.image}
resizeMode={FastImage.resizeMode.cover}
source={{ uri: IMAGE_URL }}
/>
<BulletText>cover</BulletText>
</Col>
</SectionFlex>
</View>
)
const styles = StyleSheet.create({
image: {
height: 100,
width: 50,
backgroundColor: '#ddd',
margin: 20,
marginTop: 0,
marginBottom: 10,
flex: 0,
},
container: {
padding: 20,
},
col: {
alignItems: 'center',
},
})
export default ResizeModeExample
import React from 'react'
import { StyleSheet, View } from 'react-native'
export default ({ children }) => <View style={styles.section}>{children}</View>
const styles = StyleSheet.create({
section: {
marginTop: 10,
marginBottom: 10,
marginLeft: 40,
marginRight: 40,
},
})
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment