This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CameraModule(context: ReactApplicationContext?) : ReactContextBaseJavaModule(context) { | |
override fun getName() = "CameraModule" | |
@ReactMethod | |
fun openCamera() = reactApplicationContext | |
.startActivity(Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainApplication extends Application implements ReactApplication { | |
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { | |
@Override | |
public boolean getUseDeveloperSupport() { | |
return BuildConfig.DEBUG; | |
} | |
@Override | |
protected List<ReactPackage> getPackages() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CameraReactPackage : ReactPackage { | |
override fun createJSModules(): MutableList<Class<out JavaScriptModule>> = Collections.emptyList() | |
override fun createNativeModules(reactContext: ReactApplicationContext?): MutableList<NativeModule> | |
= mutableListOf(CameraModule(reactContext)) | |
override fun createViewManagers(reactContext: ReactApplicationContext?): | |
MutableList<ViewManager<View, ReactShadowNode>> = Collections.emptyList() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainApplication : Application(), ReactApplication { | |
private val mReactNativeHost = object : ReactNativeHost(this) { | |
override fun getUseDeveloperSupport() = BuildConfig.DEBUG | |
override fun getPackages() = listOf( | |
MainReactPackage(), | |
CameraReactPackage() | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class TestProject extends Component { | |
render() { | |
return ( | |
<Container> | |
<Header | |
style={{}} | |
backgroundColor='#2c3e50' | |
iosBarStyle='light-content' | |
androidStatusBarColor='#1b2732'> | |
<Left> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CameraModule(context: ReactApplicationContext?) : ReactContextBaseJavaModule(context), | |
ActivityEventListener { | |
companion object { | |
private const val CAMERA_REQUEST_CODE = 1 | |
} | |
init { | |
reactApplicationContext.addActivityEventListener(this) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function openCamera() { | |
camera.openCamera((uri) => { | |
console.log(uri); | |
}, | |
(error) => { | |
console.log(error); | |
} | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = ` | |
precision highp float; | |
varying vec2 uv; | |
float area(float x1, float y1, float x2, float y2, float x3, float y3) { | |
return abs(0.5 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2))); | |
} | |
bool equal(float a, float b) { | |
return abs(a - b) < 0.00001; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from "react"; | |
import {View, AppRegistry} from "react-native"; | |
import {Surface} from "gl-react-native"; | |
import GL from "gl-react"; | |
const Dimensions = require('Dimensions'); | |
const window = Dimensions.get('window'); | |
import Triangle from './triangle'; | |
export default class GLExample extends Component { | |
render () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Box2D = require('box2dweb'); | |
const b2World = Box2D.Dynamics.b2World; | |
const b2Vec2 = Box2D.Common.Math.b2Vec2; | |
const b2BodyDef = Box2D.Dynamics.b2BodyDef; | |
const b2Body = Box2D.Dynamics.b2Body; | |
const b2FixtureDef = Box2D.Dynamics.b2FixtureDef; | |
const b2CircleShape = Box2D.Collision.Shapes.b2CircleShape; | |
var body; |
OlderNewer