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
process.stdin.resume(); | |
process.stdin.setEncoding("utf-8"); | |
let stdin_input = ""; | |
process.stdin.on("data", function (input) { | |
stdin_input += input; // Reading input from STDIN | |
}); | |
process.stdin.on("end", function () { | |
main(stdin_input); // Calling function with input |
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 from 'react'; | |
import { View, Text, Image, ActivityIndicator, StyleSheet, FlatList } from "react-native"; | |
const initialState = { pictures: [] } | |
class PictureList extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = initialState; | |
} | |
async fetchPictures() { |
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 from 'react'; | |
import { View, Text, Image, ActivityIndicator, StyleSheet, ScrollView } from "react-native"; | |
const initialState = { pictures: [ | |
{id:0, download_url:"https://picsum.photos/id/0/5616/3744" }, | |
{id:1, download_url: "https://picsum.photos/id/1002/4312/2868"}, | |
{id:2, download_url: "https://picsum.photos/id/1006/3000/2000"}, | |
{id:3, download_url: "https://picsum.photos/id/1015/6000/4000"} | |
] }; | |
class PictureList extends React.Component { |
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 from 'react'; | |
import { View, StyleSheet, Text, TouchableOpacity, TextInput, Alert } from "react-native"; | |
const initialState = { username: '', password: '' }; | |
class LoginForm extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = initialState; | |
this.handleSubmitForm = this.handleSubmitForm.bind(this); | |
this.handleUsernameChange = this.handleUsernameChange.bind(this); | |
this.handlePasswordChange = this.handlePasswordChange.bind(this); |
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 from 'react'; | |
import { View, Text, TextInput, StyleSheet } from "react-native"; | |
class SimpleTextInput extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { text: '', isSubmitted: false }; | |
} | |
handleChangeText = (text) => { | |
this.setState({ text, isSubmitted: false }); |
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 based component */ | |
import React, { Component } from 'react'; | |
import { Text } from 'react-native'; | |
export default class Greeting extends Component { | |
render() { | |
return ( | |
<Text>Hello {this.props.name} !</Text> | |
); | |
} |
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 from 'react'; | |
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native'; | |
class Counter extends React.Component { | |
state = { count: 0 }; | |
increment = () => this.setState({count: this.state.count + 1}); | |
decrement = () => this.setState({count: this.state.count - 1}); | |
render() { | |
return ( | |
<View style={styles.container}> |
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 from 'react'; | |
import { StyleSheet, Text, View, Image } from 'react-native'; | |
import Counter from './components/Counter'; | |
import Greeting from "./components/Greeting2"; | |
import SimpleTextInput from './components/SimpleTextInput'; | |
import SimpleButton from './components/SimpleButton'; | |
import LoginForm from './components/LoginForm'; | |
import PictureList from './components/PictureList'; | |
export default class App extends React.Component { |
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 shaka from 'shaka-player'; | |
import createSinglePlayer from 'react-player/lib/singlePlayer' | |
const IOS = typeof navigator !== 'undefined' && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream | |
const AUDIO_EXTENSIONS = /\.(m4a|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i | |
const DASH_EXTENSIONS = /\.(mpd)($|\?)/i | |
function canPlay (url) { |
NewerOlder