Skip to content

Commit

Permalink
Merge pull request #9 from negativetwelve/mark/package/react-native-s…
Browse files Browse the repository at this point in the history
…hake-event

[Package] Add react-native-shake-event package + example + tests
  • Loading branch information
negativetwelve committed Aug 11, 2017
2 parents 4344178 + 3499d8e commit 84bf6bd
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ It also serves as a catalog for all react-native pacakges in the community.
## Packages

* [react-native-heap-analytics](https://github.com/negativetwelve/react-native-heap-analytics)
* [react-native-shake-event](https://github.com/jadsonlourenco/react-native-shake-event)
* [react-native-svg](https://github.com/react-native-community/react-native-svg)
* [react-native-ux-cam](https://github.com/negativetwelve/react-native-ux-cam)
* [react-native-video](https://github.com/react-native-community/react-native-video)
1 change: 1 addition & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ android {
}

dependencies {
compile project(':react-native-shake-event')
compile project(':react-native-svg')
compile project(':react-native-video')
compile project(':react-native-ux-cam')
Expand Down
2 changes: 2 additions & 0 deletions android/app/src/main/java/com/rnpackages/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.Application;

import com.facebook.react.ReactApplication;
import com.jadsonlourenco.RNShakeEvent.RNShakeEventPackage;
import com.horcrux.svg.SvgPackage;
import com.brentvatne.react.ReactVideoPackage;
import com.rnuxcam.rnuxcam.UXCamPackage;
Expand All @@ -26,6 +27,7 @@ public boolean getUseDeveloperSupport() {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNShakeEventPackage(),
new SvgPackage(),
new ReactVideoPackage(),
new UXCamPackage()
Expand Down
2 changes: 2 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
rootProject.name = 'RNPackages'
include ':react-native-shake-event'
project(':react-native-shake-event').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-shake-event/android')
include ':react-native-svg'
project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android')
include ':react-native-video'
Expand Down
11 changes: 11 additions & 0 deletions ios/RNPackages.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
1ED3D47199F24599A9125D38 /* libRNUXCam.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 659F784FC46344179C5B6774 /* libRNUXCam.a */; };
442CFF7594324918A98A95CE /* libRCTVideo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7C6FC00D33D8474A8E688CFE /* libRCTVideo.a */; };
AA3C83CBF3C4477BBF860411 /* libRNHeap.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 702B3FCBEC9440E0874F0ADC /* libRNHeap.a */; };
D2F4A8B09CC64040AC39BD67 /* libRNShakeEvent.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F01EE52D5314AD0BB2E06D9 /* libRNShakeEvent.a */; };
915FAC3A46E54800ADEE082B /* libRNSVG.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 57FC3505C8CA45A7B135F342 /* libRNSVG.a */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -264,6 +265,8 @@
7C6FC00D33D8474A8E688CFE /* libRCTVideo.a */ = {isa = PBXFileReference; name = "libRCTVideo.a"; path = "libRCTVideo.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
1B63D7E53F1C43C1984724A9 /* RNHeap.xcodeproj */ = {isa = PBXFileReference; name = "RNHeap.xcodeproj"; path = "../node_modules/react-native-heap-analytics/ios/RNHeap.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
702B3FCBEC9440E0874F0ADC /* libRNHeap.a */ = {isa = PBXFileReference; name = "libRNHeap.a"; path = "libRNHeap.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
CF23E95EE0114317B7199B62 /* RNShakeEvent.xcodeproj */ = {isa = PBXFileReference; name = "RNShakeEvent.xcodeproj"; path = "../node_modules/react-native-shake-event/ios/RNShakeEvent.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
4F01EE52D5314AD0BB2E06D9 /* libRNShakeEvent.a */ = {isa = PBXFileReference; name = "libRNShakeEvent.a"; path = "libRNShakeEvent.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
F6CD04D862284277B2A3C4FD /* RNSVG.xcodeproj */ = {isa = PBXFileReference; name = "RNSVG.xcodeproj"; path = "../node_modules/react-native-svg/ios/RNSVG.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
57FC3505C8CA45A7B135F342 /* libRNSVG.a */ = {isa = PBXFileReference; name = "libRNSVG.a"; path = "libRNSVG.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -295,6 +298,7 @@
1ED3D47199F24599A9125D38 /* libRNUXCam.a in Frameworks */,
442CFF7594324918A98A95CE /* libRCTVideo.a in Frameworks */,
AA3C83CBF3C4477BBF860411 /* libRNHeap.a in Frameworks */,
D2F4A8B09CC64040AC39BD67 /* libRNShakeEvent.a in Frameworks */,
915FAC3A46E54800ADEE082B /* libRNSVG.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -465,6 +469,7 @@
4B184078C3454F4F808958E7 /* RNUXCam.xcodeproj */,
10D94D39E400418C9E39A435 /* RCTVideo.xcodeproj */,
1B63D7E53F1C43C1984724A9 /* RNHeap.xcodeproj */,
CF23E95EE0114317B7199B62 /* RNShakeEvent.xcodeproj */,
F6CD04D862284277B2A3C4FD /* RNSVG.xcodeproj */,
);
name = Libraries;
Expand Down Expand Up @@ -1002,6 +1007,7 @@
"$(SRCROOT)/../node_modules/react-native-ux-cam/ios",
"$(SRCROOT)/../node_modules/react-native-video/ios",
"$(SRCROOT)/../node_modules/react-native-heap-analytics/ios",
"$(SRCROOT)/../node_modules/react-native-shake-event/ios",
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
);
};
Expand Down Expand Up @@ -1032,6 +1038,7 @@
"$(SRCROOT)/../node_modules/react-native-ux-cam/ios",
"$(SRCROOT)/../node_modules/react-native-video/ios",
"$(SRCROOT)/../node_modules/react-native-heap-analytics/ios",
"$(SRCROOT)/../node_modules/react-native-shake-event/ios",
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
);
};
Expand All @@ -1057,6 +1064,7 @@
"$(SRCROOT)/../node_modules/react-native-ux-cam/ios",
"$(SRCROOT)/../node_modules/react-native-video/ios",
"$(SRCROOT)/../node_modules/react-native-heap-analytics/ios",
"$(SRCROOT)/../node_modules/react-native-shake-event/ios",
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
);
};
Expand All @@ -1081,6 +1089,7 @@
"$(SRCROOT)/../node_modules/react-native-ux-cam/ios",
"$(SRCROOT)/../node_modules/react-native-video/ios",
"$(SRCROOT)/../node_modules/react-native-heap-analytics/ios",
"$(SRCROOT)/../node_modules/react-native-shake-event/ios",
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
);
};
Expand Down Expand Up @@ -1120,6 +1129,7 @@
"$(SRCROOT)/../node_modules/react-native-ux-cam/ios",
"$(SRCROOT)/../node_modules/react-native-video/ios",
"$(SRCROOT)/../node_modules/react-native-heap-analytics/ios",
"$(SRCROOT)/../node_modules/react-native-shake-event/ios",
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
);
};
Expand Down Expand Up @@ -1159,6 +1169,7 @@
"$(SRCROOT)/../node_modules/react-native-ux-cam/ios",
"$(SRCROOT)/../node_modules/react-native-video/ios",
"$(SRCROOT)/../node_modules/react-native-heap-analytics/ios",
"$(SRCROOT)/../node_modules/react-native-shake-event/ios",
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
);
};
Expand Down
2 changes: 2 additions & 0 deletions js/components/PackagesView.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {StyleSheet, View} from 'react-native';

// Packages
import HeapAnalyticsExample from '../examples/HeapAnalyticsExample';
import ShakeEventExample from '../examples/ShakeEventExample';
import SVGExample from '../examples/SVGExample';
import UXCamExample from '../examples/UXCamExample';
import VideoExample from '../examples/VideoExample';
Expand All @@ -19,6 +20,7 @@ const styles = StyleSheet.create({
export default () => (
<View style={styles.container}>
<HeapAnalyticsExample />
<ShakeEventExample />
<SVGExample />
<UXCamExample />
<VideoExample />
Expand Down
20 changes: 20 additions & 0 deletions js/examples/ShakeEventExample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Libraries
import React from 'react';
import ShakeEvent from 'react-native-shake-event';


export default class ShakeEventExample extends React.Component {
componentWillMount() {
ShakeEvent.addEventListener('shake', () => {
console.log('Device shake!');
});
}

componentWillUnmount() {
ShakeEvent.removeEventListener('shake');
}

render() {
return null;
}
}
14 changes: 14 additions & 0 deletions js/examples/__tests__/ShakeEventExample.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Libraries
import 'react-native';
import React from 'react';
import Renderer from 'react-test-renderer';

// Components
import ShakeEventExample from '../ShakeEventExample';


it('renders correctly', () => {
const tree = Renderer.create(
<ShakeEventExample />
);
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"react": "16.0.0-alpha.12",
"react-native": "0.47.1",
"react-native-heap-analytics": "^1.3.0",
"react-native-shake-event": "^4.0.1",
"react-native-svg": "^5.4.1",
"react-native-ux-cam": "^3.4.0",
"react-native-video": "^1.2.0"
Expand Down
6 changes: 6 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4616,6 +4616,12 @@ react-native-heap-analytics@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/react-native-heap-analytics/-/react-native-heap-analytics-1.3.0.tgz#4082980701b30010d6533940f963605d51f1de89"

react-native-shake-event@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/react-native-shake-event/-/react-native-shake-event-4.0.1.tgz#b167e844b711eff50d44d029537fbb228b2ac6b2"
dependencies:
invariant "^2.2.2"

react-native-svg@^5.4.1:
version "5.4.1"
resolved "https://registry.yarnpkg.com/react-native-svg/-/react-native-svg-5.4.1.tgz#c46191c786adbe9d5007342b4279efd153db8839"
Expand Down

0 comments on commit 84bf6bd

Please sign in to comment.