Skip to content

Instantly share code, notes, and snippets.

Stan Bershadskiy stan229

Block or report user

Report or block stan229

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
stan229 / index.js
Created Mar 14, 2017
React Navigation and Redux example
View index.js
import React, { Component } from "react";
import { Text } from "react-native";
import { Provider, connect } from "react-redux";
import { StackNavigator, addNavigationHelpers } from "react-navigation";
import Routes from "./config/routes";
import getStore from "./store";
const AppNavigator = StackNavigator(Routes);
stan229 / index.js
Created Mar 14, 2017
React Navigation sample
View index.js
import React, { Component } from "react";
import { AppRegistry, View, Text, Button } from "react-native";
import { StackNavigator } from "react-navigation";
const LoginScreen = props => (
title="Log In"
onPress={() => {
View MyComponent.js
import React, { Component } from 'react';
import {
} from 'react-native';
class MyComponent extends Component {
componentWillMount() {
stan229 / MediaController.m
Created Oct 15, 2015
Full Implementation
View MediaController.m
#import "MediaController.h"
#import "AppDelegate.h"
@implementation MediaController
@synthesize bridge = _bridge;
View index.ios.js
'use strict';
var React = require('react-native');
var MediaController = require('NativeModules').MediaController;
var {
stan229 / MediaController.m
Created Oct 15, 2015
Communicating with React Native app
View MediaController.m
-(void) mediaPicker:(MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection {
MPMediaItem *mediaItem = mediaItemCollection.items[0];
NSURL *assetURL = [mediaItem valueForProperty:MPMediaItemPropertyAssetURL];
[self.bridge.eventDispatcher sendAppEventWithName:@"SongPlaying" body:[mediaItem valueForProperty:MPMediaItemPropertyTitle]];
stan229 / MediaController.m
Created Oct 15, 2015
Showing and Hiding MPMediaPlayerController instance
View MediaController.m
-(void)showMediaPicker {
if(self.mediaPicker == nil) {
self.mediaPicker = [[MPMediaPickerController alloc] initWithMediaTypes:MPMediaTypeAnyAudio];
[self.mediaPicker setDelegate:self];
[self.mediaPicker setAllowsPickingMultipleItems:NO];
[self.mediaPicker setShowsCloudItems:NO];
self.mediaPicker.prompt = @"Select song";
View MediaController.h
#import <Foundation/Foundation.h>
#import "RCTBridge.h"
#import "RCTEventDispatcher.h"
#import <MediaPlayer/MediaPlayer.h>
@import AVFoundation;
@interface MediaController : NSObject<RCTBridgeModule,MPMediaPickerControllerDelegate, AVAudioPlayerDelegate>
View AppDelegate.m
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [[UIViewController alloc] init];
rootViewController.view = rootView;
View AppDelegate.h
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (nonatomic, strong) UIWindow *window;
@property (nonatomic, strong) UIViewController *rootViewController;
You can’t perform that action at this time.