Commit c749a382 authored by Gaëtan Renaudeau's avatar Gaëtan Renaudeau

initial version

parents
# OSX
#
.DS_Store
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
# node.js
#
node_modules/
npm-debug.log
# OSX
#
.DS_Store
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
# node.js
#
node_modules/
npm-debug.log
{
"globals": {
"requestAnimationFrame": true
},
"rules": {
"indent": [
2,
2
],
"quotes": [
2,
"double"
],
"linebreak-style": [
2,
"unix"
],
"semi": [
2,
"always"
],
"comma-dangle": 0,
"no-var": 1,
"react/jsx-boolean-value": 1,
"react/jsx-no-undef": 1,
"react/jsx-quotes": 1,
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1,
"react/no-danger": 1,
"react/no-did-mount-set-state": 1,
"react/no-did-update-set-state": 1,
"react/no-unknown-property": 1,
"react/react-in-jsx-scope": 1,
"react/require-extension": 1,
"react/sort-comp": 1
},
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
},
"plugins": [
"react"
]
}
[ignore]
# We fork some components by platform.
.*/*.web.js
.*/*.android.js
# Some modules have their own node_modules with overlap
.*/node_modules/node-haste/.*
# Ignore react-tools where there are overlaps, but don't ignore anything that
# react-native relies on
.*/node_modules/react-tools/src/React.js
.*/node_modules/react-tools/src/renderers/shared/reconciler/ReactInstanceHandles.js
.*/node_modules/react-tools/src/renderers/shared/event/EventPropagators.js
.*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js
.*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderSyntheticEvent.js
.*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderTouchHistoryStore.js
.*/node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js
# Ignore commoner tests
.*/node_modules/commoner/test/.*
# See https://github.com/facebook/flow/issues/442
.*/react-tools/node_modules/commoner/lib/reader.js
# Ignore jest
.*/react-native/node_modules/jest-cli/.*
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
[options]
module.system=haste
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-3]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-3]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
[version]
0.13.1
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
008F07F31AC5B25A0029DE68 /* main.jsbundle in Resources */ = {isa = PBXBuildFile; fileRef = 008F07F21AC5B25A0029DE68 /* main.jsbundle */; };
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
340554DC1B8226B9009D567B /* libRNGL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 340554D91B822545009D567B /* libRNGL.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RCTActionSheet;
};
00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RCTGeolocation;
};
00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 58B5115D1A9E6B3D00147676;
remoteInfo = RCTImage;
};
00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 58B511DB1A9E6C8500147676;
remoteInfo = RCTNetwork;
};
00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 832C81801AAF6DEF007FA2F7;
remoteInfo = RCTVibration;
};
139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RCTSettings;
};
139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3C86DF461ADF2C930047B81A;
remoteInfo = RCTWebSocket;
};
146834031AC3E56700842450 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
remoteInfo = React;
};
340554D81B822545009D567B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 340554D11B822545009D567B /* RNGL.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 34B330031B821571003856F8;
remoteInfo = RNGL;
};
340554DA1B822545009D567B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 340554D11B822545009D567B /* RNGL.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 34B3300E1B821571003856F8;
remoteInfo = RNGLTests;
};
78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RCTLinking;
};
832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 58B5119B1A9E6C1200147676;
remoteInfo = RCTText;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.jsbundle; path = iOS/main.jsbundle; sourceTree = "<group>"; };
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = "<group>"; };
00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = "<group>"; };
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = "<group>"; };
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = "<group>"; };
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = "<group>"; };
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* AdvancedEffects.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AdvancedEffects.app; sourceTree = BUILT_PRODUCTS_DIR; };
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = iOS/AppDelegate.h; sourceTree = "<group>"; };
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = iOS/AppDelegate.m; sourceTree = "<group>"; };
13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = iOS/Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = iOS/Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = iOS/main.m; sourceTree = "<group>"; };
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
340554D11B822545009D567B /* RNGL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNGL.xcodeproj; path = "node_modules/gl-react-native/RNGL.xcodeproj"; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
340554DC1B8226B9009D567B /* libRNGL.a in Frameworks */,
146834051AC3E58100842450 /* libReact.a in Frameworks */,
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */,
00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */,
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */,
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */,
139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */,
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
00C302A81ABCB8CE00DB3ED1 /* Products */ = {
isa = PBXGroup;
children = (
00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */,
);
name = Products;
sourceTree = "<group>";
};
00C302B61ABCB90400DB3ED1 /* Products */ = {
isa = PBXGroup;
children = (
00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */,
);
name = Products;
sourceTree = "<group>";
};
00C302BC1ABCB91800DB3ED1 /* Products */ = {
isa = PBXGroup;
children = (
00C302C01ABCB91800DB3ED1 /* libRCTImage.a */,
);
name = Products;
sourceTree = "<group>";
};
00C302D41ABCB9D200DB3ED1 /* Products */ = {
isa = PBXGroup;
children = (
00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */,
);
name = Products;
sourceTree = "<group>";
};
00C302E01ABCB9EE00DB3ED1 /* Products */ = {
isa = PBXGroup;
children = (
00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */,
);
name = Products;
sourceTree = "<group>";
};
139105B71AF99BAD00B5F7CC /* Products */ = {
isa = PBXGroup;
children = (
139105C11AF99BAD00B5F7CC /* libRCTSettings.a */,
);
name = Products;
sourceTree = "<group>";
};
139FDEE71B06529A00C62182 /* Products */ = {
isa = PBXGroup;
children = (
139FDEF41B06529B00C62182 /* libRCTWebSocket.a */,
);
name = Products;
sourceTree = "<group>";
};
13B07FAE1A68108700A75B9A /* AdvancedEffects */ = {
isa = PBXGroup;
children = (
008F07F21AC5B25A0029DE68 /* main.jsbundle */,
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
13B07FB01A68108700A75B9A /* AppDelegate.m */,
13B07FB51A68108700A75B9A /* Images.xcassets */,
13B07FB61A68108700A75B9A /* Info.plist */,
13B07FB11A68108700A75B9A /* LaunchScreen.xib */,
13B07FB71A68108700A75B9A /* main.m */,
);
name = AdvancedEffects;
sourceTree = "<group>";
};
146834001AC3E56700842450 /* Products */ = {
isa = PBXGroup;
children = (
146834041AC3E56700842450 /* libReact.a */,
);
name = Products;
sourceTree = "<group>";
};
340554D21B822545009D567B /* Products */ = {
isa = PBXGroup;
children = (
340554D91B822545009D567B /* libRNGL.a */,
340554DB1B822545009D567B /* RNGLTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
78C398B11ACF4ADC00677621 /* Products */ = {
isa = PBXGroup;
children = (
78C398B91ACF4ADC00677621 /* libRCTLinking.a */,
);
name = Products;
sourceTree = "<group>";
};
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
146833FF1AC3E56700842450 /* React.xcodeproj */,
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */,
00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */,
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */,
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */,
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */,
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */,
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
340554D11B822545009D567B /* RNGL.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
};
832341B11AAA6A8300B99B32 /* Products */ = {
isa = PBXGroup;
children = (
832341B51AAA6A8300B99B32 /* libRCTText.a */,
);
name = Products;
sourceTree = "<group>";
};
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
13B07FAE1A68108700A75B9A /* AdvancedEffects */,
832341AE1AAA6A7D00B99B32 /* Libraries */,
83CBBA001A601CBA00E9B192 /* Products */,
);
indentWidth = 2;
sourceTree = "<group>";
tabWidth = 2;
};
83CBBA001A601CBA00E9B192 /* Products */ = {
isa = PBXGroup;
children = (
13B07F961A680F5B00A75B9A /* AdvancedEffects.app */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
13B07F861A680F5B00A75B9A /* AdvancedEffects */ = {
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "AdvancedEffects" */;
buildPhases = (
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = AdvancedEffects;
productName = "Hello World";
productReference = 13B07F961A680F5B00A75B9A /* AdvancedEffects.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
83CBB9F71A601CBA00E9B192 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0610;
ORGANIZATIONNAME = Facebook;
};
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "AdvancedEffects" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 83CBB9F61A601CBA00E9B192;
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */;
ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
},
{
ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */;
ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */;
},
{
ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */;
ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
},
{
ProductGroup = 78C398B11ACF4ADC00677621 /* Products */;
ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
},
{
ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */;
ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
},
{
ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */;
ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
},
{
ProductGroup = 832341B11AAA6A8300B99B32 /* Products */;
ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
},
{
ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */;
ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */;
},
{
ProductGroup = 139FDEE71B06529A00C62182 /* Products */;
ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
},
{
ProductGroup = 146834001AC3E56700842450 /* Products */;
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
},
{
ProductGroup = 340554D21B822545009D567B /* Products */;
ProjectRef = 340554D11B822545009D567B /* RNGL.xcodeproj */;
},
);
projectRoot = "";
targets = (
13B07F861A680F5B00A75B9A /* AdvancedEffects */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTActionSheet.a;
remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTGeolocation.a;
remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTImage.a;
remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTNetwork.a;
remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTVibration.a;
remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTSettings.a;
remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTWebSocket.a;
remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
146834041AC3E56700842450 /* libReact.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libReact.a;
remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
340554D91B822545009D567B /* libRNGL.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNGL.a;
remoteRef = 340554D81B822545009D567B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
340554DB1B822545009D567B /* RNGLTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = RNGLTests.xctest;
remoteRef = 340554DA1B822545009D567B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTLinking.a;
remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
832341B51AAA6A8300B99B32 /* libRCTText.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTText.a;
remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
13B07F8E1A680F5B00A75B9A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
008F07F31AC5B25A0029DE68 /* main.jsbundle in Resources */,
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
13B07F871A680F5B00A75B9A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
13B07FC11A68108700A75B9A /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = {
isa = PBXVariantGroup;
children = (
13B07FB21A68108700A75B9A /* Base */,
);
name = LaunchScreen.xib;
path = iOS;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/node_modules/react-native/React/**",
);
INFOPLIST_FILE = iOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = AdvancedEffects;
};
name = Debug;
};
13B07F951A680F5B00A75B9A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/node_modules/react-native/React/**",
);
INFOPLIST_FILE = iOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = AdvancedEffects;
};
name = Release;
};
83CBBA201A601CBA00E9B192 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/node_modules/react-native/React/**",
);
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
83CBBA211A601CBA00E9B192 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/node_modules/react-native/React/**",
);
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "AdvancedEffects" */ = {
isa = XCConfigurationList;
buildConfigurations = (
13B07F941A680F5B00A75B9A /* Debug */,
13B07F951A680F5B00A75B9A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "AdvancedEffects" */ = {
isa = XCConfigurationList;
buildConfigurations = (
83CBBA201A601CBA00E9B192 /* Debug */,
83CBBA211A601CBA00E9B192 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;
}
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0620"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "AdvancedEffects.app"
BlueprintName = "AdvancedEffects"
ReferencedContainer = "container:AdvancedEffects.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "AdvancedEffectsTests.xctest"
BlueprintName = "AdvancedEffectsTests"
ReferencedContainer = "container:AdvancedEffects.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "AdvancedEffectsTests.xctest"
BlueprintName = "AdvancedEffectsTests"
ReferencedContainer = "container:AdvancedEffects.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "AdvancedEffects.app"
BlueprintName = "AdvancedEffects"
ReferencedContainer = "container:AdvancedEffects.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "AdvancedEffects.app"
BlueprintName = "AdvancedEffects"
ReferencedContainer = "container:AdvancedEffects.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "AdvancedEffects.app"
BlueprintName = "AdvancedEffects"
ReferencedContainer = "container:AdvancedEffects.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
## Developing with the example
```
npm install react-native
npm install ../.. # everytime the lib code changes
```
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (nonatomic, strong) UIWindow *window;
@end
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "AppDelegate.h"
#import "RCTRootView.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
/**
* Loading JavaScript code - uncomment the one you want.
*
* OPTION 1
* Load from development server. Start the server from the repository root:
*
* $ npm start
*
* To run on device, change `localhost` to the IP address of your computer
* (you can get this by typing `ifconfig` into the terminal and selecting the
* `inet` value under `en0:`) and make sure your computer and iOS device are
* on the same Wi-Fi network.
*/
jsCodeLocation = [NSURL URLWithString:@"http://192.168.0.26:8081/index.ios.bundle"];
/**
* OPTION 2
* Load from pre-bundled file on disk. To re-generate the static bundle
* from the root of your project directory, run
*
* $ react-native bundle --minify
*
* see http://facebook.github.io/react-native/docs/runningondevice.html
*/
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"AdvancedEffects"
launchOptions:launchOptions];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [[UIViewController alloc] init];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="AdvancedEffects" 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"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="548" y="455"/>
</view>
</objects>
</document>
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
// Offline JS
// To re-generate the offline bundle, run this from the root of your project:
//
// $ react-native bundle --minify
//
// See http://facebook.github.io/react-native/docs/runningondevice.html for more details.
throw new Error('Offline JS file is empty. See iOS/main.jsbundle for instructions');
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
const { AppRegistry } = require("react-native");
const AdvancedEffects = require("./src");
AppRegistry.registerComponent("AdvancedEffects", () => AdvancedEffects);
{
"name": "AdvancedEffects",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node_modules/react-native/packager/packager.sh"
},
"dependencies": {
"react-native": "^0.9.0",
"gl-react-native": "0.0.x"
},
"devDependencies": {
"eslint": "^1.1.0",
"eslint-plugin-react": "^3.2.3"
}
}
const React = require("react-native");
const GL = require("gl-react-native");
const shaders = GL.Shaders.create({
banner: {
frag: `
precision highp float;
varying vec2 uv;
uniform float time;
void main( void ) {
float color = 0.0;
color += sin( uv.x * cos( time / 15.0 ) * 80.0 ) + cos( uv.y * cos( time / 15.0 ) * 10.0 );
color += sin( uv.y * sin( time / 10.0 ) * 40.0 ) + cos( uv.x * sin( time / 25.0 ) * 40.0 );
color += sin( uv.x * sin( time / 5.0 ) * 10.0 ) + sin( uv.y * sin( time / 35.0 ) * 80.0 );
color *= sin( time / 10.0 ) * 0.5;
gl_FragColor = vec4(
smoothstep(0.0, 1.5, color),
smoothstep(0.0, 0.5, color),
smoothstep(1.0, 0.6, color) - smoothstep(0.1, 0.0, color),
color
) * (pow(uv.y, 2.0));
}
`
}
});
class Banner extends React.Component {
render () {
const { width, height, time } = this.props;
return <GL.View
shader={shaders.banner}
style={{ width, height }}
uniforms={{ time: time }}
opaque={false}
/>;
}
}
module.exports = Banner;
const React = require("react-native");
const {
View,
Text,
} = React;
const GL = require("gl-react-native");
const shaders = GL.Shaders.create({
drunkEffect: {
frag: `
precision highp float;
varying vec2 uv;
uniform float time;
uniform float amp;
uniform float freq;
uniform float colorSeparation;
uniform sampler2D texture;
uniform float moving;
vec2 lookup (vec2 offset) {
return mod(
uv + amp * vec2(cos(freq*(uv.x+offset.x)+time),sin(freq*(uv.y+offset.x)+time)) + vec2(moving * time/10.0, 0.0),
vec2(1.0));
}
void main() {
gl_FragColor = vec4(
vec3(
texture2D(texture, lookup(vec2(colorSeparation))).r,
texture2D(texture, lookup(vec2(-colorSeparation))).g,
texture2D(texture, lookup(vec2(0.0))).b),
1.0);
}
`
}
});
class Intro extends React.Component {
render () {
const { time, fps, width, height } = this.props;
return <GL.View
shader={shaders.drunkEffect}
style={{ width, height }}
opaque={false}
uniforms={{
time: time,
freq: 12 - 9 * Math.sin(time / 7),
amp: 0.04 - 0.03 * Math.cos(time / 4),
colorSeparation: 0.02,
moving: 1
}}>
<GL.Target uniform="texture" style={{ justifyContent: "center" }}>
<Text style={{ color: "#00BDF3", fontSize: 24, letterSpacing: -2.0 }}>
GL REACT NATIVE
</Text>
<View style={{ flex: 1, flexDirection: "row", alignItems: "center", justifyContent: "center" }}>
<View style={{ backgroundColor: "#00FF66", marginRight: 8, width: 14, height: 14, borderRadius: 7, opacity: time%1 < 0.6 ? 1 : 0 }} />
<Text style={{ flex: 1, color: "#00FF66", fontSize: 14 }}>
{time.toFixed(2)}s
</Text>
<Text style={{ flex: 1, color: "#fff", fontSize: 14 }}>
{(fps).toFixed(0)} fps
</Text>
<Text style={{ flex: 1, color: "#999", fontSize: 14 }}>
{"<Text />"}
</Text>
</View>
</GL.Target>
</GL.View>;
}
}
module.exports = Intro;
const React = require("react-native");
const GL = require("gl-react-native");
const Transition = require("./Transition");
const shaders = GL.Shaders.create({
transitionDirectionalWipe: {
frag: `
precision highp float;
varying vec2 uv;
uniform sampler2D from;
uniform sampler2D to;
uniform float progress;
uniform vec2 direction;
uniform float smoothness;
const vec2 center = vec2(0.5, 0.5);
void main() {
vec2 v = normalize(direction);
v /= abs(v.x)+abs(v.y);
float d = v.x * center.x + v.y * center.y;
float m = smoothstep(-smoothness, 0.0, v.x * uv.x + v.y * uv.y - (d-0.5+progress*(1.+smoothness)));
gl_FragColor = mix(texture2D(to, uv), texture2D(from, uv), m);
}
`
},
transitionRandomSquares: {
frag: `
precision highp float;
varying vec2 uv;
uniform sampler2D from;
uniform sampler2D to;
uniform float progress;
uniform ivec2 size;
uniform float smoothness;
float rand (vec2 co) {
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}
void main() {
float r = rand(floor(vec2(size) * uv));
float m = smoothstep(0.0, -smoothness, r - (progress * (1.0 + smoothness)));
gl_FragColor = mix(texture2D(from, uv), texture2D(to, uv), m);
}
`
},
transitionWind: {
frag: `
precision highp float;
varying vec2 uv;
uniform sampler2D from, to;
uniform float progress;
uniform float size;
float rand (vec2 co) {
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}
void main() {
float r = rand(vec2(0, uv.y));
float m = smoothstep(0.0, -size, uv.x*(1.0-size) + size*r - (progress * (1.0 + size)));
gl_FragColor = mix(texture2D(from, uv), texture2D(to, uv), m);
}
`
}
});
class Slideshow extends React.Component {
render () {
const { duration, width, height, time, images } = this.props;
const slide = time / duration;
let transitionProgress = slide % 1;
let transitionFrom = images[Math.floor(slide) % images.length];
let transitionTo = images[Math.floor(slide+1) % images.length];
let transitionShader, transitionUniforms;
switch (Math.floor(slide/4) % 3) {
case 0:
transitionShader = shaders.transitionRandomSquares;
const w = 3 * (1 + Math.floor(slide % 8));
transitionUniforms = {
size: [w, w * 2 / 3],
smoothness: 0.5
};
break;
case 1:
transitionShader = shaders.transitionDirectionalWipe;
transitionUniforms = {
direction: [Math.cos(time/2), Math.sin(time/2)],
smoothness: 0.5
};
break;
case 2:
transitionShader = shaders.transitionWind;
transitionUniforms = {
size: 0.2
};
break;
}
return <Transition
width={width}
height={height}
progress={transitionProgress}
from={transitionFrom}
to={transitionTo}
shader={transitionShader}
uniforms={transitionUniforms}
/>;
}
}
module.exports = Slideshow;
const React = require("react-native");
const GL = require("gl-react-native");
class Transition extends React.Component {
render () {
const { width, height, shader, progress, from, to, uniforms } = this.props;
return <GL.View
shader={shader}
style={{ width, height }}
opaque={false}
uniforms={{
progress,
from,
to,
...uniforms
}}
/>;
}
}
module.exports = Transition;
const React = require("react-native");
const GL = require("gl-react-native");
const shaders = GL.Shaders.create({
imageVignette: {
frag: `
precision highp float;
varying vec2 uv;
uniform float time;
uniform float amp;
uniform float freq;
uniform float colorSeparation;
uniform sampler2D texture;
uniform float moving;
const vec2 center = vec2(0.5);
vec2 lookup (vec2 offset) {
return mod(
uv + amp * vec2(cos(freq*(uv.x+offset.x)+time),sin(freq*(uv.y+offset.x)+time)) + vec2(moving * time/10.0, 0.0),
vec2(1.0));
}
void main() {
gl_FragColor = vec4(
vec3(
texture2D(texture, lookup(vec2(colorSeparation))).r,
texture2D(texture, lookup(vec2(-colorSeparation))).g,
texture2D(texture, lookup(vec2(0.0))).b),
1.0-min(1.0, pow(1.9 * distance(uv, center), 4.0) + 0.5 * pow(distance(fract(50.0 * uv.y), 0.5), 2.0)));
}
`
}
});
class Vignette extends React.Component {
render () {
const { width, height, time, i, source } = this.props;
return <GL.View
shader={shaders.imageVignette}
style={{ width, height }}
opaque={false}
uniforms={{
time: time,
freq: (10+i)*(1+Math.sin(0.7*time + i)),
texture: source,
amp: 0.02 + Math.max(0, 0.05*i*Math.cos(time + 2*i)),
colorSeparation: 0.03,
moving: 0
}}
/>;
}
}
module.exports = Vignette;
const React = require("react-native");
const {
StyleSheet,
View,
StatusBarIOS,
} = React;
const { width: viewportW, height: viewportH } = require("Dimensions").get("window");
const Banner = require("./Banner");
const Intro = require("./Intro");
const Vignette = require("./Vignette");
const Slideshow = require("./Slideshow");
class AdvancedEffects extends React.Component {
constructor (props) {
super(props);
this.state = {
time: 0.02,
frames: 1,
images:
//"MQtLWbD,N8a9CkZ,adCmISK,AedZQ4N,y9qRJR3,brzKTYZ,NSyk07l,EaZiWfn,I1KZdnl,DoQBdzT,slIt2Ww,DA12puU,IYLdRFW,oqmO4Po,T6NaLyI,6XAPrAY,thYzbif,4qmqo3o,8xT2J96,ZCa2pWq,loQfDN2,oabfA68,uOXqDRY,MyyS4vK,fhNYTX4"
"ljVkFzQ,ljVkFzQ,qM9BHCy,F7NKlQF,rYcweR7,IE8T6UX,3On9QEu"
.split(",")
.map(id => ({ uri: `http://imgur.com/${id}.jpg` }))
};
StatusBarIOS.setHidden(true);
}
componentDidMount () {
let startTime;
const loop = t => {
requestAnimationFrame(loop);
if (!startTime) startTime = t;
const time = (t - startTime) / 1000;
this.setState({ time: time, frames: this.state.frames+1 });
};
requestAnimationFrame(loop);
}
render () {
const {time, frames, images} = this.state;
const nbVignettes = 1;
const imgW = Math.floor(viewportW/nbVignettes);
const imgH = Math.floor((2/3)*viewportW/nbVignettes);
const introH = 100;
const transitionH = Math.floor((2/3)*viewportW);
return (
<View style={styles.root}>
<Banner
time={time}
width={viewportW}
height={viewportH - introH - imgH - transitionH}
/>
<Intro
time={time}
fps={frames/time}
width={viewportW}
height={introH}
/>
<View style={{ flex: 1, flexWrap: "wrap", flexDirection: "row" }}>
{images.slice(0, nbVignettes).map((source, i) =>
<Vignette key={i}
time={time}
width={imgW}
height={imgH}
i={i}
source={source}
/>
)}
</View>
<Slideshow
time={time}
width={viewportW}
height={transitionH}
images={images.slice(2)}
duration={3}
/>
</View>
);
}
}
const styles = StyleSheet.create({
root: {
flex: 1,
backgroundColor: "#111"
}
});
module.exports = AdvancedEffects;
## Installation
a few steps are required to install gl-react-native:
### install the dependency from your React Native application.
```
npm i --save gl-react-native
```
### Configure your React Native Application
![](docs/install-steps.png)
## Credits / Inspiration
- [stack.gl](http://stack.gl/) approach
- [GLSL.io](http://glsl.io/) and [Diaporama](https://github.com/gre/diaporama)
- Source code of [React Native](https://github.com/facebook/react-native)
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
34B3300F1B821571003856F8 /* libRNGL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 34B330031B821571003856F8 /* libRNGL.a */; };
34EA054A1B82179E00A4FAFF /* GLReactImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 34EA053B1B82179E00A4FAFF /* GLReactImage.m */; };
34EA054B1B82179E00A4FAFF /* GLShader.m in Sources */ = {isa = PBXBuildFile; fileRef = 34EA053D1B82179E00A4FAFF /* GLShader.m */; };
34EA054C1B82179E00A4FAFF /* GLShadersRegistry.m in Sources */ = {isa = PBXBuildFile; fileRef = 34EA053F1B82179E00A4FAFF /* GLShadersRegistry.m */; };
34EA054D1B82179E00A4FAFF /* GLTexture.m in Sources */ = {isa = PBXBuildFile; fileRef = 34EA05411B82179E00A4FAFF /* GLTexture.m */; };
34EA054E1B82179E00A4FAFF /* GLUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 34EA05431B82179E00A4FAFF /* GLUtils.m */; };
34EA054F1B82179E00A4FAFF /* GLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 34EA05451B82179E00A4FAFF /* GLView.m */; };
34EA05501B82179E00A4FAFF /* GLViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 34EA05471B82179E00A4FAFF /* GLViewManager.m */; };
34EA05511B82179E00A4FAFF /* ImageData.m in Sources */ = {isa = PBXBuildFile; fileRef = 34EA05491B82179E00A4FAFF /* ImageData.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
34B330101B821571003856F8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 34B32FFB1B821571003856F8 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 34B330021B821571003856F8;
remoteInfo = RNGL;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
34B330011B821571003856F8 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "include/$(PRODUCT_NAME)";
dstSubfolderSpec = 16;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
34B330031B821571003856F8 /* libRNGL.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNGL.a; sourceTree = BUILT_PRODUCTS_DIR; };
34B3300E1B821571003856F8 /* RNGLTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNGLTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
34B330141B821571003856F8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
34EA053A1B82179E00A4FAFF /* GLReactImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLReactImage.h; sourceTree = "<group>"; };
34EA053B1B82179E00A4FAFF /* GLReactImage.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; path = GLReactImage.m; sourceTree = "<group>"; tabWidth = 2; };
34EA053C1B82179E00A4FAFF /* GLShader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLShader.h; sourceTree = "<group>"; };
34EA053D1B82179E00A4FAFF /* GLShader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GLShader.m; sourceTree = "<group>"; };
34EA053E1B82179E00A4FAFF /* GLShadersRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLShadersRegistry.h; sourceTree = "<group>"; };
34EA053F1B82179E00A4FAFF /* GLShadersRegistry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GLShadersRegistry.m; sourceTree = "<group>"; };
34EA05401B82179E00A4FAFF /* GLTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLTexture.h; sourceTree = "<group>"; };
34EA05411B82179E00A4FAFF /* GLTexture.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GLTexture.m; sourceTree = "<group>"; };
34EA05421B82179E00A4FAFF /* GLUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLUtils.h; sourceTree = "<group>"; };
34EA05431B82179E00A4FAFF /* GLUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GLUtils.m; sourceTree = "<group>"; };
34EA05441B82179E00A4FAFF /* GLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLView.h; sourceTree = "<group>"; };
34EA05451B82179E00A4FAFF /* GLView.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; path = GLView.m; sourceTree = "<group>"; tabWidth = 2; };
34EA05461B82179E00A4FAFF /* GLViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLViewManager.h; sourceTree = "<group>"; };
34EA05471B82179E00A4FAFF /* GLViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GLViewManager.m; sourceTree = "<group>"; };
34EA05481B82179E00A4FAFF /* ImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageData.h; sourceTree = "<group>"; };
34EA05491B82179E00A4FAFF /* ImageData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageData.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
34B330001B821571003856F8 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
34B3300B1B821571003856F8 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
34B3300F1B821571003856F8 /* libRNGL.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
3405549E1B8220E6009D567B /* Libraries */ = {
isa = PBXGroup;
children = (
);
name = Libraries;
sourceTree = "<group>";
};
34B32FFA1B821571003856F8 = {
isa = PBXGroup;
children = (
34B330051B821571003856F8 /* RNGL */,
34B330121B821571003856F8 /* RNGLTests */,
3405549E1B8220E6009D567B /* Libraries */,
34B330041B821571003856F8 /* Products */,
);
indentWidth = 2;
sourceTree = "<group>";
tabWidth = 2;
};
34B330041B821571003856F8 /* Products */ = {
isa = PBXGroup;
children = (
34B330031B821571003856F8 /* libRNGL.a */,
34B3300E1B821571003856F8 /* RNGLTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
34B330051B821571003856F8 /* RNGL */ = {
isa = PBXGroup;
children = (
34EA053A1B82179E00A4FAFF /* GLReactImage.h */,
34EA053B1B82179E00A4FAFF /* GLReactImage.m */,
34EA053C1B82179E00A4FAFF /* GLShader.h */,
34EA053D1B82179E00A4FAFF /* GLShader.m */,
34EA053E1B82179E00A4FAFF /* GLShadersRegistry.h */,
34EA053F1B82179E00A4FAFF /* GLShadersRegistry.m */,
34EA05401B82179E00A4FAFF /* GLTexture.h */,
34EA05411B82179E00A4FAFF /* GLTexture.m */,
34EA05421B82179E00A4FAFF /* GLUtils.h */,
34EA05431B82179E00A4FAFF /* GLUtils.m */,
34EA05441B82179E00A4FAFF /* GLView.h */,
34EA05451B82179E00A4FAFF /* GLView.m */,
34EA05461B82179E00A4FAFF /* GLViewManager.h */,
34EA05471B82179E00A4FAFF /* GLViewManager.m */,
34EA05481B82179E00A4FAFF /* ImageData.h */,
34EA05491B82179E00A4FAFF /* ImageData.m */,
);
path = RNGL;
sourceTree = "<group>";
};
34B330121B821571003856F8 /* RNGLTests */ = {
isa = PBXGroup;
children = (
34B330131B821571003856F8 /* Supporting Files */,
);
path = RNGLTests;
sourceTree = "<group>";
};
34B330131B821571003856F8 /* Supporting Files */ = {
isa = PBXGroup;
children = (
34B330141B821571003856F8 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
34B330021B821571003856F8 /* RNGL */ = {
isa = PBXNativeTarget;
buildConfigurationList = 34B330171B821571003856F8 /* Build configuration list for PBXNativeTarget "RNGL" */;
buildPhases = (
34B32FFF1B821571003856F8 /* Sources */,
34B330001B821571003856F8 /* Frameworks */,
34B330011B821571003856F8 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = RNGL;
productName = RNGL;
productReference = 34B330031B821571003856F8 /* libRNGL.a */;
productType = "com.apple.product-type.library.static";
};
34B3300D1B821571003856F8 /* RNGLTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 34B3301A1B821571003856F8 /* Build configuration list for PBXNativeTarget "RNGLTests" */;
buildPhases = (
34B3300A1B821571003856F8 /* Sources */,
34B3300B1B821571003856F8 /* Frameworks */,
34B3300C1B821571003856F8 /* Resources */,
);
buildRules = (
);
dependencies = (
34B330111B821571003856F8 /* PBXTargetDependency */,
);
name = RNGLTests;
productName = RNGLTests;
productReference = 34B3300E1B821571003856F8 /* RNGLTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
34B32FFB1B821571003856F8 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0640;
ORGANIZATIONNAME = "Project September";
TargetAttributes = {
34B330021B821571003856F8 = {
CreatedOnToolsVersion = 6.4;
};
34B3300D1B821571003856F8 = {
CreatedOnToolsVersion = 6.4;
};
};
};
buildConfigurationList = 34B32FFE1B821571003856F8 /* Build configuration list for PBXProject "RNGL" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 34B32FFA1B821571003856F8;
productRefGroup = 34B330041B821571003856F8 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
34B330021B821571003856F8 /* RNGL */,
34B3300D1B821571003856F8 /* RNGLTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
34B3300C1B821571003856F8 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
34B32FFF1B821571003856F8 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
34EA054C1B82179E00A4FAFF /* GLShadersRegistry.m in Sources */,
34EA054A1B82179E00A4FAFF /* GLReactImage.m in Sources */,
34EA054D1B82179E00A4FAFF /* GLTexture.m in Sources */,
34EA05511B82179E00A4FAFF /* ImageData.m in Sources */,
34EA05501B82179E00A4FAFF /* GLViewManager.m in Sources */,
34EA054B1B82179E00A4FAFF /* GLShader.m in Sources */,
34EA054E1B82179E00A4FAFF /* GLUtils.m in Sources */,
34EA054F1B82179E00A4FAFF /* GLView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
34B3300A1B821571003856F8 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
34B330111B821571003856F8 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 34B330021B821571003856F8 /* RNGL */;
targetProxy = 34B330101B821571003856F8 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
34B330151B821571003856F8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../react-native/React/**",
"$(SRCROOT)/../react-native/Libraries/Image",
"$(SRCROOT)/node_modules/react-native/React/**",
"$(SRCROOT)/node_modules/react-native/Libraries/Image",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
34B330161B821571003856F8 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../react-native/React/**",
"$(SRCROOT)/../react-native/Libraries/Image",
"$(SRCROOT)/node_modules/react-native/React/**",
"$(SRCROOT)/node_modules/react-native/Libraries/Image",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
34B330181B821571003856F8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
34B330191B821571003856F8 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
34B3301B1B821571003856F8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = RNGLTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
34B3301C1B821571003856F8 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
INFOPLIST_FILE = RNGLTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
34B32FFE1B821571003856F8 /* Build configuration list for PBXProject "RNGL" */ = {
isa = XCConfigurationList;
buildConfigurations = (
34B330151B821571003856F8 /* Debug */,
34B330161B821571003856F8 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
34B330171B821571003856F8 /* Build configuration list for PBXNativeTarget "RNGL" */ = {
isa = XCConfigurationList;
buildConfigurations = (
34B330181B821571003856F8 /* Debug */,
34B330191B821571003856F8 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
34B3301A1B821571003856F8 /* Build configuration list for PBXNativeTarget "RNGLTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
34B3301B1B821571003856F8 /* Debug */,
34B3301C1B821571003856F8 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 34B32FFB1B821571003856F8 /* Project object */;
}
#import "RCTBridge.h"
#import "ImageData.h"
@interface GLReactImage: NSObject
@property (nonatomic, copy) NSString *src;
@property (nonatomic) UIImage *image;
- (instancetype)initWithBridge:(RCTBridge *)bridge withOnLoad:(void (^)(void))onload NS_DESIGNATED_INITIALIZER;
- (ImageData *) getImageData;
@end
#import "GLReactImage.h"
#import "GLUtils.h"
#import "ImageData.h"
#import "RCTBridge.h"
#import "RCTImageLoader.h"
#import "RCTLog.h"
@implementation GLReactImage
{
RCTBridge *_bridge; // React's bridge allow to access the imageLoader
UIImage *_image; // The currently loaded image (nil if no image fully loaded yet)
ImageData *_data; // Cache of the _data related to this image (computed by getImageData)
void (^_onload)(void); // called everytime an image loads
RCTImageLoaderCancellationBlock _loading; // the current loading cancellation function
}
- (instancetype)initWithBridge:(RCTBridge *)bridge withOnLoad:(void (^)(void))onload
{
if ((self = [super init])) {
_bridge = bridge;
_onload = onload;
_image = nil;
_loading = nil;
}
return self;
}
- (void)dealloc
{
[self clearImage];
if (_loading) _loading();
_onload = nil;
_loading = nil;
_bridge = nil;
}
RCT_NOT_IMPLEMENTED(-init)
- (void) clearImage
{
_image = nil;
_data = nil;
}
- (ImageData *) getImageData
{
if (!_data) {
_data = genPixelsWithImage(_image);
}
return _data;
}
- (void)setSrc:(NSString *)src
{
if (![src isEqual:_src]) {
_src = [src copy];
[self reloadImage];
}
}
- (void)reloadImage
{
if (_loading) _loading();
_loading = nil;
if (!_src) {
[self clearImage];
} else {
// Load the image (without resizing it)
if (![_src hasPrefix:@"http://"] && ![_src hasPrefix:@"http://"]) {
self.image = [UIImage imageNamed:_src];
if(_onload) _onload();
} else {
_loading = [_bridge.imageLoader loadImageWithTag:_src
size:CGSizeZero
scale:0
resizeMode:UIViewContentModeScaleToFill
progressBlock:nil
completionBlock:^(NSError *error, id image) {
_loading = nil;
[self clearImage];
if (error) {
NSLog(@"Image failed to load: %@", error);
} else {
self.image = image;
if(_onload) _onload();
}
}];
}
}
}
@end
#import <GLKit/GLKit.h>
#import "RCTBridgeModule.h"
@interface GLShader: NSObject
@property EAGLContext *context;
@property NSString *vert;
@property NSString *frag;
@property NSDictionary *uniformTypes;
/**
* Create a new shader with a vertex and fragment
*/
- (instancetype)initWithContext: (EAGLContext*)context withVert:(NSString *)vert withFrag:(NSString *)frag;
/**
* Bind the shader program as the current one
*/
- (void) bind;
/**
* Check the shader validity
*/
- (void) validate;
/**
* Set the value of an uniform
*/
- (void) setUniform: (NSString *)name withValue:(id)obj;
@end
#import <GLKit/GLKit.h>
#import "RCTBridgeModule.h"
#import "RCTLog.h"
#import "RCTConvert.h"
#import "GLUtils.h"
#import "GLShader.h"
/**
* a GLShader represents the atomic component of GL React Native.
* It currently statically holds a program that renders 2 static triangles over the full viewport (2D)
*/
@implementation GLShader
{
EAGLContext *_context; // Context related to this shader
GLuint program; // Program of the shader
GLuint buffer; // the buffer currently contains 2 static triangles covering the surface
GLint pointerLoc; // The "pointer" attribute is used to iterate over vertex
NSDictionary *_uniformTypes; // The types of the GLSL uniforms (N.B: array are not supported)
NSDictionary *_uniformLocations; // The uniform locations cache
}
- (instancetype)initWithContext: (EAGLContext*)context withVert:(NSString *)vert withFrag:(NSString *)frag
{
self = [super init];
if (self) {
_context = context;
_vert = vert;
_frag = frag;
[self makeProgram];
}
return self;
}
- (void)dealloc
{
glDeleteProgram(program);
glDeleteBuffers(1, &buffer);
}
- (bool) ensureContext
{
if (![EAGLContext setCurrentContext:_context]) {
RCTLogError(@"Failed to set current OpenGL context");
return false;
}
return true;
}
- (void) bind
{
if (![self ensureContext]) return;
if ( glIsProgram(program) != GL_TRUE ){
RCTLogError(@"not a program!");
return;
}
glUseProgram(program);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glEnableVertexAttribArray(pointerLoc);
glVertexAttribPointer(pointerLoc, 2, GL_FLOAT, GL_FALSE, 0, 0);
}
- (void) setUniform: (NSString *)name withValue:(id)value
{
if ([_uniformLocations objectForKey:name] == nil) {
RCTLogError(@"uniform '%@' does not exist", name);
return;
}
GLint location = [_uniformLocations[name] intValue];
GLenum type = [_uniformTypes[name] intValue];
switch (type)
{
case GL_FLOAT: {
NSNumber *v = [RCTConvert NSNumber:value];
if (!v) {
RCTLogError(@"uniform '%@' should be a float", name);
return;
}
glUniform1f(location, [v floatValue]);
break;
}
case GL_INT: {
NSNumber *v = [RCTConvert NSNumber:value];
if (!v) {
RCTLogError(@"uniform '%@' should be a int", name);
return;
}
glUniform1i(location, [v intValue]);
break;
}
case GL_BOOL: {
BOOL v = [RCTConvert BOOL:value];
glUniform1i(location, v ? 1 : 0);
break;
}
case GL_FLOAT_VEC2: {
NSArray *v = [RCTConvert NSArray:value];
if (!v || [v count]!=2) {
RCTLogError(@"uniform '%@' should be an array of 2 numbers", name);
return;
}
GLfloat arr[2];
for (int i=0; i<2; i++) {
NSNumber *n = [RCTConvert NSNumber: v[i]];
if (!n) {
RCTLogError(@"uniform '%@' array should only contains numbers", name);
return;
}
arr[i] = [n floatValue];
}
glUniform2fv(location, 1, arr);
break;
}
case GL_FLOAT_VEC3: {
NSArray *v = [RCTConvert NSArray:value];
if (!v || [v count]!=3) {
RCTLogError(@"uniform '%@' should be an array of 3 numbers", name);
return;
}
GLfloat arr[3];
for (int i=0; i<3; i++) {
NSNumber *n = [RCTConvert NSNumber: v[i]];
if (!n) {
RCTLogError(@"uniform '%@' array should only contains numbers", name);
return;
}
arr[i] = [n floatValue];
}
glUniform3fv(location, 1, arr);
break;
}
case GL_FLOAT_VEC4: {
NSArray *v = [RCTConvert NSArray:value];
if (!v || [v count]!=4) {
RCTLogError(@"uniform '%@' should be an array of 4 numbers", name);
return;
}
GLfloat arr[4];
for (int i=0; i<4; i++) {
NSNumber *n = [RCTConvert NSNumber: v[i]];
if (!n) {
RCTLogError(@"uniform '%@' array should only contains numbers", name);
return;
}
arr[i] = [n floatValue];
}
glUniform4fv(location, 1, arr);
break;
}
case GL_BOOL_VEC2:
case GL_INT_VEC2: {
NSArray *v = [RCTConvert NSArray:value];
if (!v || [v count]!=2) {
RCTLogError(@"uniform '%@' should be an array of 2 numbers", name);
return;
}
GLint arr[2];
for (int i=0; i<2; i++) {
NSNumber *n = [RCTConvert NSNumber: v[i]];
if (!n) {
RCTLogError(@"uniform '%@' array should only contains numbers", name);
return;
}
arr[i] = [n intValue];
}
glUniform2iv(location, 1, arr);
break;
}
case GL_BOOL_VEC3:
case GL_INT_VEC3: {
NSArray *v = [RCTConvert NSArray:value];
if (!v || [v count]!=3) {
RCTLogError(@"uniform '%@' should be an array of 3 numbers", name);
return;
}
GLint arr[3];
for (int i=0; i<3; i++) {
NSNumber *n = [RCTConvert NSNumber: v[i]];
if (!n) {
RCTLogError(@"uniform '%@' array should only contains numbers", name);
return;
}
arr[i] = [n intValue];
}
glUniform3iv(location, 1, arr);
break;
}
case GL_BOOL_VEC4:
case GL_INT_VEC4: {
NSArray *v = [RCTConvert NSArray:value];
if (!v || [v count]!=4) {
RCTLogError(@"uniform '%@' should be an array of 4 numbers", name);
return;
}
GLint arr[4];
for (int i=0; i<4; i++) {
NSNumber *n = [RCTConvert NSNumber: v[i]];
if (!n) {
RCTLogError(@"uniform '%@' array should only contains numbers", name);
return;
}
arr[i] = [n intValue];
}
glUniform4iv(location, 1, arr);
break;
}
case GL_FLOAT_MAT2: {
NSArray *v = [RCTConvert NSArray:value];
if (!v || [v count]!=4) {
RCTLogError(@"uniform '%@' should be an array of 4 numbers (matrix)", name);
return;
}
GLfloat arr[4];
for (int i=0; i<4; i++) {
NSNumber *n = [RCTConvert NSNumber: v[i]];
if (!n) {
RCTLogError(@"uniform '%@' array should only contains numbers", name);
return;
}
arr[i] = [n floatValue];
}
glUniformMatrix2fv(location, 1, false, arr);
break;
}
case GL_FLOAT_MAT3: {
NSArray *v = [RCTConvert NSArray:value];
if (!v || [v count]!=9) {
RCTLogError(@"uniform '%@' should be an array of 9 numbers (matrix)", name);
return;
}
GLfloat arr[9];
for (int i=0; i<9; i++) {
NSNumber *n = [RCTConvert NSNumber: v[i]];
if (!n) {
RCTLogError(@"uniform '%@' array should only contains numbers", name);
return;
}
arr[i] = [n floatValue];
}
glUniformMatrix3fv(location, 1, false, arr);
break;
}
case GL_FLOAT_MAT4: {
NSArray *v = [RCTConvert NSArray:value];
if (!v || [v count]!=16) {
RCTLogError(@"uniform '%@' should be an array of 16 numbers (matrix)", name);
return;
}
GLfloat arr[16];
for (int i=0; i<16; i++) {
NSNumber *n = [RCTConvert NSNumber: v[i]];
if (!n) {
RCTLogError(@"uniform '%@' array should only contains numbers", name);
return;
}
arr[i] = [n floatValue];
}
glUniformMatrix4fv(location, 1, false, arr);
break;
}
case GL_SAMPLER_CUBE:
case GL_SAMPLER_2D: {
NSInteger v = [RCTConvert NSInteger:value];
glUniform1i(location, (int) v);
break;
}
default:
RCTLogError(@"uniform '%@': unsupported type %i", name, type);
}
}
- (void) validate
{
glValidateProgram(program);
GLint validSuccess;
glGetProgramiv(program, GL_VALIDATE_STATUS, &validSuccess);
if (validSuccess == GL_FALSE) {
GLchar messages[256];
glGetProgramInfoLog(program, sizeof(messages), 0, &messages[0]);
NSString *messageString = [NSString stringWithUTF8String:messages];
RCTLogError(@"GL: Validation failed %@", messageString);
}
}
- (void) computeMeta
{
NSMutableDictionary *uniforms = @{}.mutableCopy;
NSMutableDictionary *locations = @{}.mutableCopy;
int nbUniforms;
GLchar name[256];
GLenum type;
GLint size;
GLsizei length;
glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &nbUniforms);
for (int i=0; i<nbUniforms; i++) {
glGetActiveUniform(program, i, sizeof(name), &length, &size, &type, name);
GLint location = glGetUniformLocation(program, name);
NSString *uniformName = [NSString stringWithUTF8String:name];
uniforms[uniformName] = [NSNumber numberWithInt:type];
locations[uniformName] = [NSNumber numberWithInt:location];
}
_uniformTypes = uniforms;
_uniformLocations = locations;
}
- (void) makeProgram
{
if (![self ensureContext]) return;
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GLuint vertex = compileShader(_vert, GL_VERTEX_SHADER);
if (vertex == -1) return;
GLuint fragment = compileShader(_frag, GL_FRAGMENT_SHADER);
if (fragment == -1) return;
program = glCreateProgram();
glAttachShader(program, vertex);
glAttachShader(program, fragment);
glLinkProgram(program);
GLint linkSuccess;
glGetProgramiv(program, GL_LINK_STATUS, &linkSuccess);
if (linkSuccess == GL_FALSE) {
GLchar messages[256];
glGetProgramInfoLog(program, sizeof(messages), 0, &messages[0]);
NSString *messageString = [NSString stringWithUTF8String:messages];
RCTLogError(@"GL: Linking failed %@", messageString);
return;
}
glUseProgram(program);
[self computeMeta];
pointerLoc = glGetAttribLocation(program, "position");
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
GLfloat buf[] = {
-1.0, -1.0,
1.0, -1.0,
-1.0, 1.0,
-1.0, 1.0,
1.0, -1.0,
1.0, 1.0
};
glBufferData(GL_ARRAY_BUFFER, sizeof(buf), buf, GL_STATIC_DRAW);
}
@end
#import <UIKit/UIKit.h>
#import "RCTBridgeModule.h"
#import "GLShader.h"
@interface GLShadersRegistry : NSObject <RCTBridgeModule>
/**
* Get the global shader for a given id.
*/
+ (GLShader*) getShader: (NSNumber *)ctxid;
@property NSMutableDictionary *shaders;
@end
#import <UIKit/UIKit.h>
#import "RCTBridgeModule.h"
#import "RCTConvert.h"
#import "RCTLog.h"
#import "GLShadersRegistry.h"
@implementation GLShadersRegistry
{
NSMutableDictionary *_shaders;
EAGLContext *_context;
}
GLShadersRegistry *GLShadersRegistry_instance; // FIXME is that the proper way to do singleton?
RCT_EXPORT_MODULE();
+ (GLShader*) getShader: (NSNumber *)ctxid
{
return [GLShadersRegistry_instance shaders][ctxid];
}
- (instancetype)init
{
self = [super init];
if (self) {
_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
if (!_context) {
RCTLogError(@"Failed to initialize OpenGLES 2.0 context");
}
_shaders = @{}.mutableCopy;
GLShadersRegistry_instance = self;
}
return self;
}
static NSString* fullViewportVert = @"attribute vec2 position;varying vec2 uv;void main() {gl_Position = vec4(position,0.0,1.0);uv = vec2(0.5, 0.5) * (position+vec2(1.0, 1.0));}";
RCT_EXPORT_METHOD(register:(nonnull NSNumber *)id withConfig:(NSDictionary *)config) {
NSString *frag = [RCTConvert NSString:config[@"frag"]];
GLShader *shader = [[GLShader alloc] initWithContext:_context withVert:fullViewportVert withFrag:frag];
_shaders[id] = shader;
}
@end
#import <GLKit/GLKit.h>
#import "RCTBridge.h"
#import "ImageData.h"
@interface GLTexture: NSObject
@property EAGLContext *context;
- (instancetype)init;
- (int)bind: (int)unit;
- (void)setPixels: (ImageData *)data;
- (void)setPixelsEmpty;
- (void)setPixelsRandom: (int)width withHeight:(int)height;
- (void)setPixelsWithImage: (UIImage *)image;
- (void)setPixelsWithView: (UIView *)view;
@end
#import "GLTexture.h"
#import "GLUtils.h"
#import "RCTLog.h"
@implementation GLTexture
{
GLuint handle; // The identifier of the gl texture
ImageData* dataCurrentlyUploaded; // The last set data (cache)
}
- (instancetype)init
{
self = [super init];
if (self) {
[self makeTexture];
}
return self;
}
- (void)dealloc
{
glDeleteTextures(1, &handle);
dataCurrentlyUploaded = nil;
}
- (void) makeTexture
{
glGenTextures(1, &handle);
glBindTexture(GL_TEXTURE_2D, handle);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
- (bool) ensureContext
{
if (![EAGLContext setCurrentContext:_context]) {
RCTLogError(@"Failed to set current OpenGL context");
return false;
}
return true;
}
- (int)bind: (int)unit
{
glActiveTexture(GL_TEXTURE0 + unit);
glBindTexture(GL_TEXTURE_2D, handle);
return unit;
}
- (void)setPixels: (ImageData *)data
{
if (data != dataCurrentlyUploaded) {
dataCurrentlyUploaded = data;
glBindTexture(GL_TEXTURE_2D, handle);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, data.width, data.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data.data);
}
}
- (void)setPixelsEmpty
{
ImageData* data = genPixelsEmpty(2, 2);
[self setPixels:data];
}
- (void)setPixelsRandom: (int)width withHeight:(int)height // for testing
{
ImageData* data = genPixelsRandom(width, height);
[self setPixels:data];
}
- (void)setPixelsWithImage: (UIImage *)image
{
ImageData *data = genPixelsWithImage(image);
if (!data) return;
[self setPixels:data];
}
- (void)setPixelsWithView: (UIView *)view
{
ImageData *data = genPixelsWithView(view);
[self setPixels:data];
}
@end
#import <GLKit/GLKit.h>
#import "ImageData.h"
GLuint compileShader (NSString* shaderString, GLenum shaderType);
ImageData* genPixelsEmpty (int width, int height);
ImageData* genPixelsRandom (int width, int height);
ImageData* genPixelsWithImage (UIImage *image);
ImageData* genPixelsWithView (UIView *view);
\ No newline at end of file
#import "GLUtils.h"
#import "RCTLog.h"
GLuint compileShader (NSString* shaderString, GLenum shaderType) {
GLuint shaderHandle = glCreateShader(shaderType);
const char * shaderStringUTF8 = [shaderString UTF8String];
int shaderStringLength = (int) [shaderString length];
glShaderSource(shaderHandle, 1, &shaderStringUTF8, &shaderStringLength);
glCompileShader(shaderHandle);
GLint compileSuccess;
glGetShaderiv(shaderHandle, GL_COMPILE_STATUS, &compileSuccess);
if (compileSuccess == GL_FALSE) {
GLchar messages[256];
glGetShaderInfoLog(shaderHandle, sizeof(messages), 0, &messages[0]);
NSString *messageString = [NSString stringWithUTF8String:messages];
RCTLogError(@"GL: Shader Failed to compile: %@", messageString);
return -1;
}
return shaderHandle;
}
ImageData* genPixelsEmpty (int width, int height)
{
GLubyte* data = (GLubyte *) malloc(width*height*4*sizeof(GLubyte));
for (int i = 0; i < width * height * 4; i+=4) {
data[i] = data[i+1] = data[i+2] = 0;
data[i+3] = 0;
}
return [[ImageData alloc] initWithData:data withWidth:width withHeight:height];
}
ImageData* genPixelsRandom (int width, int height)
{
GLubyte* data = (GLubyte *) malloc(width*height*4*sizeof(GLubyte));
for (int i = 0; i < width * height * 4; i+=4) {
data[i] = rand() % 255;
data[i+1] = rand() % 255;
data[i+2] = rand() % 255;
data[i+3] = 255;
}
return [[ImageData alloc] initWithData:data withWidth:width withHeight:height];
}
ImageData* genPixelsWithImage (UIImage *image)
{
int width = image.size.width;
int height = image.size.height;
if (width == 0 || height == 0) {
RCTLogError(@"The image must be loaded in setPixelsWithImage call");
return nil;
}
GLubyte* data = malloc(width * height * 4);
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef ctx = CGBitmapContextCreate(data, width, height, 8, width * 4, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
if (ctx == NULL) {
RCTLogError(@"unable to create the bitmap context");
CGColorSpaceRelease(colorSpace);
free(data);
return nil;
}
CGAffineTransform flipVertical = CGAffineTransformMake(1, 0, 0, -1, 0, height);
CGContextConcatCTM(ctx, flipVertical);
CGRect rect = CGRectMake(0.0, 0.0, width, height);
CGContextClearRect(ctx, rect);
CGContextDrawImage(ctx, rect, image.CGImage);
CGColorSpaceRelease(colorSpace);
CGContextRelease(ctx);
return [[ImageData alloc] initWithData:data withWidth:width withHeight:height];
}
ImageData* genPixelsWithView (UIView *view)
{
int width = view.bounds.size.width;
int height = view.bounds.size.height;
GLubyte *data = (GLubyte *)malloc(4 * width * height);
CGColorSpaceRef colourSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef ctx = CGBitmapContextCreate(data, width, height, 8, 4 * width, colourSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
CGColorSpaceRelease(colourSpace);
CGContextClearRect(ctx, view.bounds);
[view.layer renderInContext:ctx];
CGContextRelease(ctx);
return [[ImageData alloc] initWithData:data withWidth:width withHeight:height];
}
\ No newline at end of file
#import <GLKit/GLKit.h>
@interface GLView : GLKView
@property (nonatomic) NSNumber *shader;
@property (nonatomic) NSDictionary *uniforms;
@property (nonatomic) NSArray *targetUniforms;
@property (nonatomic) BOOL opaque;
- (instancetype)initWithBridge:(RCTBridge *)bridge;
@end
#import "RCTBridge.h"
#import "RCTUtils.h"
#import "RCTConvert.h"
#import "RCTLog.h"
#import "GLView.h"
#import "GLUtils.h"
#import "GLShader.h"
#import "GLShadersRegistry.h"
#import "GLTexture.h"
#import "GLReactImage.h"
@implementation GLView
{
RCTBridge *_bridge; // bridge is required to instanciate GLReactImage
GLShader *glShader; // The current GLShader used by the view
NSDictionary *_uniforms; // The current uniforms bound to the shader (name -> value)
NSArray *_targetUniforms; // When using GL.Target, this defines the uniform names to render into
NSDictionary *_textures; // This allocate the sampler2D uniforms of the shaders (name -> glTexture)
NSDictionary *_textureUnits; // This stores the image unit for a given sampler2D uniform (name -> int)
NSDictionary *_images; // This caches the currently used images (imageSrc -> GLReactImage)
BOOL _opaque; // opaque prop (if false, the GLView will become transparent)
BOOL _deferredRendering; // This flag indicates a render has been deferred to the next frame (when using GL.Target)
}
- (instancetype)initWithBridge:(RCTBridge *)bridge
{
if ((self = [super init])) {
_bridge = bridge;
_images = @{};
}
return self;
}
RCT_NOT_IMPLEMENTED(-init)
- (void)setShader:(NSNumber *)ctxid
{
glShader = [GLShadersRegistry getShader:ctxid];
if (!glShader) {
return; // the shader might not have been uploaded yet from the JS (invalid ctxid are checked on JS side to avoid concurrency issues)
}
[glShader bind];
// Cache the textures
NSMutableDictionary *textures = @{}.mutableCopy;
NSMutableDictionary *textureUnits = @{}.mutableCopy;
int unit = 0;
NSDictionary *uniformTypes = [glShader uniformTypes];
for (NSString *uniformName in [uniformTypes allKeys]) {
GLenum type = [uniformTypes[uniformName] intValue];
if (type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE) {
textures[uniformName] = [[GLTexture alloc] init];
textureUnits[uniformName] = [NSNumber numberWithInt: unit ++];
}
}
int maxTextureUnits;
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
if (unit > maxTextureUnits) {
RCTLogError(@"Maximum number of texture reach. got %i >= max %i", unit, maxTextureUnits);
}
_textures = textures;
_textureUnits = textureUnits;
// use the shader's context (currently it is the same for all shaders)
[self setContext:glShader.context];
[self setNeedsDisplay];
}
NSString* srcResource (id res)
{
BOOL isStatic = [RCTConvert BOOL:res[@"isStatic"]];
NSString *src = [RCTConvert NSString:res[@"path"]];
if (!src || isStatic) src = [RCTConvert NSString:res[@"uri"]];
return src;
}
- (void)setUniforms:(NSDictionary *)uniforms
{
/// Diff logic on texture uniforms to manage the _images cache.
NSMutableSet *currentResources = [[NSMutableSet alloc] init];
NSMutableDictionary *images = _images.mutableCopy;
for (NSString *name in [_uniforms allKeys]) {
id uniformValue = _uniforms[name];
GLTexture *texture = _textures[name];
if (texture) {
// Texture uniform
NSString *src = srcResource(uniformValue);
if (!src) {
RCTLogError(@"resource is not valid.");
return;
}
GLReactImage *image = _images[src];
if (!image) {
image = [[GLReactImage alloc] initWithBridge:_bridge withOnLoad:^{
[self setNeedsDisplay];
}];
images[src] = image;
}
image.src = src;
[currentResources addObject:src];
}
}
// remove old resources (that are not anymore used in new uniforms)
NSMutableSet *toDelete = [NSMutableSet setWithArray:[images allKeys]];
[toDelete minusSet:currentResources];
for (NSString *src in toDelete) {
GLReactImage *image = images[src];
image.src = nil;
}
[images removeObjectsForKeys:[toDelete allObjects]];
// Finally set the new state and request a rendering.
_images = images;
_uniforms = uniforms;
[self setNeedsDisplay];
}
- (void)setTargetUniforms:(NSArray *)targetUniforms
{
_targetUniforms = targetUniforms;
[self setNeedsDisplay];
}
- (void)setOpaque:(BOOL)opaque
{
_opaque = opaque;
[self setNeedsDisplay];
}
- (void)drawRect:(CGRect)rect
{
BOOL needsDeferredRendering = _targetUniforms != nil;
if (needsDeferredRendering && !_deferredRendering) {
dispatch_async(dispatch_get_main_queue(), ^{
_deferredRendering = true;
[self setNeedsDisplay];
});
}
else {
[self render:rect];
_deferredRendering = false;
}
}
- (void)render:(CGRect)rect
{
if (!glShader) {
return;
}
self.layer.opaque = _opaque;
[glShader bind];
// Setting uniforms
for (NSString *name in [_uniforms allKeys]) {
id uniformValue = _uniforms[name];
GLTexture *texture = _textures[name];
if (texture) {
// Texture uniform
int unit = [_textureUnits[name] intValue];
GLReactImage *image = _images[srcResource(uniformValue)];
NSNumber *value = [NSNumber numberWithInt: [texture bind:unit]];
if (image.image) {
[texture setPixels:[image getImageData]];
} else {
[texture setPixelsEmpty];
}
[glShader setUniform:name withValue:value];
} else {
// Simple uniform
[glShader setUniform:name withValue:uniformValue];
}
}
// Handling <GL.Target /> children rasterisation
if (_targetUniforms) {
int i = 0;
for (NSString *uniformName in _targetUniforms) {
GLTexture *texture = _textures[uniformName];
if (!texture) {
RCTLogError(@"There is no sampler uniform called '%@' in your shader", uniformName);
return;
}
UIView* view = self.superview.subviews[i]; // We take siblings by index (closely related to the JS code)
int unit = [_textureUnits[uniformName] intValue];
NSNumber *value = [NSNumber numberWithInt: [texture bind:unit]];
if (view) {
[texture setPixelsWithView:view];
} else {
[texture setPixelsEmpty];
}
[glShader setUniform:uniformName withValue:value];
i ++;
}
}
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0.0, 0.0, 0.0, 0.0);
CGFloat scale = RCTScreenScale();
glViewport(0, 0, scale * self.frame.size.width, scale * self.frame.size.height);
glScissor(scale * rect.origin.x, scale * rect.origin.y, scale * rect.size.width, scale * rect.size.height);
glDrawArrays(GL_TRIANGLES, 0, 6);
}
@end
\ No newline at end of file
#import "RCTViewManager.h"
@interface GLViewManager : RCTViewManager
@end
#import "GLViewManager.h"
#import "GLView.h"
#import "RCTLog.h"
#import <UIKit/UIKit.h>
@implementation GLViewManager
RCT_EXPORT_MODULE();
- (instancetype)init
{
self = [super init];
if (self) {
}
return self;
}
RCT_EXPORT_VIEW_PROPERTY(uniforms, NSDictionary);
RCT_EXPORT_VIEW_PROPERTY(shader, NSNumber);
RCT_EXPORT_VIEW_PROPERTY(targetUniforms, NSArray);
RCT_EXPORT_VIEW_PROPERTY(opaque, BOOL);
- (UIView *)view
{
GLView * v;
v = [[GLView alloc] initWithBridge:self.bridge];
return v;
}
@end
\ No newline at end of file
#import <GLKit/GLKit.h>
@interface ImageData: NSObject
@property (nonatomic) GLubyte *data;
@property (nonatomic) int width;
@property (nonatomic) int height;
- (instancetype)initWithData: (GLubyte *)data withWidth:(int)width withHeight:(int)height;
@end
#import "ImageData.h"
// This structure aims to be used in an immutable way
@implementation ImageData
{
GLubyte *_data;
int _width;
int _height;
}
- (instancetype)initWithData: (GLubyte *)data withWidth:(int)width withHeight:(int)height
{
self = [super init];
if (self) {
_data = data;
_width = width;
_height = height;
}
return self;
}
- (void)dealloc
{
if (_data) {
free(_data);
_data = nil;
_width = 0;
_height = 0;
}
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.projectseptember.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
const invariant = require("invariant");
const React = require("react-native");
const {
NativeModules: { GLShadersRegistry },
requireNativeComponent,
Component,
PropTypes,
View,
} = React;
let _uid = 1;
const Shaders = {
create: function (obj) {
invariant(typeof obj === "object", "config must be an object");
const result = {};
for (let key in obj) {
// TODO : validate first
const id = _uid ++;
GLShadersRegistry.register(id, obj[key]);
result[key] = id;
}
return result;
},
exists: function (id) {
return typeof id === "number" && id >= 1 && id < _uid;
}
};
class Target extends Component {
render () {
invariant(
false,
"GL.Target elements are for GL.View configuration only and should not be rendered"
);
}
}
Target.displayName = "GL.Target";
Target.propTypes = {
children: PropTypes.any.isRequired,
uniform: PropTypes.string.isRequired
};
const GLViewNative = requireNativeComponent("GLView", GLView);
class GLView extends Component {
setNativeProps (props) {
this.refs.native.setNativeProps(props);
}
render() {
const props = this.props;
const { style, width, height, children, shader } = props;
invariant(Shaders.exists(shader), "Shader #%s does not exists", shader);
const nativeStyle = {
width: width,
height: height,
...style
};
if (children) {
const parentStyle = {
position: "relative",
width: nativeStyle.width,
height: nativeStyle.height,
overflow: "hidden"
};
const childrenStyle = {
position: "absolute",
top: 0,
left: 0,
width: nativeStyle.width,
height: nativeStyle.height
};
const targetUniforms = [];
const targets = React.Children.map(children, child => {
invariant(child.type === Target, "GL.View can only contains children of type GL.Target. Got '%s'", child.type && child.type.displayName || child);
const uniform = child.props.uniform;
targetUniforms.push(uniform);
return <View style={[ childrenStyle, child.props.style ]}>{child.props.children}</View>;
});
return <View style={parentStyle}>
{targets}
<GLViewNative ref="native" {...props} style={nativeStyle} children={undefined} targetUniforms={targetUniforms} />
</View>;
}
else {
return <GLViewNative ref="native" {...props} style={nativeStyle} />;
}
}
}
GLView.displayName = "GL.View";
GLView.propTypes = {
shader: PropTypes.number.isRequired,
width: PropTypes.number,
height: PropTypes.number,
uniforms: PropTypes.object,
childrenUniform: PropTypes.string,
opaque: PropTypes.bool
};
GLView.defaultProps = {
opaque: true
};
module.exports = {
View: GLView,
Target,
Shaders
};
{
"name": "gl-react-native",
"version": "0.0.1",
"description": "OpenGL bindings for react-native for complex effects on images and components",
"main": "index.js",
"repository": {
"type": "git",
"url": "github.com:ProjectSeptemberInc/gl-react-native.git"
},
"keywords": [
"gl",
"react-native"
],
"author": "Project September <tech@projectseptember.com>",
"license": "MIT",
"devDependencies": {
"react-native": "^0.9.0"
},
"peerDependencies": {
"react-native": "^0.9.0"
},
"dependencies": {
"invariant": "^2.1.0"
}
}
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