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
<!-- common payload: stats associated with data --> | |
type StatsRange = { | |
max: number, min: number | |
} | |
type StatsKeys = 'count' | 'aum' | 'priceusd' | 'value' | |
type PartialStats< | |
T extends Partial<{ | |
[key in StatsKeys]: any; |
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
<!-- common payload: stats associated with data --> | |
type StatsRange = { | |
max: number, min: number | |
} | |
type StatsKeys = 'count' | 'aum' | 'priceusd' | 'value' | |
interface PartialStats<Type extends string|number|symbol, RangeType> { | |
stats?: Partial<Record<Type, RangeType>> | |
} |
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
<!-- common payload: stats associated with data --> | |
type StatsRange = { | |
max: number, min: number | |
} | |
type StatsKeys = 'count' | 'aum' | 'priceusd' | 'value' | |
type PartialStats = { | |
stats?: { | |
[key in StatsKeys]?: StatsRange |
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
// before inline default | |
import { BeforeFunction } from 'before-module'; | |
const BeforeComponent = (props) => { | |
const view = BeforeFunction(); | |
return <View>{view}</View>; | |
}; | |
// after inline default |
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 LazyLoadParent extends Component { | |
const container = React.createRef(null); | |
return ( | |
<> | |
<ScrollView | |
showsVerticalScrollIndicator={false} | |
scrollEventThrottle={10} | |
onScroll={(event) => { | |
container.current.onScroll(); | |
}} |
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
// lazy loading for three images | |
const ImageLazyLoad = React.forwardRef((props, ref) => { | |
const marker1 = React.useRef(null); | |
const marker2 = React.useRef(null); | |
const marker3 = React.useRef(null); | |
const [markerVisible, setmarkerVisible] = useState(0); | |
// marker Visible set with value -> 1,2,3 | |
React.useImperativeHandle(ref, () => ({ | |
onScroll: () => { |
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
// Push Notifications constants | |
let baseNotification = new firebase.notifications.Notification({ | |
sound: 'default', | |
show_in_foreground: true, | |
}) | |
.setSound("default") | |
.android.setChannelId('channelId') // id you have set in HandleNotifications.js | |
.android.setColor('#ffffff') // you can set a color here | |
.android.setPriority(firebase.notifications.Android.Priority.High) | |
.android.setSmallIcon('ic_launcher') |
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 firebase from 'react-native-firebase'; | |
import type { NotificationOpen } from 'react-native-firebase'; | |
export default async (notificationOpen: NotificationOpen) => { | |
if (notificationOpen.action === 'snooze') { | |
// handle notification. | |
} | |
return Promise.resolve(); | |
} |
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 firebase from 'react-native-firebase'; | |
class HandleNotifications extends Component { | |
constructor(props) { | |
super(props); | |
this.getToken = this.getToken.bind(this); | |
this.requestPermission = this.requestPermission.bind(this); | |
this.checkNotificationPermission = this.checkNotificationPermission.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 { AppRegistry, View, StyleSheet, AppState } from 'react-native'; | |
import App from './App'; | |
import React from 'react'; | |
import { Provider } from 'react-redux'; | |
import configureStore from './configureStore'; | |
import HandleNotifications from "./src/components/HandleNotifications/HandleNotifications"; | |
const store = configureStore(); |
NewerOlder