Skip to content

Instantly share code, notes, and snippets.

View igalata's full-sized avatar
🎯
Focusing

Irina Galata igalata

🎯
Focusing
View GitHub Profile
class CameraModule(context: ReactApplicationContext?) : ReactContextBaseJavaModule(context) {
override fun getName() = "CameraModule"
@ReactMethod
fun openCamera() = reactApplicationContext
.startActivity(Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE))
}
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() {
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()
class MainApplication : Application(), ReactApplication {
private val mReactNativeHost = object : ReactNativeHost(this) {
override fun getUseDeveloperSupport() = BuildConfig.DEBUG
override fun getPackages() = listOf(
MainReactPackage(),
CameraReactPackage()
)
}
export default class TestProject extends Component {
render() {
return (
<Container>
<Header
style={{}}
backgroundColor='#2c3e50'
iosBarStyle='light-content'
androidStatusBarColor='#1b2732'>
<Left>
class CameraModule(context: ReactApplicationContext?) : ReactContextBaseJavaModule(context),
ActivityEventListener {
companion object {
private const val CAMERA_REQUEST_CODE = 1
}
init {
reactApplicationContext.addActivityEventListener(this)
}
function openCamera() {
camera.openCamera((uri) => {
console.log(uri);
},
(error) => {
console.log(error);
}
);
}
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;
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 () {
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;