Skip to content

Instantly share code, notes, and snippets.

View betomoedano's full-sized avatar
💭
keep moving, don't settle. 🚀.

Beto betomoedano

💭
keep moving, don't settle. 🚀.
View GitHub Profile
@betomoedano
betomoedano / _layout.tsx
Created September 24, 2024 20:54
Universal modal with Expo Router
export default function RootLayout() {
return (
<Stack>
<Stack.Screen
name="(drawer)"
options={{
headerShown: false,
}}
/>
<Stack.Screen
@betomoedano
betomoedano / App.tsx
Created January 15, 2023 16:00
Example React Native "gap"
import React from 'react';
import type {PropsWithChildren} from 'react';
import {SafeAreaView, Text, ScrollView, StyleSheet, View} from 'react-native';
function Row({children}: PropsWithChildren): JSX.Element {
return (
<View
style={{
flexDirection: 'row',
columnGap: 15,
@betomoedano
betomoedano / HomeScreen.js
Created December 24, 2021 04:54
Search filter bar
import React, {useEffect, useState} from "react";
import { View, Text, StyleSheet, TouchableOpacity, ScrollView, Image } from "react-native";
import { useNavigation } from "@react-navigation/native";
const HomeScreen = () => {
const navigation = useNavigation();
const [data, setData] = useState([]);
const [filteredData, setFilteredData] = useState([]);
@betomoedano
betomoedano / HomeScreen.js
Last active December 24, 2021 04:32
Displaying data on screen
return (
<ScrollView>
<Text style={styles.textFriends}>{data.length} Friends</Text>
{
data.map((item, index) => {
return (
<View key={index} style={styles.itemContainer}>
<Image
source={{ uri: item.picture.large }}
style={styles.image}
@betomoedano
betomoedano / HomeScreen.js
Created December 24, 2021 04:19
Fetching fake data from random user API
import React, { useEffect, useState } from "react";
import { View, Text } from "react-native";
const HomeScreen = () => {
const [data, setData] = useState([]);
useEffect(() => {
fetchData("https://randomuser.me/api/?results=20");
}, []);
@betomoedano
betomoedano / HomeScreen.js
Created December 24, 2021 04:13
Code for Home Screen
import React from "react";
import { View, Text } from "react-native";
const HomeScreen = () => {
return (
<View>
<Text
style={{
fontSize: 30,
textAlign: "center",
@betomoedano
betomoedano / HomeScreen.js
Created December 24, 2021 04:11
Code for HomeScreen
import React from "react";
import { View, Text } from "react-native";
const HomeScreen = () => {
return (
<View>
<Text
style={{
fontSize: 30,
textAlign: "center",
@betomoedano
betomoedano / SettingsScreen.js
Created December 24, 2021 04:01
Code for Settings Screen
import React from "react";
import { View, Text } from "react-native";
const SettingsScreen = () => {
return (
<View>
<Text
style={{
fontSize: 30,
textAlign: "center",
@betomoedano
betomoedano / StackScreen.js
Created December 24, 2021 03:58
Code for StackScreen
import React from "react";
import { View, Text } from "react-native";
const StackScreen = () => {
return (
<View>
<Text
style={{
fontSize: 30,
textAlign: "center",
@betomoedano
betomoedano / Navigation.js
Created December 24, 2021 03:44
Navigation file
import React from "react";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { NavigationContainer } from "@react-navigation/native";
//screens
import HomeScreen from "./screens/HomeScreen";
import SettingsScreen from "./screens/SettingsScreen";
import StackScreen from "./screens/StackScreen";