Skip to content

Instantly share code, notes, and snippets.

@chummypixels
chummypixels / import.js
Created November 27, 2019 09:27
Importing SectionLists in React Native
import React from 'react';
import {StyleSheet, View, Text, SectionList} from 'react-native';
@chummypixels
chummypixels / sectionlist.js
Created November 27, 2019 09:58
Returning a SectionList component
import React from 'react';
import {StyleSheet, View, Text, SectionList} from 'react-native';
export default class SectionListBasics extends React.Component {
render() {
return (
<View style={styles.container}>
<SectionList
/>
@chummypixels
chummypixels / sections.js
Created November 27, 2019 10:00
Creating sections prop for SectionList in React Native
import React from 'react';
import {StyleSheet, ScrollView, View, Text, SectionList} from 'react-native';
export default class SectionListBasics extends React.Component {
render() {
return (
<View style={styles.container}>
<SectionList
sections={[
@chummypixels
chummypixels / sectionsData.js
Created November 27, 2019 10:05
Adding Data to the sections props of SectionList React Native
import React from 'react';
import {StyleSheet, ScrollView, View, Text, SectionList} from 'react-native';
export default class SectionListBasics extends React.Component {
render() {
return (
<View style={styles.container}>
<SectionList
sections={[
{
@chummypixels
chummypixels / renderItem.js
Created November 27, 2019 10:44
renderItem prop required by SectionList component
renderItem={({item}) => <Text style={styles.item}>{item}</Text>}
@chummypixels
chummypixels / renderSectionHeader.js
Last active August 23, 2023 08:50
renderSectionHeader in React Native
import React from 'react';
import {StyleSheet, ScrollView, View, Text, SectionList} from 'react-native';
export default class SectionListBasics extends React.Component {
render() {
return (
<View style={styles.container}>
<SectionList
sections={[
{
@chummypixels
chummypixels / styles.js
Created November 27, 2019 11:13
Styling of the SectionList component example
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: 22,
},
sectionHeader: {
paddingTop: 2,
paddingBottom: 2,
paddingLeft: 10,
paddingRight: 10,
@chummypixels
chummypixels / source.js
Created November 27, 2019 11:37
Complete source code for the demonstration of SectionList use i React Native
import React from 'react';
import {StyleSheet, ScrollView, View, Text, SectionList} from 'react-native';
export default class SectionListBasics extends React.Component {
render() {
return (
<View style={styles.container}>
<SectionList
sections={[
{
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(const MyApp());
}
import 'package:firebase_auth/firebase_auth.dart' as auth;
import '../model/user_model.dart';
class Auth {
//1
final auth.FirebaseAuth _firebaseAuth = auth.FirebaseAuth.instance;
//2
User? _firebaseUser(auth.User? user) {