Skip to content

Instantly share code, notes, and snippets.

@norbajunior
norbajunior / markdown-details-collapsible.md
Created Jun 27, 2020 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.
View markdown-details-collapsible.md

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@norbajunior
norbajunior / unfold.rb
Created Feb 25, 2018 — forked from havenwood/unfold.rb
Imitating Elixir's Stream.unfold/2 in Ruby
View unfold.rb
class Enumerator
def self.unfold tuple
new do |yielder|
loop do
current, tuple = yield tuple
yielder << current
end
end
end
end
View example5.jsx
import { Animated, Easing } from 'react-native'
class Notification extends Component {
constructor(props) {
super(props)
this.state = { offset: new Animated.Value(props.offset) } // now we receive the initial offset calculated
} // coming from the parent component
componentDidMount() {
View NotificationExample.jsx
import { Animated, Easing } from 'react-native'
class Notification extends Component {
constructor(props) {
super(props)
this.state = { offset: new Animated.Value(-100) } // We initially set an Animated.Value with -100
}
componentDidMount() { // When the component is mounted the animation runs.
View example4.jsx
import { Animated, Easing } from 'react-native'
class Notification extends Component {
constructor(props) {
super(props)
this.state = { offset: new Animated.Value(props.offset) } // agora recebemos o offset inicial calculado
} // do componente pai
componentDidMount() {
View Notification3.jsx
class Notification extends Component {
render() {
<View style={{ transform: [{ translateY: -100 }] }>
<Image source={this.props.avatar} />
<Text>Nova Mensagem</Text>
<Text>{this.props.message}</Text>
</View>
}
}
View Notification2.jsx
import { Animated } from 'react-native'
class Notification extends Component {
constructor(props) {
super(props)
this.offset = new Animated.Value(props.offset)
}
componentDidMount() {
View Notification.jsx
import { Animated, Easing } from 'react-native'
class Notification extends Component {
constructor(props) {
super(props)
this.state = { offset: new Animated.Value(-100) } // iniciamos aqui um Animated.Value com valor -100
}
componentDidMount() { // Quando o componete estiver montado executamos a animação.
View App2.jsx
import React, { Component } from 'react'
import { View, Button } from 'react-native'
const newNotifications = [
{
id: 1,
message: "I'm here to bother you. Don't ignore me!",
avatar: require('./images/3cpo.jpg')
},
{
View TopBarNotification2.jsx
class TopBarNotification extends Component {
render() {
return this.props.notifications.map((notification) => {
return <Notification {...notification} />
})
}
}