Skip to content

Instantly share code, notes, and snippets.

View Drzaln's full-sized avatar
:octocat:
Building Mobile Apps

Doddy Rizal Novianto Drzaln

:octocat:
Building Mobile Apps
View GitHub Profile
#!/bin/bash
PROJECT_DIR="PROJECT_NAME"
INFOPLIST_FILE="Info.plist"
INFOPLIST_DIR="${PROJECT_DIR}/${INFOPLIST_FILE}"
PACKAGE_VERSION=$(cat ../package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')
# Update plist with new values
@Drzaln
Drzaln / xcode-build-bump.sh
Created October 19, 2024 05:15 — forked from sekati/xcode-build-bump.sh
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@Drzaln
Drzaln / default_metro_terminal.md
Last active July 2, 2024 03:18
React Native, change metro default terminal

Metro will open a new Terminal window everytime you start your RN app. If you are using other terminal app this is however very annoying. You can change the terminal used to run the initial script:

  1. Open finder window and navigate to <your_project/node_modules/react-native/scripts
  2. Locate launchPackager.command, right click the file, select Get info and then change the Open with: value to your terminal, then click on Change All

This post originally from Oscar Franco Blog

@Drzaln
Drzaln / RNAnimatedImagePreview.tsx
Created June 5, 2024 08:32
React Native Image Preview (double tap and pinch to zoom)
// use react-native-reanimated v3 and react-native-gesture-handler v2
import React from 'react';
import {Dimensions, StyleSheet} from 'react-native';
import {
GestureHandlerRootView,
GestureDetector,
Gesture,
} from 'react-native-gesture-handler';
import Animated, {
@Drzaln
Drzaln / BorderAnimatedButton.tsx
Created June 4, 2024 04:30
RN - BorderLine Animated
import React, { useEffect } from "react";
import { View, StyleSheet, Pressable, Text } from "react-native";
import Svg, { Path, Defs, LinearGradient, Stop } from "react-native-svg";
import Animated, {
Easing,
useAnimatedProps,
useAnimatedStyle,
useSharedValue,
withRepeat,
withTiming,
@Drzaln
Drzaln / AnimateBorderView.tsx
Created May 16, 2024 08:49
Animate border view
import React from 'react';
import {View, StyleSheet, Pressable, LayoutChangeEvent} from 'react-native';
import Animated, {
useSharedValue,
useAnimatedStyle,
withRepeat,
withTiming,
Easing,
} from 'react-native-reanimated';
import LinearGradient from 'react-native-linear-gradient';
@Drzaln
Drzaln / PulseBadge.tsx
Created May 16, 2024 08:42
Pulse badge component
import React, {useRef, useEffect} from 'react';
import {View, StyleSheet} from 'react-native';
import Animated, {
useSharedValue,
useAnimatedStyle,
withTiming,
withRepeat,
Easing,
withDelay,
} from 'react-native-reanimated';
@Drzaln
Drzaln / round_corner.md
Created March 2, 2023 02:23
Rounded corner for outer element
@Drzaln
Drzaln / rn_run_iphone.md
Last active January 23, 2023 03:04
Run react native apps directly to iPhone
  1. Enable Developer Mode in Settings -> Privacy & Security
  2. install ios-deploy globally using npm install -g ios-deploy
  3. run xcrun xctrace list devices to list all devices
  4. run npx react-native run-ios --device "phone name"
@Drzaln
Drzaln / file.md
Created September 30, 2022 13:53
Change location of close tab button to left on vscode

add this line to user setting "workbench.editor.tabCloseButton": "left",