Skip to content

Commit

Permalink
Merge pull request #1 from OceanHorn/master
Browse files Browse the repository at this point in the history
Modify 'Header Search Path' for native iOS app to integrate react-native-fast-image from react-native package.json.
  • Loading branch information
tianling536 committed Dec 14, 2017
2 parents 1d313b4 + 04186d4 commit b2ec093
Show file tree
Hide file tree
Showing 49 changed files with 9,759 additions and 2,176 deletions.
4 changes: 3 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"presets": ["react-native"]
"presets": [
"react-native"
]
}

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ node_modules/
npm-debug.log
lib/android/src/main/gen
example/android/app/src/main/gen

# build
react-native-fast-image-*.tgz
35 changes: 24 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,24 +167,37 @@ git submodule update --init --recursive
yarn
```

To update the example project modules you will need to run:
Developing modules for React Native is currently a mess because the packager does not support symlinks.

```bash
npm install
```

The npm usage is because
yarn will cache locally installed packages and not update them
if the version does not change. yarn also doesn't respect `.npmignore`
when doing local installs.
Both major package managers, `npm@5` and `yarn`, do local installations by creating symlinks.

To update while developing you can use:
Unfortunately for now the workaround to update the example is to run:

```bash
# In the repo directory pack the module:
npm pack

# This makes a tarball like:
# react-native-fast-image-1.0.0.tgz

# Move into the example:
cd example
npm install ../

# Install the tarball:
npm install ../react-native-fast-image-1.0.0.tgz
```

To update while developing you can re-pack and reinstall the tarball.

Hopefully [metro](https://github.com/facebook/metro) will add support for symlinks soon.

## Supported React Native Versions

This project only aims to support the latest version of React Native.\
This simplifies the development and the testing of the project.

If you require new features or bug fixes for older versions you can fork this project.

## Credits

The idea for this modules came from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@ public void setSrc(ImageViewWithUrl view, @Nullable ReadableMap source) {
eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_START_EVENT, new WritableNativeMap());

Glide
.with(view.getContext())
.with(view.getContext().getApplicationContext())
.load(glideUrl)
.dontTransform()
.priority(priority)
.placeholder(TRANSPARENT_DRAWABLE)
.listener(LISTENER)
Expand Down
23 changes: 10 additions & 13 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
machine:
environment:
PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"

dependencies:
override:
- yarn
cache_directories:
- ~/.cache/yarn

test:
override:
- yarn test
version: 2
jobs:
build:
docker:
- image: node:9.2.0
working_directory: ~/app
steps:
- checkout
- run: yarn
- run: yarn test
17 changes: 9 additions & 8 deletions example/.flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,37 @@
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
.*/Libraries/react-native/ReactNative.js

; Ignore polyfills
.*/Libraries/polyfills/.*

[include]

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow
flow/
node_modules/react-native/flow/

[options]
emoji=true

module.system=haste

experimental.strict_type_args=true

munge_underscores=true

module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_type=$FixMe

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-5]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-5]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

unsafe.enable_getters_and_setters=true

[version]
^0.45.0
^0.56.0
8 changes: 4 additions & 4 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ buck-out/
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
# https://docs.fastlane.tools/best-practices/source-control/

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots
6 changes: 3 additions & 3 deletions example/App.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @flow
import React from 'react'
import { TabNavigator, TabBarBottom } from 'react-navigation'
import FastImageExample from './FastImageExample'
import FastImageGrid from './FastImageGrid'
import DefaultImageGrid from './DefaultImageGrid'
import FastImageExample from './fastImage/FastImageExample'
import FastImageGrid from './fastImage/FastImageGrid'
import DefaultImageGrid from './fastImage/DefaultImageGrid'

const App = TabNavigator(
{
Expand Down
23 changes: 0 additions & 23 deletions example/README.md

This file was deleted.

4 changes: 2 additions & 2 deletions example/__tests__/index.ios.js → example/__tests__/App.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'react-native';
import React from 'react';
import Index from '../index.ios.js';
import App from '../App';

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

it('renders correctly', () => {
const tree = renderer.create(
<Index />
<App />
);
});
12 changes: 0 additions & 12 deletions example/__tests__/index.android.js

This file was deleted.

4 changes: 2 additions & 2 deletions example/android/app/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ android_library(

android_build_config(
name = "build_config",
package = "com.fastimage",
package = "com.example",
)

android_resource(
name = "res",
package = "com.fastimage",
package = "com.example",
res = "src/main/res",
)

Expand Down
6 changes: 5 additions & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ import com.android.build.OutputFile
* ]
*/

project.ext.react = [
entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

/**
Expand All @@ -94,7 +98,7 @@ android {
buildToolsVersion "23.0.1"

defaultConfig {
applicationId "com.fastimage"
applicationId "com.example"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fastimage"
package="com.example"
android:versionCode="1"
android:versionName="1.0">

Expand Down
Binary file not shown.
Binary file not shown.
Binary file modified example/android/app/src/main/assets/fonts/Octicons.ttf
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fastimage;
package com.example;

import com.facebook.react.ReactActivity;

Expand All @@ -10,6 +10,6 @@ public class MainActivity extends ReactActivity {
*/
@Override
protected String getMainComponentName() {
return "FastImage";
return "example";
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fastimage;
package com.example;

import android.app.Application;

Expand Down Expand Up @@ -29,6 +29,11 @@ protected List<ReactPackage> getPackages() {
new FastImageViewPackage()
);
}

@Override
protected String getJSMainModuleName() {
return "index";
}
};

@Override
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">FastImage</string>
<string name="app_name">example</string>
</resources>
2 changes: 1 addition & 1 deletion example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rootProject.name = 'FastImage'
rootProject.name = 'example'
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'
Expand Down
4 changes: 2 additions & 2 deletions example/app.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "FastImage",
"displayName": "FastImage"
"name": "example",
"displayName": "example"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions example/index.android.js

This file was deleted.

3 changes: 2 additions & 1 deletion example/index.ios.js → example/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { AppRegistry } from 'react-native'
import App from './App'
AppRegistry.registerComponent('FastImage', () => App)

AppRegistry.registerComponent('example', () => App)
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit b2ec093

Please sign in to comment.