Skip to content

Instantly share code, notes, and snippets.

View Saad-Bashar's full-sized avatar

Saad Saad-Bashar

View GitHub Profile
@Saad-Bashar
Saad-Bashar / FeedPost.tsx
Created February 23, 2023 09:08
FeedPost
import {useState} from 'react';
import {
View,
Text,
LayoutAnimation,
Image,
Pressable,
Platform,
UIManager,
} from 'react-native';
@Saad-Bashar
Saad-Bashar / Carousel.tsx
Last active February 23, 2023 09:11
Carousel
@Saad-Bashar
Saad-Bashar / download-pdf.js
Created September 25, 2022 06:05
downloading pdf files in react native
const downloadFile = () => {
const source = "https://www.africau.edu/images/default/sample.pdf";
let dirs = ReactNativeBlobUtil.fs.dirs;
ReactNativeBlobUtil.config({
fileCache: true,
appendExt: 'pdf',
path: `${dirs.DocumentDir}/${fileName}`,
addAndroidDownloads: {
useDownloadManager: true,
notification: true,
/*
This is our tab buttons, when the user press on the tab buttons
we first scroll to that index, then we set the tab active
*/
<TouchableOpacity
onPress={() => {
listRef.current.scrollToIndex({
animated: true,
viewOffset: 50 * index,
/*
we change the index when user swipes the carousel
we also make the tab category active if the items category is changed while swiping
*/
const onChangeIndex = (index) => {
setIndex(index);
if(DATA[index].category !== activeTab) {
setActiveTab(DATA[index].category);
}
}
@Saad-Bashar
Saad-Bashar / init.js
Last active March 24, 2021 15:24
tab-carousel-init
//DUMMY DATA
const DATA = [
{
category: "Home & Living",
image: require('./assets/f1.jpg')
},
{
category: "Home & Living",
image: require('./assets/f2.jpg')
},
@Saad-Bashar
Saad-Bashar / demo.js
Created February 5, 2021 04:09
Dynamic height, width and aspect ratio.
import * as React from 'react';
import { Text, View, StyleSheet, FlatList, Dimensions } from 'react-native';
import { Card } from 'react-native-paper';
const { width, height } = Dimensions.get('window');
const Metrics = {
section: 16,
halfSection: 8,
};
public class QTest
{
 public static void main (String[] args)
 {
  int x = 38;
  int y = 10;
  System.out.println(x+y);
 }
}

Login Screen

  • login api (that should return token if succeed)

Sign Up

  • create user (also returns token)

Home screen

  • get all bootcamps (return bootcamps if the user has not made any choice on them)

Details Screen

buttonContainer: {
 flexDirection: 'row',
 justifyContent: 'space-between',
 alignItems: 'center',
 marginBottom: 30,
},
circle: {
 height: 20,
 width: 20,
 borderRadius: 10,