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
// @flow | |
import React, { Component } from 'react'; | |
import { | |
View, | |
Text, | |
StyleSheet, | |
Dimensions, | |
TouchableOpacity, | |
Image, | |
StatusBar, |
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
// @flow | |
import React, { Component } from 'react'; | |
import { View } from 'react-native'; | |
import PubNubReact from 'pubnub-react'; | |
import { connect } from 'react-redux'; | |
import addContacts from '../actions/Contacts/AddContacts'; | |
import sendRemoteMessage from '../actions/Messaging/AddRemoteMessages'; | |
import { Contact } from '../reducers/Contacts/Contacts'; | |
import { Messaging } from '../reducers/Messaging/Messaging'; | |
import idx from 'idx'; |
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
// working with pipes and type | |
type Fruit = "orange" | "banana" | "strawberry"; | |
// working with types and functions | |
type EatFruitFunction = (fruit: Fruit) => void; | |
// typing objects using type | |
type User = { | |
username: string, | |
email: string, |
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
interface User { | |
username: string; | |
email: string; | |
password: string; | |
} | |
// So here we cant user the & operator after extends to compose types | |
// So if you want to extend more than one interface or type you need to use type | |
interface Compose extends User { |
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
// Function that executes a action and dont receive any params and returns void | |
type ChangesSomething = () => void | |
// Function that receives a string and returns a string | |
type FormatName = (name: string) => string | |
// Function that checks if a string is null and returns a boolean | |
type CheckNull = (value: string) => boolean | |
// Function that sums two numbers and returns a number |
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
// Generics type & interface | |
type HasGeneric<T> = { | |
genericType: T, | |
nonGenericType: string, | |
arrayGeneric: Array<T>, | |
} | |
interface GenericsInterface<T> { | |
genericType: T; |
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 * as React from 'react' | |
import { Animated, Easing, StatusBar, MaskedViewIOS, View, ViewStyle } from 'react-native' | |
import icons from '../../icons' | |
import lightTheme from '../../config/theme' | |
interface Props { | |
bootstraped: boolean | |
} | |
const AnimatedGate: React.FunctionComponent<Props> = (props) => { |
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
export const iceServers = [ | |
{ url: 'stun:stun.l.google.com:19302' }, | |
{ url: 'stun:stun01.sipphone.com' }, | |
{ url: 'stun:stun.ekiga.net' }, | |
{ url: 'stun:stun.fwdnet.net' }, | |
{ url: 'stun:stun.ideasip.com' }, | |
{ url: 'stun:stun.iptel.org' }, | |
{ url: 'stun:stun.rixtelecom.se' }, | |
{ url: 'stun:stun.schlund.de' }, | |
{ url: 'stun:stun.l.google.com:19302' }, |
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
MediaStreamTrack.getSources((sourceInfos)) => { | |
console.log('MediaStreamTrack.getSources', sourceInfos) | |
let videoSourceId | |
for (let i = 0; i < sourceInfos.length; i++) { | |
const sourceInfo = sourceInfos[i] | |
if (sourceInfo.kind === 'video' && sourceInfo.facing === 'front') { | |
videoSourceId = sourceInfo.id | |
} | |
} | |
getUserMedia( |
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
class DisplayStream extends React.Component { | |
state = { | |
localstream: null, | |
} | |
componentDidMount() { | |
export const iceServers = [ | |
{ url: 'stun:stun.l.google.com:19302' }, | |
{ url: 'stun:stun01.sipphone.com' }, | |
{ url: 'stun:stun.ekiga.net' }, |
OlderNewer