This file contains hidden or 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 { 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); |
This file contains hidden or 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 { AppRegistry, View, Text, Button } from "react-native"; | |
import { StackNavigator } from "react-navigation"; | |
const LoginScreen = props => ( | |
<View> | |
<Button | |
title="Log In" | |
onPress={() => { |
This file contains hidden or 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, | |
Text, | |
TouchableOpacity | |
} from 'react-native'; | |
class MyComponent extends Component { | |
componentWillMount() { |
This file contains hidden or 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 "MediaController.h" | |
#import "AppDelegate.h" | |
@implementation MediaController | |
RCT_EXPORT_MODULE(); | |
@synthesize bridge = _bridge; |
This file contains hidden or 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
'use strict'; | |
var React = require('react-native'); | |
var MediaController = require('NativeModules').MediaController; | |
var { | |
AppRegistry, | |
StyleSheet, | |
Text, | |
TouchableHighlight, |
This file contains hidden or 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
-(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]]; | |
//... | |
} |
This file contains hidden or 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
-(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"; | |
} | |
This file contains hidden or 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 <Foundation/Foundation.h> | |
#import "RCTBridge.h" | |
#import "RCTEventDispatcher.h" | |
#import <MediaPlayer/MediaPlayer.h> | |
@import AVFoundation; | |
@interface MediaController : NSObject<RCTBridgeModule,MPMediaPickerControllerDelegate, AVAudioPlayerDelegate> |
This file contains hidden or 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
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation | |
moduleName:@"MCDJ" | |
initialProperties:nil | |
launchOptions:launchOptions]; | |
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; | |
UIViewController *rootViewController = [[UIViewController alloc] init]; | |
rootViewController.view = rootView; | |
This file contains hidden or 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 <UIKit/UIKit.h> | |
@interface AppDelegate : UIResponder <UIApplicationDelegate> | |
@property (nonatomic, strong) UIWindow *window; | |
@property (nonatomic, strong) UIViewController *rootViewController; | |
@end |
NewerOlder